changeset f483afc2c109 in modules/sale_discount:default
details:
https://hg.tryton.org/modules/sale_discount?cmd=changeset;node=f483afc2c109
description:
Convert base price to the line unit
issue9917
review308811002
diffstat:
sale.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (22 lines):
diff -r 8588a6648c4a -r f483afc2c109 sale.py
--- a/sale.py Tue Nov 17 17:59:02 2020 +0100
+++ b/sale.py Sun Dec 06 00:35:52 2020 +0100
@@ -56,10 +56,16 @@
self.discount_amount = self.on_change_with_discount_amount()
self.discount = self.on_change_with_discount()
- @fields.depends('product')
+ @fields.depends('product', 'unit')
def compute_base_price(self):
+ pool = Pool()
+ Uom = pool.get('product.uom')
if self.product:
- return round_price(self.product.list_price)
+ price = self.product.list_price
+ if self.unit:
+ price = Uom.compute_price(
+ self.product.default_uom, price, self.unit)
+ return round_price(price)
@fields.depends(
methods=[