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
This commit is contained in:
Maxime Richez
2023-08-02 19:28:47 +02:00
parent 6c9f4422d4
commit c7cb91e369
2 changed files with 17 additions and 0 deletions
+1
View File
@@ -14,4 +14,5 @@ def register():
stock.ShipmentIn,
stock.ShipmentOut,
stock.ShipmentOutReturn,
stock.ShipmentInternal,
module='stock_secondary_unit', type_='model')
+16
View File
@@ -141,6 +141,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'
@@ -150,3 +156,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