Sync secondary unit on supplier and internal shipments

When synchronize the outgoing or incoming move, the secondary unit must be
copied from the template.

Closes #12301
(grafted from b190ea97bd1a2040686ed6c9565ac20c45c529f4)

--HG--
branch : 6.0
This commit is contained in:
Maxime Richez
2023-08-02 19:28:47 +02:00
parent 7f28654b30
commit 8474358027
2 changed files with 17 additions and 0 deletions
+1
View File
@@ -13,4 +13,5 @@ def register():
stock.ShipmentIn,
stock.ShipmentOut,
stock.ShipmentOutReturn,
stock.ShipmentInternal,
module='stock_secondary_unit', type_='model')
+16
View File
@@ -153,6 +153,12 @@ class ShipmentOut(metaclass=PoolMeta):
inventory_move.secondary_unit = move.secondary_unit
return inventory_move
def _sync_outgoing_move(self, template=None):
move = super()._sync_outgoing_move(template)
if template:
move.secondary_unit = template.secondary_unit
return move
class ShipmentOutReturn(metaclass=PoolMeta):
__name__ = 'stock.shipment.out.return'
@@ -162,3 +168,13 @@ class ShipmentOutReturn(metaclass=PoolMeta):
if move:
move.secondary_unit = incoming_move.secondary_unit
return move
class ShipmentInternal(metaclass=PoolMeta):
__name__ = 'stock.shipment.internal'
def _sync_incoming_move(self, template=None):
move = super()._sync_incoming_move(template)
if template:
move.secondary_unit = template.secondary_unit
return move