diff --git a/openupgrade_scripts/scripts/purchase/18.0.1.2/post-migration.py b/openupgrade_scripts/scripts/purchase/18.0.1.2/post-migration.py new file mode 100644 index 000000000000..cf2195078a86 --- /dev/null +++ b/openupgrade_scripts/scripts/purchase/18.0.1.2/post-migration.py @@ -0,0 +1,28 @@ +# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade, openupgrade_180 + + +def convert_company_dependent(env): + openupgrade_180.convert_company_dependent( + env, "res.partner", "property_purchase_currency_id" + ) + openupgrade_180.convert_company_dependent( + env, "res.partner", "receipt_reminder_email" + ) + openupgrade_180.convert_company_dependent( + env, "res.partner", "reminder_date_before_receipt" + ) + + +@openupgrade.migrate() +def migrate(env, version): + convert_company_dependent(env) + openupgrade.load_data(env, "purchase", "18.0.1.2/noupdate_changes.xml") + openupgrade.delete_record_translations( + env.cr, "purchase", ["email_template_edi_purchase", "track_po_line_template"] + ) + openupgrade.delete_records_safely_by_xml_id( + env, + ["purchase.receipt_reminder_email", "purchase.reminder_date_before_receipt"], + ) diff --git a/openupgrade_scripts/scripts/purchase/18.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/purchase/18.0.1.2/pre-migration.py new file mode 100644 index 000000000000..08c68207e23e --- /dev/null +++ b/openupgrade_scripts/scripts/purchase/18.0.1.2/pre-migration.py @@ -0,0 +1,24 @@ +# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade + + +def fill_purchase_order_amount_total_cc(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE purchase_order + SET amount_total_cc = amount_total / currency_rate + WHERE COALESCE(currency_rate, 0) != 0""", + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.delete_sql_constraint_safely( + env, "purchase", "purchase_order_line", "accountable_required_fields" + ) + openupgrade.add_columns( + env, [("purchase.order", "amount_total_cc", "float", None, "purchase_order")] + ) + fill_purchase_order_amount_total_cc(env) diff --git a/openupgrade_scripts/scripts/purchase/18.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/purchase/18.0.1.2/upgrade_analysis_work.txt new file mode 100644 index 000000000000..a188bd739f88 --- /dev/null +++ b/openupgrade_scripts/scripts/purchase/18.0.1.2/upgrade_analysis_work.txt @@ -0,0 +1,51 @@ +---Models in module 'purchase'--- +new model bill.to.po.wizard [transient] +new model purchase.bill.line.match [sql_view] +# NOTHING TO DO + +---Fields in module 'purchase'--- +purchase / account.move.line / is_downpayment (boolean) : previously in module sale +# NOTHING TO DO + +purchase / purchase.order / amount_total_cc (float) : NEW isfunction: function, stored +# DONE: pre-migration: pre-create column and fill it (amount_total_cc = amount_total / currency_rate) + +purchase / purchase.order / mail_reception_declined (boolean): NEW +# NOTHING TO DO: new feature + +purchase / purchase.order.line / analytic_distribution_search (json): DEL stored: False +# NOTHING TO DO + +purchase / purchase.order.line / is_downpayment (boolean) : NEW +purchase / purchase.order.line / product_no_variant_attribute_value_ids (many2many): previously in module purchase_product_matrix +purchase / purchase.order.line / product_template_attribute_value_ids (many2many): previously in module purchase_product_matrix +# NOTHING TO DO + +purchase / res.partner / property_purchase_currency_id (many2one): needs conversion to v18-style company dependent +purchase / res.partner / receipt_reminder_email (boolean): needs conversion to v18-style company dependent +purchase / res.partner / reminder_date_before_receipt (integer): needs conversion to v18-style company dependent +# DONE: post-migration: used openupgrade_180.convert_company_dependent + +---XML records in module 'purchase'--- +NEW ir.actions.server: purchase.action_confirm_rfqs +NEW ir.actions.server: purchase.action_merger +NEW ir.model.access: purchase.access_bill_to_po_wizard +NEW ir.model.access: purchase.access_purchase_bill_line_match +NEW ir.model.access: purchase.access_purchase_bill_line_match_invoicing_payments +NEW ir.model.access: purchase.access_purchase_bill_line_match_readonly +# NOTHING TO DO + +ir.model.constraint: purchase.constraint_purchase_order_line_accountable_required_fields (changed definition: is now 'check(display_type is not null or is_downpayment or(product_id is not null and product_uom is not null and date_planned is not null))' ('check(display_type is not null or(product_id is not null and product_uom is not null and date_planned is not null))')) +# DONE: pre-migration: delete it (to safely force the change) + +DEL ir.property: purchase.receipt_reminder_email (noupdate) +DEL ir.property: purchase.reminder_date_before_receipt (noupdate) +# DONE: post-migration: delete old property safely (now it's an ir.default record created by ORM) + +NEW ir.ui.view: purchase.bill_to_po_wizard_form +NEW ir.ui.view: purchase.product_product_supplierinfo_tree_view2 +NEW ir.ui.view: purchase.purchase_bill_line_match_tree +NEW ir.ui.view: purchase.purchase_history_graph +NEW ir.ui.view: purchase.purchase_history_pivot +DEL ir.ui.view: purchase.view_product_account_purchase_ok_form +NEW web_tour.tour: purchase.purchase_tour