gityopie/odoo-addons

Server error when "Springfield" is in street field

Closed this issue · 1 comments

v12

When the street field is Springfield or "Springfield" the geolocalize returns an index out of range server error:

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/tools/safe_eval.py", line 350, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
  File "", line 11, in <module>
  File "/odoo/custom/addons/crm_maps/models/crm_lead.py", line 36, in geo_localize
    apikey=google_api_key)
  File "/odoo/odoo-server/addons/base_geolocalize/models/res_partner.py", line 42, in geo_find
    geo = result['results'][0]['geometry']['location']
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/odoo/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/odoo/odoo-server/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/odoo/odoo-server/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 962, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 749, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 736, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/odoo/odoo-server/addons/crm/models/crm_lead.py", line 338, in write
    return super(Lead, self).write(vals)
  File "/odoo/odoo-server/addons/mail/models/mail_thread.py", line 322, in write
    result = super(MailThread, self).write(values)
  File "/odoo/odoo-server/addons/mail/models/mail_activity.py", line 588, in write
    return super(MailActivityMixin, self).write(vals)
  File "/odoo/odoo-server/odoo/models.py", line 3321, in write
    self._write(store_vals)
  File "/odoo/odoo-server/addons/base_automation/models/base_automation.py", line 259, in _write
    action._process(records, domain_post=domain_post)
  File "/odoo/odoo-server/addons/base_automation/models/base_automation.py", line 205, in _process
    self.action_server_id.with_context(**ctx).run()
  File "/odoo/odoo-server/addons/base/models/ir_actions.py", line 569, in run
    res = func(action, eval_context=eval_context)
  File "/odoo/odoo-server/addons/website/models/ir_actions.py", line 57, in run_action_code_multi
    res = super(ServerAction, self).run_action_code_multi(action, eval_context)
  File "/odoo/odoo-server/addons/base/models/ir_actions.py", line 445, in run_action_code_multi
    safe_eval(action.sudo().code.strip(), eval_context, mode="exec", nocopy=True)  # nocopy allows to return 'action'
  File "/odoo/odoo-server/odoo/tools/safe_eval.py", line 373, in safe_eval
    pycompat.reraise(ValueError, ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr)), exc_info[2])
  File "/odoo/odoo-server/odoo/tools/pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
  File "/odoo/odoo-server/odoo/tools/safe_eval.py", line 350, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
  File "", line 11, in <module>
  File "/odoo/custom/addons/crm_maps/models/crm_lead.py", line 36, in geo_localize
    apikey=google_api_key)
  File "/odoo/odoo-server/addons/base_geolocalize/models/res_partner.py", line 42, in geo_find
    geo = result['results'][0]['geometry']['location']
ValueError: <class 'IndexError'>: "list index out of range" while evaluating
"# Available variables:\n#  - env: Odoo Environment on which the action is triggered\n#  - model: Odoo Model of the record on which the action is triggered; is a void recordset\n#  - record: record on which the action is triggered; may be void\n#  - records: recordset of all records on which the action is triggered in multi-mode; may be void\n#  - time, datetime, dateutil, timezone: useful Python libraries\n#  - log: log(message, level='info'): logging function to record debug information in ir.logging table\n#  - Warning: Warning Exception to use with raise\n# To return an action, assign: action = {...}\n\nrecord.geo_localize()"

Sorry I did not notice the error is in a base odoo module.