[FIX] partner_autocomplete: UserError instead of traceback when no credits
When creating a res_partner company, with "Auto-populate company data", if there is 'Insufficient Credit', AccessError, ConnectionError are caught, but not UserError. The user can therefore gets a vague js error "Uncaught TypeError: Cannot read property 'type' of undefined" We thus add exceptions.UserError among the caught exceptions. opw 2040646 closes odoo/odoo#35366 Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
@@ -95,7 +95,7 @@ class ResPartner(models.Model):
|
||||
})
|
||||
try:
|
||||
return jsonrpc(url=url, params=params, timeout=timeout), False
|
||||
except (ConnectionError, HTTPError, exceptions.AccessError) as exception:
|
||||
except (ConnectionError, HTTPError, exceptions.AccessError, exceptions.UserError) as exception:
|
||||
_logger.error('Autocomplete API error: %s' % str(exception))
|
||||
return False, str(exception)
|
||||
except InsufficientCreditError as exception:
|
||||
|
||||
Reference in New Issue
Block a user