javascript - openERP 7 : How to get the Model name and Action of the Current page?

标签 javascript odoo web-frameworks openerp-7

我不知道如何问这个问题,但假设用户转到“会计”>“vendor ”>“采购收据”,现在我只需要在该页面上执行某些操作。我怎么知道我在那个页面?我的解决方案是从实例中获取变量,但我没有得到任何运气,或者我是否以错误的方式看待这个问题?

我的代码:

instance.web.ViewManagerAction = instance.web.ViewManagerAction.extend({
    switch_mode: function(view_type, no_store, view_options){

        // for Testing, output to console the results that are similar to this
        console.log( "account.voucher" + "action='action_purchase_receipt'" );

        // some other code

        return  this._super(view_type, no_store, view_options);
    }
});

来自/addons/account_voucher 的代码:

   <menuitem
            id="menu_action_purchase_receipt"
            icon="STOCK_JUSTIFY_FILL"
            action="action_purchase_receipt"
            parent="account.menu_finance_payables"
            sequence="10"
            />

最佳答案

在您的方法中,只需调用 self._name 即可获取模型名称。

关于javascript - openERP 7 : How to get the Model name and Action of the Current page?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24302599/

相关文章:

javascript - 将 HTML 报告与 Mocha 测试框架结合使用

python - 如何在 Odoo 9.0 中使用自定义模型将自定义字段添加到数据透视 View

python - 区分 CherryPy 中的 GET 和 POST 数据?

c# - 对于 C# Web 开发,是否有 ASP.NET 的替代方案?

javascript - 如何使用JQuery PrettyDate插件?

javascript - Passport.js session 自行失效

postgresql - Odoo 10 - 取消的选股无法删除,为什么?

python - Odoo 8,获取错误 'datestyle' 设置

.net - ASP.Net Webforms 和 ASP.Net MVC 是基于组件还是基于 Action ?

javascript - 是否可以在 THREE.Js 中保存一帧