<commit_before># -*- coding: utf-8 -*-
#
# Copyright 2016 Taŭga Tecnologia - <NAME> <<EMAIL>>
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
#


from __future__ import division, print_function, unicode_literals

from odoo import api, fields, models


class IrUiView(models.Model):
    _inherit = 'ir.ui.view'

    localization_ids = fields.Many2many(
        'ir.localization',
        'ir_ui_view_localization',
        'view_id',
        'localization_id',
        string='Localizations',
    )

    #------------------------------------------------------
    # Inheritance mecanism
    #------------------------------------------------------
    @api.model
    def get_inheriting_views_arch(self, view_id, model):
        res = super(IrUiView, self).get_inheriting_views_arch(view_id, model)

        if len(res) == 0:
            #
            # There is no inherited views
            #
            return res

        localization_id = None
        if self.env.user.localization_id:
            localization_id = self.env.user.localization_id.id
        elif self.env.user.company_id and self.env.user.company_id.localization_id:
            localization_id = self.env.user.company_id.localization_id.id

        inherited_view_ids = [inherited_view_id for view_arch, inherited_view_id in res]

        if localization_id is None:
            condition = [
                ['id', 'in', inherited_view_ids],
                ['localization_ids', '=', False],
            ]
        else:
            condition = [
                ['id', 'in', inherited_view_ids],
                '|',
                ['localization_ids', '=', False],
                ['localization_ids', 'in', localization_id],
            ]

        if self.model == 'sped.participante':
            import ipdb; ipdb.set_trace();

        views = self.search(condition)

        if len(views) == len(inherited_view_ids):
            #
            # None of the selected inherited views have any localization limitation
            #
            return res

        if not views:
            return []<commit_msg>[FIX] Removendo ipdb<commit_after># -*- coding: utf-8 -*-
#
# Copyright 2016 Taŭga Tecnologia - <NAME> <<EMAIL>>
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
#


from __future__ import division, print_function, unicode_literals

from odoo import api, fields, models


class IrUiView(models.Model):
    _inherit = 'ir.ui.view'

    localization_ids = fields.Many2many(
        'ir.localization',
        'ir_ui_view_localization',
        'view_id',
        'localization_id',
        string='Localizations',
    )

    #------------------------------------------------------
    # Inheritance mecanism
    #------------------------------------------------------
    @api.model
    def get_inheriting_views_arch(self, view_id, model):
        res = super(IrUiView, self).get_inheriting_views_arch(view_id, model)

        if len(res) == 0:
            #
            # There is no inherited views
            #
            return res

        localization_id = None
        if self.env.user.localization_id:
            localization_id = self.env.user.localization_id.id
        elif self.env.user.company_id and self.env.user.company_id.localization_id:
            localization_id = self.env.user.company_id.localization_id.id

        inherited_view_ids = [inherited_view_id for view_arch, inherited_view_id in res]

        if localization_id is None:
            condition = [
                ['id', 'in', inherited_view_ids],
                ['localization_ids', '=', False],
            ]
        else:
            condition = [
                ['id', 'in', inherited_view_ids],
                '|',
                ['localization_ids', '=', False],
                ['localization_ids', 'in', localization_id],
            ]

        views = self.search(condition)

        if len(views) == len(inherited_view_ids):
            #
            # None of the selected inherited views have any localization limitation
            #
            return res

        if not views:
            return []
{'fraction_non_alphanumeric': 0.15164034021871203, 'fraction_numerical': 0.003888213851761847, 'mean_word_length': 1.6762028608582575, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2644884', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1143, 'n_words': 244}