我不知道如何问这个问题,但假设用户转到“会计”>“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/