Odoo Help

0

How to get the Model name and Action of the Current page? v7

By
Angel Kenneth Tolentino
on 6/19/14, 3:24 AM 1,091 views

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"
                />

1
Vũ Quốc Hoàng
On 6/19/14, 5:59 AM

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 

0

Prakash

--Prakash--
3218
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 6/19/14, 6:02 AM

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/19/14, 3:24 AM
Seen: 1091 times
Last updated: 3/16/15, 8:10 AM