|
|
template_model = self.env["base.comment.template"]
template_domain = template_model._search_model_ids("in", self._name)
for record in self:
partner = record[self._comment_template_partner_field_name]
record.comment_template_ids = [(5,)]
templates = template_model.search(
expression.AND(
[
[
"|",
("id", "in", partner.base_comment_template_ids.ids),
("global_template", "=", True),
],
template_domain,
]
)
)
for template in templates:
domain = safe_eval(template.domain)
if not domain or record.filtered_domain(domain):
record.comment_template_ids = [(4, template.id)]
|
|