changeset d7461ce47a81 in modules/sale_supply_drop_shipment:default
details: 
https://hg.tryton.org/modules/sale_supply_drop_shipment?cmd=changeset;node=d7461ce47a81
description:
        Use original cost price for returned move

        and factorize the cost price of move for cost computation

        issue9440
        review327491003
diffstat:

 stock.py |  9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diffs (27 lines):

diff -r 82e29b4ca031 -r d7461ce47a81 stock.py
--- a/stock.py  Thu Jul 09 10:21:07 2020 +0100
+++ b/stock.py  Mon Aug 10 23:38:04 2020 +0200
@@ -408,7 +408,6 @@
         pool = Pool()
         UoM = pool.get('product.uom')
         Move = pool.get('stock.move')
-        Currency = pool.get('currency.currency')
 
         to_save = []
         for shipment in shipments:
@@ -427,14 +426,8 @@
                 if s_move.state == 'cancelled':
                     continue
                 internal_quantity = Decimal(str(s_move.internal_quantity))
-                with Transaction().set_context(date=s_move.effective_date):
-                    unit_price = Currency.compute(
-                        s_move.currency, s_move.unit_price,
-                        s_move.company.currency, round=False)
-                unit_price = UoM.compute_price(
-                    s_move.uom, unit_price, s_move.product.default_uom)
                 product_cost[s_move.product] += (
-                    unit_price * internal_quantity)
+                    s_move.get_cost_price() * internal_quantity)
 
                 quantity = UoM.compute_qty(
                     s_move.uom, s_move.quantity, s_move.product.default_uom,

Reply via email to