Check inventory product quantities for customer return shipment

This commit is contained in:
Cédric Krier committed 2023-08-23 19:37:13 +02:00
1 parent bac493a487
commit 85712761dc
2 files changed
+17 -2

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Check inventory product quantities for customer return shipment
* Check outgoing product quantities of customer shipment
* Check inventory product quantities of supplier shipment
* Store original planned date of shipments to compute delay
+16 -2
View File
@@ -1834,7 +1834,8 @@ class ShipmentOut(
cls.write(shipments, {'planned_date': date})
class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
class ShipmentOutReturn(
ShipmentCheckQuantity, ShipmentMixin, Workflow, ModelSQL, ModelView):
"Customer Return Shipment"
__name__ = 'stock.shipment.out.return'
_rec_name = 'number'
@@ -2219,7 +2220,12 @@ class ShipmentOutReturn(ShipmentMixin, 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.inventory_moves])
inventory_moves = []
for shipment in shipments:
if shipment.warehouse_storage != shipment.warehouse_input:
shipment.check_quantity()
inventory_moves.extend(shipment.inventory_moves)
Move.do(inventory_moves)
for company, c_shipments in groupby(
shipments, key=lambda s: s.company):
with Transaction().set_context(company=company.id):
@@ -2228,6 +2234,14 @@ class ShipmentOutReturn(ShipmentMixin, 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.inventory_moves
@classmethod
@ModelView.button
@Workflow.transition('cancelled')