changeset 96f84359740b in modules/purchase:default
details: https://hg.tryton.org/modules/purchase?cmd=changeset;node=96f84359740b
description:
        Allow extending purchase unit price

        issue9979
        review330061002
diffstat:

 product.py |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 78c546154050 -r 96f84359740b product.py
--- a/product.py        Sun Feb 21 19:19:26 2021 +0100
+++ b/product.py        Sat Feb 27 10:15:34 2021 +0100
@@ -147,6 +147,9 @@
         pattern['product'] = None
         yield from self.template.product_suppliers_used(**pattern)
 
+    def _get_purchase_unit_price(self, quantity=0):
+        return self.get_multivalue('cost_price')
+
     @classmethod
     def get_purchase_price(cls, products, quantity=0):
         '''
@@ -181,7 +184,8 @@
         user = User(Transaction().user)
 
         for product in products:
-            prices[product.id] = product.get_multivalue('cost_price')
+            prices[product.id] = product._get_purchase_unit_price(
+                quantity=quantity)
             default_uom = product.default_uom
             default_currency = (user.company.currency if user.company
                 else None)

Reply via email to