On Change Width Margin: calculate cost when qty is not null
This commit is contained in:
parent
79b7016797
commit
4990265673
6
sale.py
6
sale.py
|
@ -109,8 +109,10 @@ class SaleLine:
|
||||||
return Decimal('0.0')
|
return Decimal('0.0')
|
||||||
currency = self.sale.currency
|
currency = self.sale.currency
|
||||||
if self.type == 'line':
|
if self.type == 'line':
|
||||||
cost = Decimal(str(self.quantity)) * (self.cost_price or
|
if self.quantity and self.cost_price:
|
||||||
Decimal('0.0'))
|
cost = Decimal(str(self.quantity)) * (self.cost_price)
|
||||||
|
else:
|
||||||
|
cost = Decimal('0.0')
|
||||||
self.amount = self.on_change_with_amount()
|
self.amount = self.on_change_with_amount()
|
||||||
return Currency.round(currency, self.amount - cost)
|
return Currency.round(currency, self.amount - cost)
|
||||||
elif self.type == 'subtotal':
|
elif self.type == 'subtotal':
|
||||||
|
|
Loading…
Reference in New Issue