Skip to content

Commit

Permalink
Initial support for the discounted field in the bundle line
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Dec 13, 2018
1 parent bf2a891 commit da8d569
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/budy/models/bag_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def to_order_line_s(self, order = None):
size = self.size,
size_s = self.size_s,
scale = self.scale,
discounted = self.discounted,
attributes = self.attributes,
product = self.product,
order = order
Expand Down
15 changes: 14 additions & 1 deletion src/budy/models/bundle_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,22 @@ class BundleLine(base.BudyBase):
type = int
)

discounted = appier.field(
type = bool,
initial = False,
index = True,
observations = """If the product associated with the
current line is a discounted one, meaning that the product
price is affected by some discount"""
)

closed = appier.field(
type = bool,
initial = False,
index = True
index = True,
observations = """Simple flag that control if the line is
closed meaning that calculated values (eg: totals) can no
longer be re-calculated as the line is now frozen"""
)

attributes = appier.field()
Expand Down Expand Up @@ -131,6 +143,7 @@ def calculate(self, currency = None, country = None, force = False):
country = country,
force = force
)
self.discounted = self.merchandise.is_discounted

def measure(self, currency = None, country = None, force = False):
if self.closed: return
Expand Down

0 comments on commit da8d569

Please sign in to comment.