如何在新创建的模块中从Odoo v8中的Javascript文件调用python函数?

2024-05-14 14:38:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Odoo v8中创建了一个新模块,我想从static/src/js中定义的JavaScript文件调用在该模块的controllers文件夹中定义的python函数。

我试过以下方法:

一。

function openerp_pos_models(instance){

var myModel = new instance.web.Model('my.model'); 
//code to call python method
});

但在加载页面时,它会显示instance is not defined

2。

var Users = new openerp.web.Model('res.users');

但这表明Uncaught TypeError: Cannot read property 'Model' of undefined


Tags: 模块文件instanceodoosrcwebnewmodel

热门问题