装饰器在Cron功能中的作用是什么?
ODOO -13.0
我最近面临以下CRON Jobs的错误。 谷歌搜索时,它可以正常工作数月
ValueError: <class 'AttributeError'>: "'model' object has no attribute 'my_function'" while evaluating 'model.my_function()'
,发现建议将@api.model
装饰器添加到功能中。我做到了,错误消失了。
有人可以解释为什么克朗的工作需要那个装饰师吗?了解使它失败的原因真的很有帮助。
odoo - 13.0
I recently faced the below error in cron jobs. It was working fine for months
ValueError: <class 'AttributeError'>: "'model' object has no attribute 'my_function'" while evaluating 'model.my_function()'
Upon googling, found suggestions to add @api.model
decorator to the function. I did and error was gone.
Anyone could explain why cron job needed that decorator ? It would be really helpful to understand what made it fail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以转介ODOO官方文档以获取有关方法装饰器的知识。检查以下链接。
You can refer Odoo official documentation to get knowledge about method decorators.Check the below link.
Odoo Documentation - Method decorators
Decorator具体说,它是一个外部调用功能,没有调用ID,其他方法将旧的API调用转换为装饰功能为新的API签名。
However, 此URL表单将很有用
the decorator specific that it is an external invocation function where no id is called, additional the method converts old API calls to the decorated function to new API signature.
However, this URL form will be useful