<commit_before># -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests import common


class TestBiViewEditor(common.TransactionCase):

    def setUp(self):
        super(TestBiViewEditor, self).setUp()
        self.partner_model_name = 'res.partner'
        self.partner_field_name = 'name'
        self.partner_company_field_name = 'company_id'
        self.company_model_name = 'res.company'
        self.company_field_name = 'name'

        self.bi_view1 = None

        Model = self.env['ir.model']
        ModelFields = self.env['ir.model.fields']

        self.partner_model = Model.search([
            ('model', '=', self.partner_model_name)
        ], limit=1)

        self.company_model = Model.search([
            ('model', '=', self.company_model_name)
        ], limit=1)

        self.partner_field = ModelFields.search([
            ('model', '=', self.partner_model_name),
            ('name', '=', self.partner_field_name)
        ], limit=1)

        self.partner_company_field = ModelFields.search([<commit_msg>Code refactoring of module 'bi_view_editor';<commit_after># -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests import common


class TestBiViewEditor(common.TransactionCase):

    def setUp(self):

        def _get_models(model_name_list):
            Model = self.env['ir.model']
            return (Model.search([('model', '=', name)]) for name in model_name_list)

        super(TestBiViewEditor, self).setUp()
        self.partner_model_name = 'res.partner'
        self.partner_field_name = 'name'
        self.partner_company_field_name = 'company_id'
        self.company_model_name = 'res.company'
        self.company_field_name = 'name'

        self.bi_view1 = None

        Model = self.env['ir.model']
        ModelFields = self.env['ir.model.fields']

        self.partner_model, self.company_model = _get_models(
            [self.partner_model_name, self.company_model_name])

        '''
        self.partner_model = Model.search([
            ('model', '=', self.partner_model_name)
        ], limit=1)

        self.company_model = Model.search([
            ('model', '=', self.company_model_name)
        ], limit=1)
        '''
        self.partner_field = ModelFields.search([
            ('model', '=', self.partner_model_name),
            ('name', '=', self.partner_field_name)
        ], limit=1)

        self.partner_company_field = ModelFields.search([
{'fraction_non_alphanumeric': 0.1405775075987842, 'fraction_numerical': 0.008358662613981762, 'mean_word_length': 2.582312925170068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1769023', 'n_tokens_mistral': 865, 'n_tokens_neox': 836, 'n_words': 133}