Odoo Help

Welcome!

This community 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.

1

Call an windows action from JS.

By
Vauxoo S.A. de C.V.
on 5/25/13, 10:25 PM 3,070 views

Hello.

We are developing some features that require call a windows action with an specific id, somebody can share an specific snnipet with this?.

We read the code and we found this:

        on_edit_help: function() {                                                 
        var self = this;                                                        
            self.rpc("/web/action/load", { action_id: "module_name.action_object_tree" }).done(function(result) {
                self.getParent().do_action(result, {                                                                                      
                    additional_context: {                                      
                          //HERE WE ARE TRYING SOME OPTIONS.
                    },                                                         
                });                                                            
            });                                                                 
       },

This snnipet is in a widget inside openerp, and we set a DOM element with the "click" method calling this function, the function is being called actually, no problem with that.

OPTIONS USED:

'active_id': KnownId, //Not Work, 'active_id': [KnownId], //Not Work. 'search_default_FIELD': It is not working.

We think it is a matter of the field in the SEARCH view, we tryed too, but the search is filled and the filter is not excecuted.

Question, Am i doing something wrong or it is a bug, the API should work in this way?

We tryied other option,. Build dinamically the action:

var action = {
    //Parameters
}

But the effect is exactly the same.

Some Help?

If somebody can share with me what module do this exactly, i can copy the code, but all options in OpenERP actually are solved in differents way.

Basically the question is:

How do i call an existent view in OpenERP with a customized link from JavaScript?

Limitant: I dont want to use a Menu, because the behavior is so especific.

Regards.

0
rongsy
On 1/9/14, 1:13 AM

I want to do like what you said in my case,but the result doesn't come out.the following is my code:

var Product = instance.web.Class.extend({
    buach_add_to: function(){
        var self = this;
        self.rpc("/web/action/load", { action_id: "stock.action_receive_move" }).done(function(result) {
            self.getParent().do_action(result, {                                                                                      
                additional_context: {                                          
                },                                                         
            });                                                            
        });   
        var v = new instance.web.View;                                                                                            
        v.reload();
    },
});

can you tell me why I can't do that sucess?

0
Vauxoo S.A. de C.V.
On 5/25/13, 11:07 PM

Solved......

Just after the call of action add this 2 lines to be sure the search is executed, If somebody think it is incorrect, or not elegant tell me please:

                var v = new instance.web.View;                                                                                            
                v.reload();

In my case i put after the call of action.

I want to do like what you said in my case,but the result doesn't come out.the following is my code:

rongsy
on 1/9/14, 1:09 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/25/13, 10:25 PM
Seen: 3070 times
Last updated: 3/16/15, 8:10 AM