This question has been flagged
1 Reply
4562 Views

Hi,

I am trying to load mail.message wizard using following code in python file:

return {

  'name': 'Compose Message',

        'type': 'ir.actions.act_window',

        'view_type': 'form',

        'view_mode': 'form',

        'res_model': 'mail.compose.message',

        'domain': [('parent_id', '=',12)],

        'views': [(compose_form_id, 'form')],

        'view_id': compose_form_id,

        'target': 'new',

        'context': ctx,

}

Wizard is opening proper. I need domain filter on partner_ids field and above domain is not working for that. I tried following scenarios:

 'domain': [('parent_id', '=', 12)]

 'domain': [['parent_id', '=', 12]]

 'domain': [('parent_id', '=', 12), ]

But nothing is working out. Can anyone please help me to find the issue. Do I need to specify field name as well where to put that domain. If yes, then how?

Avatar
Discard
Best Answer

Hi
Please try passing parent_id via context.

return {
'name': 'Compose Message',
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(compose_form_id, 'form')],
'view_id': compose_form_id,
'target': 'new',
'context': {
'default_parent_id': 12,
},
}

Regards

Avatar
Discard