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

        issue9188
        review256871002
diffstat:

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

diffs (19 lines):

diff -r cb03905db099 -r 938f26a29b40 stock.py
--- a/stock.py  Thu Mar 19 19:09:06 2020 +0100
+++ b/stock.py  Mon Apr 13 17:18:28 2020 +0200
@@ -176,11 +176,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