""" 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:
template_external_ids = remaining.get_external_id()
for template in remaining:
if bool(template_external_ids[template.id]) and template.description:
template.template_category = 'base_template'
elif bool(template_external_ids[template.id]):
template.template_category = 'hidden_template'
else:
template.template_category = 'custom_template'
|