[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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user