Skip to content
Permalink
Browse files

[FIX] crm: states

Onchange to show only the states of an especific country in
opportunities.

Closes #31993
opw-1958170
  • Loading branch information...
IsabelEsparza authored and nim-odoo committed Mar 20, 2019
1 parent 46d22fb commit a017891aa473c599540d78ecb695774edc8e33a9
Showing with 7 additions and 0 deletions.
  1. +7 −0 addons/crm/models/crm_lead.py
@@ -277,6 +277,13 @@ def _onchange_state(self):
if self.state_id:
self.country_id = self.state_id.country_id.id

@api.onchange('country_id')
def _onchange_country_id(self):
res = {'domain': {'state_id': []}}
if self.country_id:
res['domain']['state_id'] = [('country_id', '=', self.country_id.id)]
return res

# ----------------------------------------
# ORM override (CRUD, fields_view_get, ...)
# ----------------------------------------

0 comments on commit a017891

Please sign in to comment.
You can’t perform that action at this time.