Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
b190ea97 by Maxime Richez at 2023-08-02T19:28:47+02:00
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
- - - - -


2 changed files:

- modules/stock_secondary_unit/__init__.py
- modules/stock_secondary_unit/stock.py


Changes:

=====================================
modules/stock_secondary_unit/__init__.py
=====================================
@@ -14,4 +14,5 @@
         stock.ShipmentIn,
         stock.ShipmentOut,
         stock.ShipmentOutReturn,
+        stock.ShipmentInternal,
         module='stock_secondary_unit', type_='model')


=====================================
modules/stock_secondary_unit/stock.py
=====================================
@@ -141,6 +141,12 @@
             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 @@
         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



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/b190ea97bd1a2040686ed6c9565ac20c45c529f4

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/b190ea97bd1a2040686ed6c9565ac20c45c529f4
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to