跳至内容
菜单
此问题已终结
2 回复
2787 查看

Hello,

​I'm currently  working on a custom module in wich i'd like to modify 2 domains if an other is change. It look like this:

​@api.onchange('field_1')    
def onchange_partner_id(self):       
​for rec in self:
            ​return {'domain': {'field_2': [('parent_id', '=', rec.field_1.id)]}},{'field_3': [('parent_id', '=', rec.field_1.id)]} 

If it's not possible, please tell me if they're is an other way to do so, otherwise thank you for your answers !

Have a nice day,

Ewen JEZEQUEL

形象
丢弃
最佳答案

Hi,

The code you provided contains a syntax error where you have two separate dictionary objects.

Here is the corrected code:


@api.onchange('field_1')

def onchange_partner_id(self):

    for rec in self:

        return {'domain': {'field_2': [('parent_id', '=', rec.field_1.id)],

                           'field_3': [('parent_id', '=', rec.field_1.id)]}}


Hope it helps

形象
丢弃
最佳答案

Hi, 

You can watch following video for this:

https://youtu.be/ezH3ql5Dmx4

Thanks

形象
丢弃
相关帖文 回复 查看 活动
1
6月 15
4793
3
11月 24
17468
1
11月 22
2997
2
12月 19
8058
1
3月 19
3492