<commit_before># -*- coding: utf-8 -*-
import logging

from odoo import models, fields

_logger = logging.getLogger(__name__)


class WebsiteTheme(models.Model):
    _inherit = 'website.theme'

    name = fields.Char(string="Theme")
    converted_theme_addon = fields.Char(
        string="Theme's technical name",
        help="")

    dependency_ids = fields.Many2many(
        'ir.module.module',
        string="Dependencies",
        help='Theme-like dependencies. Add modules here if you got error "The style compilation failed".')

    def _convert_assets(self):
        """Generate assets for converted themes"""
        Asset = self.env["website.theme.asset"]
        for one in self.filtered("converted_theme_addon"):
            # Get all views owned by the converted theme addon
            refs = self.env["ir.model.data"].search([
                ("module", "in", [one.converted_theme_addon] + one.dependency_ids.mapped('name')),
                ("model", "=", "ir.ui.view"),
            ])
            existing = frozenset(one.mapped("asset_ids.name"))
            expected = frozenset(refs.mapped("complete_name"))
            dangling = tuple(existing - expected)
            # Create a new asset for each theme view
            for ref in expected - existing:
                _logger.debug("Creating asset %s for theme %s", ref, one.name)

                view = self.env.ref(ref, raise_if_not_found=False)
                if view and view.type != 'qweb':
                    # skip backend views
                    continue

                one.asset_ids |= Asset.new({
                    "name": ref,<commit_msg>[FIX] skip handling non-theme or non extenstion templates<commit_after># -*- coding: utf-8 -*-
import logging

from odoo import models, fields

_logger = logging.getLogger(__name__)


class WebsiteTheme(models.Model):
    _inherit = 'website.theme'

    name = fields.Char(string="Theme")
    converted_theme_addon = fields.Char(
        string="Theme's technical name",
        help="")

    dependency_ids = fields.Many2many(
        'ir.module.module',
        string="Dependencies",
        help='Theme-like dependencies. Add modules here if you got error "The style compilation failed".')

    def _convert_assets(self):
        """Generate assets for converted themes"""
        Asset = self.env["website.theme.asset"]
        for one in self.filtered("converted_theme_addon"):
            # Get all views owned by the converted theme addon
            refs = self.env["ir.model.data"].search([
                ("module", "in", [one.converted_theme_addon] + one.dependency_ids.mapped('name')),
                ("model", "=", "ir.ui.view"),
            ])
            existing = frozenset(one.mapped("asset_ids.name"))
            expected = frozenset(refs.mapped("complete_name"))
            dangling = tuple(existing - expected)
            # Create a new asset for each theme view
            for ref in expected - existing:
                view = self.env.ref(ref, raise_if_not_found=False)
                if view and (view.type != 'qweb' or not view.inherit_id):
                    # Skip non-qweb (backend) views

                    # Skip views without inherit_id, because those have new
                    # template definition only and after appliying multi-theme
                    # for several websites it will be copied and then it leads
                    # to error on compilation when any template with <t
                    # t-call="..."/> -- expected singleton
                    continue

                _logger.debug("Creating asset %s for theme %s", ref, one.name)

                one.asset_ids |= Asset.new({
                    "name": ref,
{'fraction_non_alphanumeric': 0.11147011308562198, 'fraction_numerical': 0.0010770059235325794, 'mean_word_length': 2.0601317957166394, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2550089', 'n_tokens_mistral': 1020, 'n_tokens_neox': 963, 'n_words': 278}