<commit_before># Copyright 2021 Tecnativa - <NAME>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade
from psycopg2 import sql


def migrate_l10n_es_aeat_sii(env):
    """Migrate l10n.es.aeat.sii to l10n.es.aeat.certificate"""
    openupgrade.logged_query(
        env.cr,
        sql.SQL(
            """
        INSERT INTO l10n_es_aeat_certificate
        (name, state, file, date_start, date_end,
         public_key, private_key, company_id)
        SELECT
        name, state, file, date_start, date_end,
        public_key, private_key, company_id
        FROM l10n_es_aeat_sii
        """
        ),
    )


@openupgrade.migrate()
def migrate(env, version):
    if openupgrade.table_exists(env.cr, "l10n_es_aeat_sii"):
        migrate_l10n_es_aeat_sii(env)<commit_msg>[OU-FIX] l10n_es_aeat_sii_oca: `folder` field required<commit_after># Copyright 2021 Tecnativa - <NAME>
# Copyright 2021 Tecnativa - <NAME>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade
from psycopg2 import sql


def migrate_l10n_es_aeat_sii(env):
    """Migrate l10n.es.aeat.sii to l10n.es.aeat.certificate"""
    openupgrade.logged_query(
        env.cr,
        sql.SQL(
            """
        INSERT INTO l10n_es_aeat_certificate
        (name, state, file, date_start, date_end, folder,
         public_key, private_key, company_id)
        SELECT
        name, state, file, date_start, date_end, 'OU',
        public_key, private_key, company_id
        FROM l10n_es_aeat_sii
        """
        ),
    )


@openupgrade.migrate()
def migrate(env, version):
    if openupgrade.table_exists(env.cr, "l10n_es_aeat_sii"):
        migrate_l10n_es_aeat_sii(env)
{'fraction_non_alphanumeric': 0.1046048891415577, 'fraction_numerical': 0.027288231949971573, 'mean_word_length': 2.955056179775281, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '5009152', 'n_tokens_mistral': 700, 'n_tokens_neox': 650, 'n_words': 123}