Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
12836 Ansichten

I want to pass context to a wizard that is called on a button click action from JS, I tried the following code but it didn't work.


on_click_new_message: function () {
        this.do_action({
            type: 'ir.actions.act_window',
            res_model: 'mail.compose.message',
            view_mode: 'form',
            view_type: 'form',
            views: [[false, 'form']],
            target: 'new',
            context: {'default_no_auto_thread': False, 'active_model': 'mail.message','subject':message.subject,'body':message.body}
        });
    },


The wizard appears but the values are not set.


Please let me know if any one knows

Avatar
Verwerfen
Beste Antwort

try:

on_click_new_message: function () {
        this.do_action({
            type: 'ir.actions.act_window',
            res_model: 'mail.compose.message',
            view_mode: 'form',
            view_type: 'form',
            views: [[false, 'form']],
            target: 'new',
            context: {'default_no_auto_thread': False, 'active_model': 'mail.message','
default_subject':message.subject,'default_body':message.body}
        });
    },


Avatar
Verwerfen

Hello Hillar,

Can we make this wizard read-only when open through do_action() method?

That depends on logic. You can make a field readonly using attrs, or direct read-only flag. So while doing an action you can set a fields value through contexts. This can be useful for using attrs in field. 

On Mon, 15 Jul 2019, 4:41 pm Pawan Kumar Sharma, <pawan.sharma@sunarctechnologies.com> wrote:

Hello Hillar,

Can we make this wizard read-only when open through do_action() method?

Sent by Odoo S.A. using Odoo.

Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Aug. 17
3246
0
März 15
4314
1
Feb. 24
2839
1
Aug. 19
4467
3
Juni 19
7108