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

Module: Discuss

Entity: mail.template

Compute Method: _compute_template_category

Inputs Method Outputs
""" Base templates (or master templates) are active templates having
        a description and an XML ID. User defined templates (no xml id),
        templates without description or archived templates are not
        base templates anymore. """
deactivated = self.filtered(lambda template: not template.active)
if deactivated:
            deactivated.template_category = 'hidden_template'
remaining = self - deactivated
if remaining:
            templates_with_xmlid = {
                id_
                for id_, xids in remaining._get_external_ids().items()
                if any(not xid.startswith('__export__.') for xid in xids)
            }
            for template in remaining:
                if template.id in templates_with_xmlid and template.description:
                    template.template_category = 'base_template'
                elif template.id in templates_with_xmlid:
                    template.template_category = 'hidden_template'
                else:
                    template.template_category = 'custom_template'

Back to entity