From 16a2f918328b32d5ca2f7beb5d6d8cd7084b997f Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 14 Nov 2017 10:52:58 +0100 Subject: [PATCH] [IMP] stock: Log if a method doesn't exist when running scheduler Purpose ======= If a method doesn't exist when running scheduler, log an error instead of raising an AttributeError The goal of a cron method is to go ad far as possible. --- addons/stock/models/procurement.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/procurement.py b/addons/stock/models/procurement.py index 2b51cf9f66a..cb1072efe50 100644 --- a/addons/stock/models/procurement.py +++ b/addons/stock/models/procurement.py @@ -184,7 +184,10 @@ class ProcurementGroup(models.Model): if not rule: raise UserError(_('No procurement rule found. Please verify the configuration of your routes')) - getattr(rule, '_run_%s' % rule.action)(product_id, product_qty, product_uom, location_id, name, origin, values) + if hasattr(rule, '_run_%s' % rule.action): + getattr(rule, '_run_%s' % rule.action)(product_id, product_qty, product_uom, location_id, name, origin, values) + else: + _logger.error("The method _run_%s doesn't exist on the procument rules" % rule.action) return True @api.model