diff options
| author | Yannick Tivisse <yti@odoo.com> | 2017-11-14 10:52:58 +0100 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2017-11-16 14:49:05 +0100 |
| commit | 16a2f918328b32d5ca2f7beb5d6d8cd7084b997f (patch) | |
| tree | 55d0dbe4d0bffbe8dfe5006e359deb86151e180f | |
| parent | 31e3a97577f45f53dd142d7cd201174875824363 (diff) | |
[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.
| -rw-r--r-- | addons/stock/models/procurement.py | 5 |
1 files changed, 4 insertions, 1 deletions
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 |
