数据看板 python_如何直接访问odoo12看板视图模板中的python方法?

我有一个看板视图,其中有一个模板在odoo12中,我需要访问那里的python方法数据,以便在表中打印它们。我的python方法返回键值对的字典。在

我使用t-foreach如下:

这是我模型中的方法:

^{pr2}$

在我的模板中,在页面加载时的方法调用中,我遇到了以下错误:Uncaught Error: QWeb2 - template['kanban-box']: Runtime Error: TypeError: dict.get_departments is not a function

http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3374

Traceback:

Error: QWeb2 - template['kanban-box']: Runtime Error: TypeError: dict.get_departments is not a function

at Object.exception (http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3374:7)

at Engine.eval (eval at _render (http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3416:73), :114:29)

at Engine._render (http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3415:296)

at Engine.render (http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3415:151)

at Engine._render (http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3419:57)

at Engine.render (http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3415:151)

at Class._render (http://localhost:8000/web/content/901-66db042/web.assets_backend.js:1804:451)

at Class.start (http://localhost:8000/web/content/901-66db042/web.assets_backend.js:1794:1256)

at Class.prototype. [as start] (http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3538:488)

at http://localhost:8000/web/content/862-f2fdf49/web.assets_common.js:3683:52

由于错误显示,我的python方法似乎无法在模板中访问,因此我可能需要定义一个JavaScript方法来访问python方法数据。有没有办法在看板视图的模板中直接访问python方法?如果是,我该怎么做?在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值