[FIX] calendar: do not try to read virtual ids from database
Try to access a recurring event.
The _search function defined in mail_message tries to read records,
building a list of ids.
They are given to the _search of calendar, which builds its custom SQL query
using the data it received.
Since it got recurring ids instead of real ones, we get:
SELECT id, ("calendar_event"."id" in (101,'101-2019011118000...
Bug introduced in f74f5edc77.
If we get such a request, we convert the virtual ids back to real ids.
Note that a similar conversion was done in calendar's override of "mail.message"
_search method, 'in the case it was asked on virtual ids'.
Note that as of this commit making messages on virtual_ids doesn't even work,
so it is possible that this mess was introduced for the chatter feature,
which has been broken before, and so all of it is useless.
closes #27474
closes #28288
closes #28621
opw 1928562
opw 1930763
opw 1935148
closes odoo/odoo#30827
This commit is contained in:
@@ -1129,6 +1129,9 @@ class Meeting(models.Model):
|
||||
select_fields = ["id"]
|
||||
where_params_list = []
|
||||
for pos, arg in enumerate(domain):
|
||||
# hack: if we received recurrent ids, we need to clean them
|
||||
if arg[0] == 'id' and arg[1] in ('in', 'not in'):
|
||||
arg = (arg[0], arg[1], [calendar_id2real_id(id) for id in arg[2]])
|
||||
if not arg[0] in ('start', 'stop', 'final_date', '&', '|'):
|
||||
e = expression.expression([arg], self)
|
||||
where_clause, where_params = e.to_sql() # CAUTION, wont work if field is autojoin, not supported
|
||||
|
||||
Reference in New Issue
Block a user