diff --git a/account_credit_control/__manifest__.py b/account_credit_control/__manifest__.py index 3918fffa6..8e860489d 100644 --- a/account_credit_control/__manifest__.py +++ b/account_credit_control/__manifest__.py @@ -5,7 +5,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Account Credit Control", - "version": "18.0.2.0.0", + "version": "18.0.3.0.0", "author": "Camptocamp," "Odoo Community Association (OCA)," "Okia," diff --git a/account_credit_control/migrations/18.0.3.0.0/post-migration.py b/account_credit_control/migrations/18.0.3.0.0/post-migration.py new file mode 100644 index 000000000..403485652 --- /dev/null +++ b/account_credit_control/migrations/18.0.3.0.0/post-migration.py @@ -0,0 +1,31 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + cr = env.cr + if openupgrade.column_exists(cr, "credit_control_line", "channel"): + openupgrade.map_values( + cr, + "channel_old", + "channel_letter", + [("letter", "t")], + table="credit_control_line", + ) + openupgrade.map_values( + cr, + "channel_old", + "channel_email", + [("email", "t")], + table="credit_control_line", + ) + openupgrade.map_values( + cr, + "channel_old", + "channel_phone", + [("phone", "t")], + table="credit_control_line", + ) diff --git a/account_credit_control/migrations/18.0.3.0.0/pre-migration.py b/account_credit_control/migrations/18.0.3.0.0/pre-migration.py new file mode 100644 index 000000000..fe901e7c6 --- /dev/null +++ b/account_credit_control/migrations/18.0.3.0.0/pre-migration.py @@ -0,0 +1,19 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + # Preserve channel historic data from credit.control.line records + if openupgrade.column_exists(env.cr, "credit_control_line", "channel"): + openupgrade.copy_columns( + env.cr, + { + "credit_control_line": [ + ("channel", "channel_old", None), + ] + }, + )