diff --git a/modules/stock/CHANGELOG b/modules/stock/CHANGELOG index 83ecc7d7b8..c053a849d6 100644 --- a/modules/stock/CHANGELOG +++ b/modules/stock/CHANGELOG @@ -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 diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py index 35347f54d7..7d4ae1b677 100644 --- a/modules/stock/shipment.py +++ b/modules/stock/shipment.py @@ -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')