Skip to Content
Menú
This question has been flagged
3 Respostes
2159 Vistes

Hi,


I'm using Odoo 15 community and I have this error 

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 364, in checked_call
    self._cr.flush()
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 110, in flush
    self.precommit.run()
  File "/usr/lib/python3/dist-packages/odoo/tools/misc.py", line 1182, in run
    func()
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 544, in _finalize_tracking
    tracking = records.with_context(context).message_track(fnames, initial_values)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 623, in message_track
    record.message_post(subtype_id=subtype.id, tracking_value_ids=tracking_value_ids)
  File "/usr/lib/python3/dist-packages/odoo/addons/rating/models/mail_thread.py", line 14, in message_post
    message = super(MailThread, self).message_post(**kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 1882, in message_post
    self._notify_thread(new_message, values, **notif_kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/sms/models/mail_thread.py", line 239, in _notify_thread
    recipients_data = super(MailThread, self)._notify_thread(message, msg_vals=msg_vals, notify_by_email=notify_by_email, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 2181, in _notify_thread
    rdata = self._notify_compute_recipients(message, msg_vals)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 2465, in _notify_compute_recipients
    res = self.env['mail.followers']._get_recipient_data(self, message_type, subtype_id, pids)
  File "/usr/lib/python3/dist-packages/odoo/addons/sms/models/mail_followers.py", line 24, in _get_recipient_data
    return super(Followers, self)._get_recipient_data(records, message_type, subtype_id, pids=pids)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_followers.py", line 140, in _get_recipient_data
    self.env.cr.execute(query, tuple(params))
  File "", line 2, in execute
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 90, in check
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 311, in execute
    res = self._obj.execute(query, params)
Exception

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

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
psycopg2.errors.GroupingError: column "partner.active" must appear in the GROUP BY clause or be used in an aggregate function
LINE 21:            partner.active as active,
I have this error during many manipulation like reconcile, send email with custom model.

This is my error in odooDB

2023-08-03 13:24:12.933 UTC [587] ERROR: column "partner.active" must appear in the GROUP BY clause or be used in an aggregate function at character 670

2023-08-03 13:24:12.933 UTC [587] STATEMENT:

SELECT DISTINCT ON (pid) * FROM (

WITH sub_followers AS (

SELECT fol.partner_id,

coalesce(subtype.internal, false) as internal

FROM mail_followers fol

JOIN mail_followers_mail_message_subtype_rel subrel ON subrel.mail_followers_id = fol.id

JOIN mail_message_subtype subtype ON subtype.id = subrel.mail_message_subtype_id

WHERE subrel.mail_message_subtype_id = 5

AND fol.res_model = 'account.move'

AND fol.res_id IN (466)

UNION ALL

SELECT id,

FALSE

FROM res_partner

WHERE id=ANY('{}')

)

SELECT partner.id as pid,

partner.active as active,

partner.partner_share as pshare,

users.notification_type AS notif,

array_agg(groups_rel.gid) AS groups

FROM res_partner partner

LEFT JOIN res_users users ON users.partner_id = partner.id

AND users.active

LEFT JOIN res_groups_users_rel groups_rel ON groups_rel.uid = users.id

JOIN sub_followers ON sub_followers.partner_id = partner.id

AND (NOT sub_followers.internal OR partner.partner_share IS NOT TRUE)

GROUP BY partner.id,

users.notification_type

) AS x

ORDER BY pid, notif


it's like a problem with mail module but no luck to find problem.

odoo community version 15.0-20230710
mail module version 15.0.1.5


Avatar
Descartar

could you provide the steps to reproduce the same in standard version of odoo.
ensure custom codes are not causing any issues

Best Answer

Hi,

The error you are encountering is related to a database query in Odoo that involves the mail module. The error message indicates that the column "partner.active" must appear in the GROUP BY clause or be used in an aggregate function. This means that when performing the query, the database requires that this column is either included in the GROUP BY clause or used with an aggregate function like SUM(), COUNT(), MAX(), MIN(), etc.

Hope it helps

Avatar
Descartar
Best Answer

You check again your query and try adding (GROUP BY partner.active)

Avatar
Descartar
Autor Best Answer

I have another odoo 15 community instance with same version, same module and I haven't this problem

Avatar
Descartar

so this is something to specific with your db, see if you have any extra modules in this db

Related Posts Respostes Vistes Activitat
3
de set. 25
1756
2
de set. 25
276
1
d’ag. 25
1743
1
de maig 25
1414
1
d’abr. 25
1259