Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
12828 Vistas

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
Descartar
Mejor respuesta

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
Descartar

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.

Publicaciones relacionadas Respuestas Vistas Actividad
0
ago 17
3243
0
mar 15
4312
1
feb 24
2832
1
ago 19
4465
3
jun 19
7103