mirror of
https://github.com/NaN-tic/trytond-sale_discount_visible.git
synced 2023-12-14 05:13:13 +01:00
Fix uncomputed unit price when discount is modified
This commit is contained in:
parent
2cd8fc9457
commit
9f762aec81
6
sale.py
6
sale.py
|
@ -12,9 +12,9 @@ class SaleLine:
|
||||||
__name__ = 'sale.line'
|
__name__ = 'sale.line'
|
||||||
|
|
||||||
def update_prices(self):
|
def update_prices(self):
|
||||||
self.discount = Decimal(0)
|
|
||||||
res = super(SaleLine, self).update_prices()
|
|
||||||
if hasattr(self, 'product'):
|
if hasattr(self, 'product'):
|
||||||
|
self.discount = Decimal(0)
|
||||||
|
res = super(SaleLine, self).update_prices()
|
||||||
Product = Pool().get('product.product')
|
Product = Pool().get('product.product')
|
||||||
gross_unit_price = Product.get_sale_price([self.product],
|
gross_unit_price = Product.get_sale_price([self.product],
|
||||||
self.quantity or 0)[self.product.id]
|
self.quantity or 0)[self.product.id]
|
||||||
|
@ -23,4 +23,6 @@ class SaleLine:
|
||||||
Decimal(1) / 10 ** self.__class__.unit_price.digits[1])
|
Decimal(1) / 10 ** self.__class__.unit_price.digits[1])
|
||||||
res['discount'] = 1 - (res['unit_price'] /
|
res['discount'] = 1 - (res['unit_price'] /
|
||||||
res['gross_unit_price'])
|
res['gross_unit_price'])
|
||||||
|
else:
|
||||||
|
res = super(SaleLine, self).update_prices()
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in a new issue