changeset fc6faf0b84b1 in modules/sale_supply_drop_shipment:default
details: 
https://hg.tryton.org/modules/sale_supply_drop_shipment?cmd=changeset&node=fc6faf0b84b1
description:
        Update cost price of supplier moves

        When recomputing the cost price of drop shipment, we should also update 
the
        supplier moves.

        issue11724
        review447281004
diffstat:

 stock.py                                     |  10 +++++-----
 tests/scenario_sale_supply_drop_shipment.rst |   3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r aa298e7213e0 -r fc6faf0b84b1 stock.py
--- a/stock.py  Tue Sep 27 00:29:24 2022 +0200
+++ b/stock.py  Sat Oct 01 15:38:48 2022 +0200
@@ -551,11 +551,11 @@
                 if qty:
                     product_cost[product] = round_price(cost / qty)
 
-            for c_move in shipment.customer_moves:
-                cost_price = product_cost[c_move.product]
-                if cost_price != c_move.cost_price:
-                    c_move.cost_price = cost_price
-                    to_save.append(c_move)
+            for move in shipment.moves:
+                cost_price = product_cost[move.product]
+                if cost_price != move.cost_price:
+                    move.cost_price = cost_price
+                    to_save.append(move)
         if to_save:
             Move.save(to_save)
 
diff -r aa298e7213e0 -r fc6faf0b84b1 
tests/scenario_sale_supply_drop_shipment.rst
--- a/tests/scenario_sale_supply_drop_shipment.rst      Tue Sep 27 00:29:24 
2022 +0200
+++ b/tests/scenario_sale_supply_drop_shipment.rst      Sat Oct 01 15:38:48 
2022 +0200
@@ -282,6 +282,9 @@
 
     >>> shipment, = [s for s in purchase.drop_shipments
     ...     if s.state == 'done']
+    >>> move, = shipment.supplier_moves
+    >>> move.cost_price
+    Decimal('4.0000')
     >>> move, = shipment.customer_moves
     >>> move.cost_price
     Decimal('4.0000')

Reply via email to