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