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:
@@ -14,4 +14,5 @@ def register():
|
||||
stock.ShipmentIn,
|
||||
stock.ShipmentOut,
|
||||
stock.ShipmentOutReturn,
|
||||
stock.ShipmentInternal,
|
||||
module='stock_secondary_unit', type_='model')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user