Update cost price of supplier moves

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

issue11724
review447281004
This commit is contained in:
Cédric Krier committed 2022-10-01 15:38:48 +02:00
1 parent 536a697a43
commit 19c84777d6
2 files changed
+8 -5

No files matched your search

+5 -5
View File
@@ -551,11 +551,11 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
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)
@@ -282,6 +282,9 @@ Receive purchase invoice at different price::
>>> 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')