OCA/field-service

[14.0] Add customer broken: _compute_owned_location_count: TypeError: 'NewId' object is not iterable

MrTango opened this issue · 1 comments

Whenn I just install the fieldservice module in a plain new Odoo 14 DB, and try to add a customer, I get the following error.


Error:
Odoo Server Error

Traceback (most recent call last):
  File "/home/maik/develop/odoo/o14/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/home/maik/develop/odoo/o14/odoo/http.py", line 682, in dispatch
    result = self._call_function(**self.params)
  File "/home/maik/develop/odoo/o14/odoo/http.py", line 358, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/maik/develop/odoo/o14/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/maik/develop/odoo/o14/odoo/http.py", line 346, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/maik/develop/odoo/o14/odoo/http.py", line 911, in __call__
    return self.method(*args, **kw)
  File "/home/maik/develop/odoo/o14/odoo/http.py", line 530, in response_wrap
    response = f(*args, **kw)
  File "/home/maik/develop/odoo/o14/addons/web/controllers/main.py", line 1359, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/maik/develop/odoo/o14/addons/web/controllers/main.py", line 1351, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/maik/develop/odoo/o14/odoo/api.py", line 396, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/home/maik/develop/odoo/o14/odoo/api.py", line 383, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/maik/develop/odoo/o14/odoo/models.py", line 6146, in onchange
    value = record[name]
  File "/home/maik/develop/odoo/o14/odoo/models.py", line 5621, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/home/maik/develop/odoo/o14/odoo/fields.py", line 973, in __get__
    self.compute_value(recs)
  File "/home/maik/develop/odoo/o14/odoo/fields.py", line 1112, in compute_value
    records._compute_field_value(self)
  File "/home/maik/develop/odoo/o14/addons/mail/models/mail_thread.py", line 410, in _compute_field_value
    return super()._compute_field_value(field)
  File "/home/maik/develop/odoo/o14/odoo/models.py", line 4020, in _compute_field_value
    getattr(self, field.compute)()
  File "/home/maik/develop/odoo/o14/pyfleet/lib/python3.8/site-packages/odoo/addons/fieldservice/models/res_partner.py", line 27, in _compute_owned_location_count
    res = self.env["fsm.location"].search_count(
  File "/home/maik/develop/odoo/o14/odoo/models.py", line 1674, in search_count
    res = self.search(args, count=True)
  File "/home/maik/develop/odoo/o14/odoo/models.py", line 1697, in search
    res = self._search(args, offset=offset, limit=limit, order=order, count=count)
  File "/home/maik/develop/odoo/o14/odoo/models.py", line 4453, in _search
    query = self._where_calc(args)
  File "/home/maik/develop/odoo/o14/odoo/models.py", line 4209, in _where_calc
    return expression.expression(domain, self).query
  File "/home/maik/develop/odoo/o14/odoo/osv/expression.py", line 438, in __init__
    self.parse()
  File "/home/maik/develop/odoo/o14/odoo/osv/expression.py", line 830, in parse
    ids2 = to_ids(right, comodel, leaf)
  File "/home/maik/develop/odoo/o14/odoo/osv/expression.py", line 520, in to_ids
    return list(value)
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/maik/develop/odoo/o14/odoo/http.py", line 638, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/maik/develop/odoo/o14/odoo/http.py", line 314, in _handle_exception
    raise exception.with_traceback(None) from new_cause
TypeError: 'NewId' object is not iterable

After pulling updates from Odoo14, the issue disappeared.