装饰器在Cron功能中的作用是什么?

发布于 2025-01-31 08:04:25 字数 324 浏览 4 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

魔法少女 2025-02-07 08:04:25

您可以转介ODOO官方文档以获取有关方法装饰器的知识。检查以下链接。

You can refer Odoo official documentation to get knowledge about method decorators.Check the below link.

Odoo Documentation - Method decorators

冬天的雪花 2025-02-07 08:04:25

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文