Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5481 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 16
9945
2
thg 5 24
3602
2
thg 4 23
29294
0
thg 7 19
2741
0
thg 7 15
4298