Skip to Content
Menu
This question has been flagged
1 Reply
1568 Views

good evening everyone , 

let me explain the issue , when i am in the partner form view and i add a log and i mention a user using the @ (i get the list to choose the partner ) and choose the partner

after saving the log and when i clik on the name of the partner it redirect me to the default form view of the partner  while i wan't to be redirected to the customized form view i tried to inspect the element on the browser it shows that the used class is "o_mail_redirect"
if anyone have an idea about this it would be great 

thank you very much

Avatar
Discard
Best Answer

Hi,

You already found the right lead. you only need lil push ^^
In Js, we have : 

'click .o_mail_redirect': '_onRedirect',

that is to say : when click on element with class o_mail_redirect, run this function : _onRedirect 

_onRedirect: function (ev) {
        ev.preventDefault();
        var $target = $(ev.target).closest('.o_mail_redirect');
        this.do_action({
            type: 'ir.actions.act_window',
            view_mode: 'form',
            res_model: $target.data('oe-model'),
            views: [[false, 'form']],
            res_id: $target.data('oe-id'),
        });
    },

here, instead of false, you need to specify your form xml_id.

because i don't have enough skills in js, i would call a rpc function to get the xml_id from python. But if you know how to do it, then let me know ;) 

You can look at this example : server13/addons/base_setup/static/src/js/res_config_invite_users.js:137

you'll also need to make sure that your res_model is res.partner : If it is, then add your code, otherwise call super.

Hope this helps you. 

Avatar
Discard