From f8ade1c96d00c5350a10dead129a36d713e2b9a0 Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Thu, 5 Apr 2018 14:48:53 +0200 Subject: [PATCH] [FIX] stock: To avoid singleton error Execute on a single record is used when calling the function _update_line_quantity and avoid singleton error Closes #23860 --- addons/sale_stock/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index 29514b574de..ccdeb94be37 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -343,8 +343,8 @@ class SaleOrderLine(models.Model): raise UserError('You cannot decrease the ordered quantity below the delivered quantity.\n' 'Create a return first.') for line in self: - pickings = self.order_id.picking_ids.filtered(lambda p: p.state not in ('done', 'cancel')) + pickings = line.order_id.picking_ids.filtered(lambda p: p.state not in ('done', 'cancel')) for picking in pickings: picking.message_post("The quantity of %s has been updated from %d to %d in %s" % - (line.product_id.name, line.product_uom_qty, values['product_uom_qty'], self.order_id.name)) + (line.product_id.name, line.product_uom_qty, values['product_uom_qty'], line.order_id.name)) super(SaleOrderLine, self)._update_line_quantity(values)