From 9a67c8b94665a394f452795d6c47984869a7af00 Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Mon, 29 Jan 2018 20:02:28 +0100 Subject: [PATCH] [FIX] stock: UserError message improvement To know the product still having some active reordering rules. Closes #22615 opw:813476 --- addons/stock/models/product.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 2a0e96f58dd..3d19c83be64 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -371,8 +371,14 @@ class Product(models.Model): @api.multi def write(self, values): res = super(Product, self).write(values) - if 'active' in values and not values['active'] and self.mapped('orderpoint_ids').filtered(lambda r: r.active): - raise UserError(_('You still have some active reordering rules on this product. Please archive or delete them first.')) + if 'active' in values and not values['active']: + products = self.mapped('orderpoint_ids').filtered(lambda r: r.active).mapped('product_id') + if products: + msg = _('You still have some active reordering rules on this product. Please archive or delete them first.') + msg += '\n\n' + for product in products: + msg += '- %s \n' % product.display_name + raise UserError(msg) return res class ProductTemplate(models.Model):