From d5b2919200987f4b810545fa76f8c0b2eb88b083 Mon Sep 17 00:00:00 2001 From: Maxime Richez Date: Fri, 16 May 2025 13:20:28 +0200 Subject: [PATCH] Set empty currency and unit price on stock move when not required Closes #14023 (grafted from 6090f9c621e782cd47eb0537dee972c2f1fa8fe6) --HG-- branch : 7.0 --- modules/product_kit/purchase.py | 3 +++ modules/product_kit/sale.py | 3 +++ modules/purchase/purchase.py | 3 +++ modules/sale/sale.py | 3 +++ modules/sale_supply_drop_shipment/stock.py | 3 +++ modules/stock/shipment.py | 9 +++++++++ 6 files changed, 24 insertions(+) diff --git a/modules/product_kit/purchase.py b/modules/product_kit/purchase.py index 8bf1e86a8f..034c2f89b7 100644 --- a/modules/product_kit/purchase.py +++ b/modules/product_kit/purchase.py @@ -114,6 +114,9 @@ class LineComponent( move.unit_price = round_price( self.line.unit_price * self.price_ratio) move.currency = self.line.purchase.currency + else: + move.unit_price = None + move.currency = None move.planned_date = self.line.planned_delivery_date move.origin = self move.origin_planned_date = move.planned_date diff --git a/modules/product_kit/sale.py b/modules/product_kit/sale.py index bb00f60f45..0cf25f22f9 100644 --- a/modules/product_kit/sale.py +++ b/modules/product_kit/sale.py @@ -111,6 +111,9 @@ class LineComponent( move.unit_price = round_price( self.line.unit_price * self.price_ratio) move.currency = self.line.sale.currency + else: + move.unit_price = None + move.currency = None move.planned_date = self.line.planned_shipping_date move.origin = self move.origin_planned_date = move.planned_date diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index 81bc740266..3e5353eccc 100644 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1840,6 +1840,9 @@ class Line(sequence_ordered(), ModelSQL, ModelView): if move.on_change_with_unit_price_required(): move.unit_price = self.unit_price move.currency = self.purchase.currency + else: + move.unit_price = None + move.currency = None move.planned_date = self.planned_delivery_date move.invoice_lines = self._get_move_invoice_lines(move_type) move.origin = self diff --git a/modules/sale/sale.py b/modules/sale/sale.py index c2fba0eed8..6f9fc4a31f 100644 --- a/modules/sale/sale.py +++ b/modules/sale/sale.py @@ -1869,6 +1869,9 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView): if move.on_change_with_unit_price_required(): move.unit_price = self.unit_price move.currency = self.sale.currency + else: + move.unit_price = None + move.currency = None move.planned_date = self.planned_shipping_date move.invoice_lines = self._get_move_invoice_lines(shipment_type) move.origin = self diff --git a/modules/sale_supply_drop_shipment/stock.py b/modules/sale_supply_drop_shipment/stock.py index 202f51d44f..5ba340f6dc 100644 --- a/modules/sale_supply_drop_shipment/stock.py +++ b/modules/sale_supply_drop_shipment/stock.py @@ -426,6 +426,9 @@ class ShipmentDrop( else: move.unit_price = 0 move.currency = self.company.currency + else: + move.unit_price = None + move.currency = None return move @classmethod diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py index f52b8fe17a..6d0cc0e210 100644 --- a/modules/stock/shipment.py +++ b/modules/stock/shipment.py @@ -1518,6 +1518,9 @@ class ShipmentOut( if inventory_move.on_change_with_unit_price_required(): inventory_move.unit_price = move.unit_price inventory_move.currency = move.currency + else: + inventory_move.unit_price = None + inventory_move.currency = None return inventory_move @classmethod @@ -1600,6 +1603,9 @@ class ShipmentOut( else: move.unit_price = 0 move.currency = self.company.currency + else: + move.unit_price = None + move.currency = None return move @classmethod @@ -2682,6 +2688,9 @@ class ShipmentInternal( else: move.unit_price = 0 move.currency = self.company.currency + else: + move.unit_price = None + move.currency = None return move @classmethod