diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 0eea2f21a7c482d029d31ede6e887653e615c974..d1fbd37b952b4c781e10e3a66ce4a5326f08f258 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -712,6 +712,11 @@ class QuantPackage(models.Model): move_line_to_modify.write({'package_id': False}) package.mapped('quant_ids').sudo().write({'package_id': False}) + # Quant clean-up, mostly to avoid multiple quants of the same product. For example, unpack + # 2 packages of 50, then reserve 100 => a quant of -50 is created at transfer validation. + self.env['stock.quant']._merge_quants() + self.env['stock.quant']._unlink_zero_quants() + def action_view_picking(self): action = self.env.ref('stock.action_picking_tree_all').read()[0] domain = ['|', ('result_package_id', 'in', self.ids), ('package_id', 'in', self.ids)]