Skip to content
Snippets Groups Projects
Commit c0db5205 authored by Benjamin - Le Filament's avatar Benjamin - Le Filament
Browse files

[fix] temporary fix OCA error module before merging PR

parent 254d9166
No related branches found
No related tags found
No related merge requests found
......@@ -11,3 +11,4 @@ from . import res_partner_ministere
from . import scop_liasse_fiscale
from . import scop_models_lm
from . import scop_partner_staff
from . import mail_tracking_email
from odoo import models
class MailTrackingEmail(models.Model):
_inherit = "mail.tracking.email"
def _find_allowed_tracking_ids(self):
"""
Override parent
TODO: delete afer merge PR https://github.com/OCA/social/pull/1128
"""
# Admins passby this filter
if not self or self.env.user.has_group("base.group_system"):
return self.ids
# Override ORM to get the values directly
self._cr.execute(
"""
SELECT id, mail_message_id, partner_id
FROM mail_tracking_email WHERE id IN %s
""",
(tuple(self.ids),),
)
msg_linked = self._cr.fetchall()
if not msg_linked:
return []
_, msg_ids, partner_ids = zip(*msg_linked)
# Filter messages with their ACL rules avoiding False values fetched in the set
msg_ids = self.env["mail.message"]._search(
[("id", "in", [x for x in msg_ids if x])]
)
partner_ids = self.env["res.partner"]._search(
[("id", "in", [x for x in partner_ids if x])]
)
return [
x[0]
for x in msg_linked
if (x[1] in msg_ids) # We can read the linked message
or (
not any({x[1], x[2]}) and x[2] in partner_ids
) # No linked msg/mail but we can read the linked partner
or (not any({x[1], x[2], x[2]})) # No linked record
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment