Check outgoing product quantities for internal shipment

This commit is contained in:
Cédric Krier committed 2023-08-23 19:45:33 +02:00
1 parent ea6575e93b
commit f4f4a9cec1
2 files changed
+18 -2

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Check outgoing product quantities for internal shipment
* Check inventory product quantities for customer return shipment
* Check outgoing product quantities of customer shipment
* Check inventory product quantities of supplier shipment
+17 -2
View File
@@ -2290,7 +2290,9 @@ class ShipmentOutReturn(
cls.save(shipments)
class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
class ShipmentInternal(
ShipmentCheckQuantity, ShipmentAssignMixin, Workflow, ModelSQL,
ModelView):
"Internal Shipment"
__name__ = 'stock.shipment.internal'
_rec_name = 'number'
@@ -2893,7 +2895,12 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
pool = Pool()
Move = pool.get('stock.move')
Date = pool.get('ir.date')
Move.do([m for s in shipments for m in s.incoming_moves])
incoming_moves = []
for shipment in shipments:
if shipment.transit_location:
shipment.check_quantity()
incoming_moves.extend(shipment.incoming_moves)
Move.do(incoming_moves)
for company, c_shipments in groupby(
shipments, key=lambda s: s.company):
with Transaction().set_context(company=company.id):
@@ -2902,6 +2909,14 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
'effective_date': today,
})
@property
def _check_quantity_source_moves(self):
return self.incoming_moves
@property
def _check_quantity_target_moves(self):
return self.outgoing_moves
@classmethod
@ModelView.button
@Workflow.transition('cancelled')