Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Base Comments Templates

Entity: comment.template

Compute Method: _compute_comment_template_ids

Inputs Method Outputs
  • domain
  • id
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 = [Command.link(template.id)]

Back to entity