تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
758 أدوات العرض

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.

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يوليو 25
164
1
يوليو 25
300
0
يوليو 25
324
1
يونيو 25
367
1
يونيو 25
365