Commit 420d14f8 authored by Julien Muchembled's avatar Julien Muchembled

Amount: for total price, acquire price on resource only if unset

When a user explicitely enters 0 on a Trade Model Line, total price must be 0
no matter what is set on the resource.
parent 1f3dbf74
...@@ -408,7 +408,7 @@ class Amount(Base, VariatedMixin): ...@@ -408,7 +408,7 @@ class Amount(Base, VariatedMixin):
""" """
price = self.getPrice() price = self.getPrice()
if not price: if price is None:
price = self.getResourcePrice() price = self.getResourcePrice()
quantity = self.getNetConvertedQuantity() quantity = self.getNetConvertedQuantity()
if isinstance(price, (int, float)) and isinstance(quantity, (int, float)): if isinstance(price, (int, float)) and isinstance(quantity, (int, float)):
......
...@@ -373,7 +373,7 @@ return lambda delivery_amount, base_application, **kw: \\ ...@@ -373,7 +373,7 @@ return lambda delivery_amount, base_application, **kw: \\
self.appendBaseContributionCategory(order['1'], poster_present_3cd) self.appendBaseContributionCategory(order['1'], poster_present_3cd)
self.commit() self.commit()
self.getAggregatedAmountDict(order, partial_check=True, self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=None), SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=0),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=6000), TOTAL_PRICE_WITHOUT_VAT=dict(total_price=6000),
TOTAL_PRICE_WITH_VAT=dict(total_price=6300), TOTAL_PRICE_WITH_VAT=dict(total_price=6300),
VAT_AMOUNT=dict(total_price=300)) VAT_AMOUNT=dict(total_price=300))
...@@ -386,7 +386,7 @@ return lambda delivery_amount, base_application, **kw: \\ ...@@ -386,7 +386,7 @@ return lambda delivery_amount, base_application, **kw: \\
self.appendBaseContributionCategory(line, poster_present_1dvd) self.appendBaseContributionCategory(line, poster_present_1dvd)
self.commit() self.commit()
self.getAggregatedAmountDict(order, partial_check=True, self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=None, quantity=1, SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=0, quantity=1,
resource_value=self.poster), resource_value=self.poster),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=9000), TOTAL_PRICE_WITHOUT_VAT=dict(total_price=9000),
TOTAL_PRICE_WITH_VAT=dict(total_price=9450), TOTAL_PRICE_WITH_VAT=dict(total_price=9450),
...@@ -400,7 +400,7 @@ return lambda delivery_amount, base_application, **kw: \\ ...@@ -400,7 +400,7 @@ return lambda delivery_amount, base_application, **kw: \\
self.appendBaseContributionCategory(line, poster_present_3cd) self.appendBaseContributionCategory(line, poster_present_3cd)
self.commit() self.commit()
self.getAggregatedAmountDict(order, partial_check=True, self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=None, quantity=1, SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=0, quantity=1,
resource_value=self.poster), resource_value=self.poster),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=11400), TOTAL_PRICE_WITHOUT_VAT=dict(total_price=11400),
TOTAL_PRICE_WITH_VAT=dict(total_price=11970), TOTAL_PRICE_WITH_VAT=dict(total_price=11970),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment