Skip to content

Commit

Permalink
new reference support
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 23, 2016
1 parent 046a25f commit 72f7145
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/budy/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ class Order(bundle.Bundle):
canceled = "red"
)

reference = appier.field(
index = True,
safe = True
)

status = appier.field(
initial = "created",
index = True,
Expand Down Expand Up @@ -137,6 +132,12 @@ def list_names(cls):
def line_cls(cls):
return order_line.OrderLine

@classmethod
def _build(cls, model, map):
prefix = appier.conf("BUDY_ORDER_REF", "BD-%05d")
id = model.get("id", None)
if id: model["refernce"] = prefix % id

def verify(self):
appier.verify(not self.billing_address == None)
appier.verify(self.status == "created")
Expand Down

0 comments on commit 72f7145

Please sign in to comment.