Skip to Content
Menu
This question has been flagged
1 Reply
1236 Views

I created a different department section for vendors, now I need to display the department in another field. Whenever I select the vendor, only the department related to that particular vendor should be chosen but it shows all the departments in another field. can anyone help me out there?

Avatar
Discard
Best Answer

Hi Santosh,

I think by returning domain to your new field in onchange function of the field vendor will solve your issue.

Try this:

@api.onchange('partner_id')
def _onchange_partner_id(self):
self.department_id_field = False
if
self.partner_id:
domain = [('vendor_field_in_department', '=', self.partner_id.id)]
return {'domain': domain}

Hope this will work for you

Thank you

Avatar
Discard