<commit_before># Copyright 2021 <NAME>/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, SUPERUSER_ID
from openupgradelib import openupgrade


def _rename_cagnotte(env):
    columns = {
        "sale_order_line": [
            ("account_cagnotte_id", "account_wallet_id"),
        ],
    }
    openupgrade.rename_columns(env.cr, columns)


def pre_init_hook(cr):
    with api.Environment.manage():
        env = api.Environment(cr, SUPERUSER_ID, {})
        _rename_cagnotte(env)<commit_msg>[14.0][IMP] account_wallet_sale: Migrate only if former column exist<commit_after># Copyright 2021 <NAME>/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, SUPERUSER_ID
from openupgradelib import openupgrade


def _rename_cagnotte(env):
    if not openupgrade.column_exists(
            env.cr, "sale_order_line", "account_cagnotte_id"):
        return
    columns = {
        "sale_order_line": [
            ("account_cagnotte_id", "account_wallet_id"),
        ],
    }
    openupgrade.rename_columns(env.cr, columns)


def pre_init_hook(cr):
    with api.Environment.manage():
        env = api.Environment(cr, SUPERUSER_ID, {})
        _rename_cagnotte(env)
{'fraction_non_alphanumeric': 0.11779041429731925, 'fraction_numerical': 0.012185215272136474, 'mean_word_length': 3.368794326241135, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '3074004', 'n_tokens_mistral': 446, 'n_tokens_neox': 426, 'n_words': 81}