From e62133f205828643228570ea915a2eaea084a3e3 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 20 Feb 2019 11:41:09 +0100 Subject: [PATCH] [FIX] base: _name_search of state 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 5fcf891e07bf61518e6bf0be0dc4f27859d45778. opw-1941579 --- odoo/addons/base/models/res_country.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/res_country.py b/odoo/addons/base/models/res_country.py index fe86446bfbccd..8fd1f978ed02c 100644 --- a/odoo/addons/base/models/res_country.py +++ b/odoo/addons/base/models/res_country.py @@ -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():