changeset 91461d533df6 in modules/purchase_shipment_cost:5.4
details: 
https://hg.tryton.org/modules/purchase_shipment_cost?cmd=changeset;node=91461d533df6
description:
        Convert shipment cost into default uom

        issue9188
        review256871002
        (grafted from 938f26a29b4026d40f1e615abfbd4eda3de18229)
diffstat:

 stock.py |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 987148b7c679 -r 91461d533df6 stock.py
--- a/stock.py  Sat Apr 04 16:43:57 2020 +0200
+++ b/stock.py  Mon Apr 13 17:18:28 2020 +0200
@@ -178,11 +178,14 @@
     def _get_anglo_saxon_move(cls, moves, quantity, type_):
         pool = Pool()
         Currency = pool.get('currency.currency')
+        Uom = pool.get('product.uom')
         for move, qty, cost_price in super(Move, cls)._get_anglo_saxon_move(
                 moves, quantity, type_):
             if (type_.startswith('in_')
                     and move.unit_shipment_cost):
+                shipment_cost = Uom.compute_price(move.uom,
+                    move.unit_shipment_cost, move.product.default_uom)
                 shipment_cost = Currency.compute(move.currency,
-                    move.unit_shipment_cost, move.company.currency)
+                    shipment_cost, move.company.currency)
                 cost_price -= shipment_cost
             yield move, qty, cost_price

Reply via email to