Skip to Content
Menu
This question has been flagged
2 Replies
2080 Views

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Best Answer

Hi, 

You can watch following video for this:

https://youtu.be/ezH3ql5Dmx4

Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 15
4045
3
Nov 24
15644
1
Nov 22
2355
2
Dec 19
7377
1
Mar 19
3010