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.

0

Redirect to QWeb view

By
nishad
on 4/10/16, 3:17 AM 461 views

How can i redirect my list view click in to a qweb page ?

I have a normal employee form,tree view . I need to redirect my tree view click to Qweb form, how do i achieve this? whats the best approach ? 

Any help is appreciated..

0
ELIASS BENFATEH
On 4/11/16, 6:18 AM

yes, it is possible to redirect your list view click . you have to do like this.

@api.multi
def button_method(self):
    return {
        'type': 'ir.actions.act_window',
        'name': 'form name',
        'res_model': 'object name',
        'res_id': id ,
        'view_type': 'form',
        'view_mode': 'form',
        'target' : 'new',
        }

but it is possible when record save. if you want to open wizard before save record you have to code in js like this.

in js file: openerp.module_name = function(instance) {

var QWeb = openerp.web.qweb;
    _t = instance.web._t;

instance.web.View.include({
    load_view: function(context) {
        var self = this;
        var view_loaded_def;
        $('#oe_linking_e').click(this.on_preview_view_button);

 //this is button class which call method for open your form.

       return self._super(context);
    },

//method which open form

    on_preview_view_button: function(e){
        e.preventDefault();
            this.do_action({
                name: _t("View name"),
                type: "ir.actions.act_window",
                res_model: "object",
                domain : [],
                views: [[false, "list"],[false, "tree"]],
                target: 'new',
                context: {},
                view_type : 'list',
                view_mode : 'list'
            });
        }
    },
});
};
in 

xml

 file add button and give 

id="oe_linking_e"

 whatever you give in 

js

 code.

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

1 follower(s)

Stats

Asked: 4/10/16, 3:17 AM
Seen: 461 times
Last updated: 5/19/16, 8:18 AM