changeset f6cc00af7b64 in modules/sale:5.6
details: https://hg.tryton.org/modules/sale?cmd=changeset;node=f6cc00af7b64
description:
Compute price list with raw sale unit price
The price list expect to have a unit price in the default unit and
company
currency otherwise non proportional operations provide wrong result
when a
different unit or currency is used.
issue9929
review345161002
(grafted from 9d3c21b3bee5fe719d174e129f1b0b812a7a317c)
diffstat:
product.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diffs (23 lines):
diff -r cd76518b5064 -r f6cc00af7b64 product.py
--- a/product.py Fri Dec 11 15:44:42 2020 +0100
+++ b/product.py Thu Dec 17 21:30:26 2020 +0100
@@ -87,6 +87,9 @@
quantity = Transaction().context.get('quantity') or 0
return cls.get_sale_price(products, quantity=quantity)
+ def _get_sale_unit_price(self, quantity=0):
+ return self.list_price_used
+
@classmethod
def get_sale_price(cls, products, quantity=0):
'''
@@ -117,7 +120,8 @@
user = User(Transaction().user)
for product in products:
- prices[product.id] = product.list_price_used
+ prices[product.id] = product._get_sale_unit_price(
+ quantity=quantity)
if uom and product.default_uom.category == uom.category:
prices[product.id] = Uom.compute_price(
product.default_uom, prices[product.id], uom)