跳至内容
菜单
此问题已终结
2 回复
12418 查看

I don't how to ask this, but assuming the user goes to "Accounting" > "Suppliers" > "Purchace Reciepts", now i need to do something only at that page.  How do i know that i am at that page?  Or i'm doing this the wrong way?

My code:

    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);
        }
    });

Code from /addons/account_voucher:

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

形象
丢弃
最佳答案

You need to Turn on Develope Mode by following

1. Look at the top right of application (Administration), click on it, then you will see About OpenERP. Then click on it. It will show you the wizard in the middle of the page. Then click on Active the Develop Mode.

2 Go to Accounting" > "Suppliers" > "Purchace Reciepts. You will see a small bar near the name "Purchase Reciepts" can be called as Debug Bar.

3. If you are working on Tree, just click Edit Tree View, then you will see the view (by xml_id) that you are working on 

形象
丢弃
最佳答案

this.dataset.model is used get current model in openerp

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

        // To get Current Module Name
        console.log("Module Name" +this.dataset.model);

        // some other code

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

形象
丢弃
相关帖文 回复 查看 活动
0
6月 25
236
2
6月 25
319
0
4月 25
798
2
1月 25
1050
2
12月 24
1222