Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1746 Vistas

This is my GitHub repository for my odoo project that I recently moved it to work on odoo v17:

github.com/akrembc/library_app_odoo17

when I navigate to my application called "library" then I go to "checkout" tab, an error will be raised that doesn't mention any of my application code:

Traceback (most recent call last):

  File "/home/akrem/work17/odoo/odoo/http.py", line 1768, in _serve_db

    return service_model.retrying(self._serve_ir_http, self.env)

  File "/home/akrem/work17/odoo/odoo/service/model.py", line 133, in retrying

    result = func()

  File "/home/akrem/work17/odoo/odoo/http.py", line 1795, in _serve_ir_http

    response = self.dispatcher.dispatch(rule.endpoint, args)

  File "/home/akrem/work17/odoo/odoo/http.py", line 1999, in dispatch

    result = self.request.registry['ir.http']._dispatch(endpoint)

  File "/home/akrem/work17/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch

    result = endpoint(**request.params)

  File "/home/akrem/work17/odoo/odoo/http.py", line 725, in route_wrapper

    result = endpoint(self, *args, **params_ok)

  File "/home/akrem/work17/odoo/addons/web/controllers/dataset.py", line 24, in call_kw

    return self._call_kw(model, method, args, kwargs)

  File "/home/akrem/work17/odoo/addons/web/controllers/dataset.py", line 20, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/akrem/work17/odoo/odoo/api.py", line 464, in call_kw

    result = _call_kw_model(method, model, args, kwargs)

  File "/home/akrem/work17/odoo/odoo/api.py", line 435, in _call_kw_model

    result = method(recs, *args, **kwargs)

  File "/home/akrem/work17/odoo/addons/web/models/models.py", line 677, in search_panel_select_range

    comodel_records = Comodel.search_read(comodel_domain, field_names, limit=limit)

  File "/home/akrem/work17/odoo/odoo/models.py", line 5732, in search_read

    records = self.search_fetch(domain or [], fields, offset=offset, limit=limit, order=order)

  File "/home/akrem/work17/odoo/odoo/models.py", line 1634, in search_fetch

    query = self._search(domain, offset=offset, limit=limit, order=order or self._order)

  File "/home/akrem/work17/odoo/odoo/models.py", line 5391, in _search

    query = self._where_calc(domain)

  File "/home/akrem/work17/odoo/odoo/models.py", line 5102, in _where_calc

    return expression.expression(domain, self).query

  File "/home/akrem/work17/odoo/odoo/osv/expression.py", line 794, in __init__

    self.parse()

  File "/home/akrem/work17/odoo/odoo/osv/expression.py", line 1021, in parse

    dom = HIERARCHY_FUNCS[operator](left, ids2, model)

  File "/home/akrem/work17/odoo/odoo/osv/expression.py", line 935, in parent_of_domain

    records = records[parent_name] - records.browse(parent_ids)

  File "/home/akrem/work17/odoo/odoo/models.py", line 6488, in __sub__

    raise TypeError(f"inconsistent models in: {self} - {other}")

TypeError: inconsistent models in: res.partner() - library.member(3,)


Note that this error only occur when trying to access kanban or list view of checkout model, if for example I navigate directly to form, pivot, graph or calendar view, no error will be thrown


Also note that this wasn't the case when the project was running on odoo v15 so everything was working as expected

Avatar
Descartar
Autor Mejor respuesta

I fixed it,

what's common between the Kanban and list view is the element, and indeed it uses the library.member model.

this is how it was:

searchpanel

  field name="member_id" enable_counters="1" /

  field name="stage_id" select="multi" /

/searchpanel

this is my rework:

first, I added the field "partner_id" to the "library_checkout" model:


partner_id = fields.Many2one(related="member_id.partner_id", store=True)



then replace the "member_id" field with "partner_id" in the searchpanel element:

searchpanel

  field name="partner_id" enable_counters="1" /

  field name="stage_id" select="multi" /

/searchpanel

 




This one is obviously on the odoo developers, they must provide an error message that take you back to your own code not just odoo code !!

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
jun 24
1668
4
may 25
2410
2
may 25
5746
1
mar 25
1600
4
mar 25
4389