Skip to Content
Menu
This question has been flagged
2787 Views

Hi all,

My code is as blow,if self.user_id has values, return domain works,but if self.user_id is False, return domain does't work.

Can anyone help me? Thanks in advance.

@api.onchange('action_id')
def _onchange_action_id(self):
dfs_group_id = self.env.ref('sps_base.group_dfs_user')

if self.action_id and self.action_id.type == "dfs":
self.user_id = self.product_template_id.owner_dfs

return {
'domain': {
'user_id': [('id', 'in', [x.id for x in dfs_group_id.mapped('users')])]
}
}
Avatar
Discard