changeset 226c6ea53254 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=226c6ea53254
description:
        Use unit_price_company

        issue10586
        review369311002
diffstat:

 product.py |  8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diffs (25 lines):

diff -r 61b18217c99b -r 226c6ea53254 product.py
--- a/product.py        Wed Jul 28 00:35:24 2021 +0200
+++ b/product.py        Wed Jul 28 00:35:50 2021 +0200
@@ -337,7 +337,6 @@
     def recompute_cost_price_average(self, start=None):
         pool = Pool()
         Move = pool.get('stock.move')
-        Currency = pool.get('currency.currency')
         Uom = pool.get('product.uom')
         Revision = pool.get('product.cost_price.revision')
 
@@ -406,12 +405,7 @@
             if out_move(move):
                 qty *= -1
             if in_move(move):
-                with Transaction().set_context(date=move.effective_date):
-                    unit_price = Currency.compute(
-                        move.currency, move.unit_price,
-                        move.company.currency, round=False)
-                unit_price = Uom.compute_price(
-                    move.uom, unit_price, self.default_uom)
+                unit_price = move.get_cost_price(product_cost_price=cost_price)
                 if quantity + qty > 0 and quantity >= 0:
                     cost_price = (
                         (cost_price * quantity) + (unit_price * qty)

Reply via email to