Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
1350 Tampilan

When i try to create a dashboard like this:
model: Sale.order
operation: sum

measured field: total
group by: seller (user_id)


I get this error:

Traceback (most recent call last):
  File "/opt/odoo18/odoo/http.py", line 1957, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/service/model.py", line 137, in retrying
    result = func()
             ^^^^^^
  File "/opt/odoo18/odoo/http.py", line 1924, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/http.py", line 2171, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^
  File "/opt/odoo18/odoo/addons/base/models/ir_http.py", line 329, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/http.py", line 727, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/addons/web/controllers/dataset.py", line 35, in call_kw
    return call_kw(request.env[model], method, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/odoo/api.py", line 517, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/odoo18/custom/addons/odoo_dynamic_dashboard/models/dashboard_block.py", line 126, in get_dashboard_vals
    self._cr.execute(self.env[rec.model_name].get_query(domain,
  File "/opt/odoo18/odoo/sql_db.py", line 354, in execute
    res = self._obj.execute(query, params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.UndefinedColumn: column res_users.name does not exist
LINE 1: ...ALESCE(SUM("sale_order".amount_total),0) AS value,"res_users...

Seems like the error comes from a query on the database, this doesn't happen for every selectable field on 'group by', just by some like the seller field.

Avatar
Buang
Jawaban Terbai

Hi,
Not sure if you use any existing functionalities or custom solution, the error says that there is no field name in the model res_users, instead you have to left join the query with res_partner table and get the name from partner table.

Thanks

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
3
Okt 25
386
2
Okt 25
464
1
Okt 25
450
1
Sep 25
373
1
Sep 25
459