[FIX] partner_autocomplete: correctly manage empty country data
Steps to reproduce: 1) Enter a vat number in a customer field (for exemple Sales Order) 2) Click on the suggestion => Traceback Task-ID 2059940 closes odoo/odoo#37180 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
committed by
Rémi Rahir
parent
65f657b2b2
commit
b969018475
@@ -2080,6 +2080,9 @@ class MailThread(models.AbstractModel):
|
||||
create_values['partner_ids'] = [(4, pid) for pid in create_values.get('partner_ids', [])]
|
||||
create_values['channel_ids'] = [(4, cid) for cid in create_values.get('channel_ids', [])]
|
||||
create_values_list.append(create_values)
|
||||
if 'default_child_ids' in self._context:
|
||||
ctx = {key: val for key, val in self._context.items() if key != 'default_child_ids'}
|
||||
self = self.with_context(ctx)
|
||||
return self.env['mail.message'].create(create_values_list)
|
||||
|
||||
# ------------------------------------------------------
|
||||
|
||||
@@ -50,8 +50,8 @@ class ResPartner(models.Model):
|
||||
if not country:
|
||||
country = self.env['res.country'].search([['name', '=ilike', country_name]])
|
||||
|
||||
state_id = {}
|
||||
country_id = {}
|
||||
state_id = False
|
||||
country_id = False
|
||||
if country:
|
||||
country_id = {
|
||||
'id': country.id,
|
||||
|
||||
Reference in New Issue
Block a user