Skip to content

Commit

Permalink
[FIX] base: _name_search of state
Browse files Browse the repository at this point in the history
When creating a new customer, the selection list for the state is empty
unless the country is filled in.

This is an issue since users usually fill the address fields in the
sequential order: street, city, state, zip and then country. Since no
state proposal is displayed, users tend to create a new state.

Introduced in 5fcf891.

opw-1941579
  • Loading branch information
nim-odoo committed Feb 20, 2019
1 parent e632e6c commit e62133f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion odoo/addons/base/models/res_country.py
Expand Up @@ -121,7 +121,7 @@ class CountryState(models.Model):
@api.model
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
args = args or []
if 'country_id' in self.env.context:
if self.env.context.get('country_id'):
args = expression.AND([args, [('country_id', '=', self.env.context.get('country_id'))]])

if operator == 'ilike' and not (name or '').strip():
Expand Down

0 comments on commit e62133f

Please sign in to comment.