From fee0f18049ed3a140bc178a6e2d055caf786261d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marques?= Date: Tue, 25 May 2021 09:04:26 +0100 Subject: [PATCH] [FIX] base_comment_template: Filter domain correctly 1. Safe eval domain before checking if it is defined. This makes [] be "False" on the first check, and provides the proper use case for when the domain is empty 2. Use filtered_domain in record instead of a search in self. When on a compute, we are on a NewId context, so the search would always fail TT29309 --- base_comment_template/models/comment_template.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/base_comment_template/models/comment_template.py b/base_comment_template/models/comment_template.py index 465e6ddc..9131cca1 100644 --- a/base_comment_template/models/comment_template.py +++ b/base_comment_template/models/comment_template.py @@ -39,7 +39,6 @@ class CommentTemplate(models.AbstractModel): ] ) for template in templates: - if not template.domain or self in self.search( - safe_eval(template.domain) - ): + domain = safe_eval(template.domain) + if not domain or record.filtered_domain(domain): record.comment_template_ids = [(4, template.id)]