diff --git a/.github/workflows/documentation-commit.yml b/.github/workflows/documentation-commit.yml index e8539577ce6b..d09f8178a470 100644 --- a/.github/workflows/documentation-commit.yml +++ b/.github/workflows/documentation-commit.yml @@ -60,7 +60,7 @@ jobs: # try to build the documentation sh ./build_openupgrade_docs - name: Commit changes - uses: EndBug/add-and-commit@v9 + uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 #v9 with: add: "docs" default_author: github_actions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8911142dd8c..a032e3ca565c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,21 +25,22 @@ jobs: PGPASSWORD: "odoo" PGUSER: "odoo" OPENUPGRADE_USE_DEMO: "yes" + services: + postgres: + image: postgres:14.0 + env: + POSTGRES_USER: odoo + POSTGRES_PASSWORD: odoo + POSTGRES_DB: odoo + ports: + - 5432:5432 steps: - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - - name: Configure Postgres - uses: harmon758/postgresql-action@v1 - with: - postgresql version: "14" - postgresql user: ${DB_USERNAME} - postgresql password: ${DB_PASSWORD} - - name: Wait / Sleep - uses: jakejarvis/wait-action@v0.1.0 - with: - time: "10s" + - name: Sleep for 10 seconds + run: sleep 10s - name: DB Creation run: createdb $DB - name: DB Restore @@ -96,6 +97,12 @@ jobs: for snippet in openupgrade/openupgrade_scripts/scripts/*/*/tests/data*.py; do odoo-old/odoo-bin shell -d $DB < $snippet done + - name: Test end-migration script for newly installed module (i.e. "spreadsheet" for v16) + run: | + END_SCRIPT_TEST=openupgrade/openupgrade_scripts/scripts/base/16.0.1.3/tests/end-migration_test.py + NEW_MODULE_SCRIPT_DIR=openupgrade/openupgrade_scripts/scripts/spreadsheet/16.0.1.0/ + mkdir -p $NEW_MODULE_SCRIPT_DIR + cp $END_SCRIPT_TEST $NEW_MODULE_SCRIPT_DIR - name: OpenUpgrade test run: | # select modules and perform the upgrade diff --git a/README.md b/README.md index 67eb848e571b..09dcdca07c5a 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- -[openupgrade_framework](openupgrade_framework/) | 16.0.1.0.0 | [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) [![StefanRijnhart](https://github.com/StefanRijnhart.png?size=30px)](https://github.com/StefanRijnhart) [![hbrunn](https://github.com/hbrunn.png?size=30px)](https://github.com/hbrunn) | Module to integrate in the server_wide_modules option to make upgrades between two major revisions. -[openupgrade_scripts](openupgrade_scripts/) | 16.0.1.0.4 | | Module that contains all the migrations analysis and scripts for migrating Odoo SA modules. +[openupgrade_framework](openupgrade_framework/) | 16.0.1.0.1 | legalsylvain StefanRijnhart hbrunn | Module to integrate in the server_wide_modules option to make upgrades between two major revisions. +[openupgrade_scripts](openupgrade_scripts/) | 16.0.1.0.5 | | Module that contains all the migrations analysis and scripts for migrating Odoo SA modules. [//]: # (end addons) diff --git a/docsource/modules150-160.rst b/docsource/modules150-160.rst index 62c0d70c66fa..99ee21b79cb6 100644 --- a/docsource/modules150-160.rst +++ b/docsource/modules150-160.rst @@ -8,7 +8,7 @@ Module coverage 15.0 -> 16.0 +=================================================+======================+=================================================+ | account |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| account_check_printing | |No DB layout changes. | +| account_check_printing | Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ | account_debit_note |Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -76,7 +76,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | |del| base_address_city | |Merged into base_address_extended. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| base_address_extended |Nothing to do | | +| base_address_extended | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | base_automation |Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -274,7 +274,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | l10n_cz | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| l10n_de | | | +| l10n_de | Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | |del| l10n_de_purchase | |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -284,7 +284,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | l10n_de_skr03 | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| l10n_de_skr04 | | | +| l10n_de_skr04 | Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | |del| l10n_de_stock | |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -554,17 +554,17 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | mass_mailing_sale_sms | |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| mass_mailing_slides |Nothing to do | | +| mass_mailing_slides | Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | mass_mailing_sms | Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| |new| mass_mailing_themes | | | +| |new| mass_mailing_themes | Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | membership | Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| microsoft_account | |No DB layout changes. | +| microsoft_account | Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| microsoft_calendar | |No DB layout changes. | +| microsoft_calendar | Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ | microsoft_outlook | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -748,7 +748,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | repair | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| resource |Nothing to do | | +| resource | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | sale |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -790,7 +790,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | sale_purchase_stock |Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| sale_quotation_builder |Done | | +| sale_quotation_builder | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | sale_sms | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -846,7 +846,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | stock |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| stock_account |Nothing to do | | +| stock_account | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | stock_dropshipping | Nothing to do |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -990,7 +990,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | website_sale_product_configurator |Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| website_sale_slides |Done | | +| website_sale_slides | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | website_sale_stock |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ @@ -1002,9 +1002,9 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | website_slides |Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| website_slides_forum |Nothing to do | | +| website_slides_forum | Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| website_slides_survey |Done | | +| website_slides_survey | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | website_sms | Nothing to do | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_framework/README.rst b/openupgrade_framework/README.rst index 0f7a338d304c..5b2787a2bc64 100644 --- a/openupgrade_framework/README.rst +++ b/openupgrade_framework/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ===================== Openupgrade Framework ===================== @@ -7,13 +11,13 @@ Openupgrade Framework !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:5b5aa97d1e9d7df96e3076992e0c0b2a86d4712d4ecc2dc56bf863600ac0684f + !! source digest: sha256:945275c27187090272d2b06ad20e5f5e1447983d05ac4a7d08e38f9b4aa0468f !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2FOpenUpgrade-lightgray.png?logo=github diff --git a/openupgrade_framework/__manifest__.py b/openupgrade_framework/__manifest__.py index 550b052db116..9b160416253f 100644 --- a/openupgrade_framework/__manifest__.py +++ b/openupgrade_framework/__manifest__.py @@ -9,7 +9,7 @@ "maintainers": ["legalsylvain", "StefanRijnhart", "hbrunn"], "website": "https://github.com/OCA/OpenUpgrade", "category": "Migration", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "license": "AGPL-3", "depends": ["base"], "images": ["static/description/banner.jpg"], diff --git a/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py b/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py index 4860c1d25645..3decbfbdc83e 100644 --- a/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py +++ b/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py @@ -86,3 +86,26 @@ def _raise_view_error( NameManager.check = check _raise_view_error._original_method = View._raise_view_error View._raise_view_error = _raise_view_error + + +def unlink(self): + """Remove the archived children of a view deleted with its module too. + + The cascade of the core (under the module uninstall flag, which the end of + an update sets) goes through inherit_children_ids, which leaves out the + archived views (e.g. an option of the website editor turned off): their + foreign key then keeps the parent from being deleted, and the log shows + 'violates foreign key constraint ir_ui_view_inherit_id_fkey'. + """ + if self.env.context.get("_force_unlink"): + archived = ( + self.with_context(active_test=False).inherit_children_ids + - self.inherit_children_ids + ) + if archived: + archived.unlink() + return unlink._original_method(self) + + +unlink._original_method = View.unlink +View.unlink = unlink diff --git a/openupgrade_framework/odoo_patch/odoo/models.py b/openupgrade_framework/odoo_patch/odoo/models.py index 1f008ec4667d..378e283ddb1e 100644 --- a/openupgrade_framework/odoo_patch/odoo/models.py +++ b/openupgrade_framework/odoo_patch/odoo/models.py @@ -21,16 +21,26 @@ def unlink(self): """ if not self.env.context.get(MODULE_UNINSTALL_FLAG): return BaseModel.unlink._original_method(self) - savepoint = str(uuid4) + savepoint = str(uuid4()) try: self.env.cr.execute( # pylint: disable=sql-injection 'SAVEPOINT "%s"' % savepoint ) - return BaseModel.unlink._original_method(self) + result = BaseModel.unlink._original_method(self) + # release it: a savepoint left open per deleted record keeps a + # transactionid lock until the end of the update, enough to exhaust + # the lock table of the cluster on a large update + self.env.cr.execute( # pylint: disable=sql-injection + 'RELEASE SAVEPOINT "%s"' % savepoint + ) + return result except Exception as e: self.env.cr.execute( # pylint: disable=sql-injection 'ROLLBACK TO SAVEPOINT "%s"' % savepoint ) + self.env.cr.execute( # pylint: disable=sql-injection + 'RELEASE SAVEPOINT "%s"' % savepoint + ) _logger.warning( "Could not delete obsolete record with ids %s of model %s: %s", self.ids, diff --git a/openupgrade_framework/odoo_patch/odoo/modules/migration.py b/openupgrade_framework/odoo_patch/odoo/modules/migration.py index 675f22e7dc24..6a815143b1e0 100644 --- a/openupgrade_framework/odoo_patch/odoo/modules/migration.py +++ b/openupgrade_framework/odoo_patch/odoo/modules/migration.py @@ -21,6 +21,11 @@ def migrate_module(self, pkg, stage): module_scripts = {} if to_install: pkg.state = "to upgrade" + # end scripts: the state Odoo looks at is the one the module was loaded with + load_state_to_install = getattr(pkg, "load_state", False) + if load_state_to_install == "to install": + pkg.load_state = "to upgrade" + if to_install or load_state_to_install == "to install": for key in ("module", "module_upgrades"): if key in self.migrations[pkg.name]: module_scripts[key] = self.migrations[pkg.name][key] @@ -32,6 +37,9 @@ def migrate_module(self, pkg, stage): finally: if to_install: pkg.state = "to install" + if load_state_to_install == "to install": + pkg.load_state = "to install" + if module_scripts: self.migrations[pkg.name].update(module_scripts) diff --git a/openupgrade_framework/static/description/index.html b/openupgrade_framework/static/description/index.html index bbaf2d261e66..bff009a5d0cb 100644 --- a/openupgrade_framework/static/description/index.html +++ b/openupgrade_framework/static/description/index.html @@ -3,7 +3,7 @@ -Openupgrade Framework +README.rst -
-

Openupgrade Framework

+
+ + +Odoo Community Association + +
+

Openupgrade Framework

-

Beta License: AGPL-3 OCA/OpenUpgrade Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/OpenUpgrade Translate me on Weblate Try me on Runboat

This module is a technical module that contains a number of monkeypatches to improve the behaviour of Odoo when migrating your database using the OpenUpgrade migration scripts:

@@ -417,12 +422,12 @@

Openupgrade Framework

-

Installation

+

Installation

This module does not need to be installed on a database. It simply needs to be available via your addons-path.

-

Configuration

+

Configuration

  • call your odoo instance with the option --load=base,web,openupgrade_framework
  • @@ -441,7 +446,7 @@

    Configuration

    of the OpenUpgrade migration scripts.

-

Development

+

Development

The odoo_patch folder contains python files in a tree that mimicks the folder tree of the Odoo project. It contains a number of monkey patches to improve the migration of an Odoo database between two major versions.

@@ -485,7 +490,7 @@

Development

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -493,9 +498,9 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Therp BV
  • Opener B.V.
  • @@ -504,21 +509,21 @@

    Authors

-

Other credits

+

Other credits

Many developers have contributed to the OpenUpgrade framework in its previous incarnation. Their original contributions may no longer needed, or they are no longer recognizable in their current form but OpenUpgrade would not have existed at this point without them.

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -533,5 +538,6 @@

Maintainers

+
diff --git a/openupgrade_scripts/README.rst b/openupgrade_scripts/README.rst index a286bb88311b..d42874bc9689 100644 --- a/openupgrade_scripts/README.rst +++ b/openupgrade_scripts/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + =================== Openupgrade Scripts =================== @@ -7,13 +11,13 @@ Openupgrade Scripts !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:58792095dc539f1f4eccbc45de3679c28e3176d8bf3682b315d670e6f3877639 + !! source digest: sha256:3d4eb565304d229b449be4d0734a5f9693ed41801b58114c63461c04fea3c5b3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2FOpenUpgrade-lightgray.png?logo=github diff --git a/openupgrade_scripts/__manifest__.py b/openupgrade_scripts/__manifest__.py index 7f0fe75557c8..822daad63a5d 100644 --- a/openupgrade_scripts/__manifest__.py +++ b/openupgrade_scripts/__manifest__.py @@ -7,7 +7,7 @@ "author": "Odoo Community Association (OCA)", "website": "https://github.com/OCA/OpenUpgrade", "category": "Migration", - "version": "16.0.1.0.4", + "version": "16.0.1.0.5", "license": "AGPL-3", "depends": ["base"], "images": ["static/description/banner.jpg"], diff --git a/openupgrade_scripts/apriori.py b/openupgrade_scripts/apriori.py index 9049d9a66d1f..0be6ecd37985 100644 --- a/openupgrade_scripts/apriori.py +++ b/openupgrade_scripts/apriori.py @@ -34,6 +34,11 @@ "knowledge": "document_knowledge", # OCA/multi-company "res_partner_category_multi_company": "partner_category_multi_company", + # OCA/pos + "pos_cashback_warning": "pos_cashback", + "pos_sale_order_load": "pos_picking_load", + # OCA/product-attribute + "product_packaging_type": "product_packaging_level", # OCA/project "project_stage_mgmt": "project_task_stage_mgmt", # OCA/sale-promotion @@ -51,12 +56,14 @@ "sale_coupon_partner": "sale_loyalty_partner", "website_sale_coupon_page": "website_sale_loyalty_page", "website_sale_coupon_selection_wizard": "website_sale_loyalty_suggestion_wizard", + # OCA/sale-workflow + "sale_by_packaging": "sell_only_by_packaging", # OCA/server-ux "mass_editing": "server_action_mass_edit", # OCA/l10n-italy "assets_management": "l10n_it_asset_management", "l10n_it_account_balance_eu": "l10n_it_financial_statement_eu", - "l10n_it_ricevute_bancarie": "l10n_it_riba", + "l10n_it_ricevute_bancarie": "l10n_it_riba_oca", # OCA/... # Viindoo/tvtmaaddons "to_affiliate": "viin_affiliate", @@ -122,6 +129,8 @@ "account_invoice_search_by_reference": "account", # OCA/account-invoice-reporting "account_invoice_report_due_list": "account", + # OCA/account-reconcile + "account_bank_statement_reopen_skip_undo_reconciliation": "account_statement_base", # OCA/e-commerce "website_sale_require_login": "website_sale", # OCA/l10n-spain @@ -141,6 +150,8 @@ "product_form_purchase_link": "purchase", "purchase_order_line_price_history": "purchase", "purchase_picking_state": "purchase_stock", + # OCA/queue + "queue_job_context": "queue_job", # OCA/sale-promotion "coupon_commercial_partner_applicability": "loyalty_partner_applicability", "sale_coupon_selection_wizard": "sale_loyalty_order_suggestion", @@ -151,6 +162,8 @@ "mail_preview_base": "mail", # OCA/stock-logistics-workflow "stock_picking_backorder_strategy": "stock", + # OCA/survey + "survey_placeholder": "survey", # OCA/web "web_drop_target": "web", "web_ir_actions_act_view_reload": "web", @@ -250,7 +263,7 @@ "coupon.rule": "loyalty.rule", "mail.channel.partner": "mail.channel.member", "payment.acquirer": "payment.provider", - "payment.acquirer.onboarding.wizard ": "payment.provider.onboarding.wizard", + "payment.acquirer.onboarding.wizard": "payment.provider.onboarding.wizard", "sale.coupon.apply.code": "sale.loyalty.coupon.wizard", "sale.payment.acquirer.onboarding.wizard": "sale.payment.provider.onboarding.wizard", "stock.location.route": "stock.route", @@ -277,3 +290,12 @@ # Viindoo/enterprise # Viindoo/odoo-tvtma } + +# Modules of merged_modules that are not merged into anything: they are +# removed without a successor on our addons paths. The technical records they +# own (record rules, scheduled and server actions, views, menus, mail +# templates...) are deleted by the update even when they are noupdate, and the +# xml ids of records of models that go with them are detached: see +# release_records_of_lost_modules in the pre-migration of base. +lost_modules = [ +] diff --git a/openupgrade_scripts/scripts/account/16.0.1.2/post-migration.py b/openupgrade_scripts/scripts/account/16.0.1.2/post-migration.py index fc87a33278ed..4a079a13ce70 100644 --- a/openupgrade_scripts/scripts/account/16.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/account/16.0.1.2/post-migration.py @@ -32,6 +32,23 @@ _modules_to_install = ["account_sequence", "account_payment"] +def _fill_account_bank_statement_attachment_ids(env): + """The chatter attachments of the bank statements are now linked through + the new `attachment_ids` many2many field, so we fill it with the existing ones. + """ + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_bank_statement_ir_attachment_rel + (account_bank_statement_id, ir_attachment_id) + SELECT ia.res_id, ia.id + FROM account_bank_statement abs + JOIN ir_attachment ia ON abs.id = ia.res_id + WHERE ia.res_model = 'account.bank.statement' + """, + ) + + def _compute_remaining_account_payment_amount_company_currency_signed(env): """Those payment with different currency than the company ones are not easily computed by SQL, so we use ORM for these cases, but they should luckily be few. @@ -59,6 +76,7 @@ def migrate(env, version): """, (tuple(_modules_to_install),), ) + _fill_account_bank_statement_attachment_ids(env) _compute_remaining_account_payment_amount_company_currency_signed(env) # credit_limit converted to company dependent old_column = openupgrade.get_legacy_name("credit_limit") diff --git a/openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py index e86a1708c835..bc8a8ed87621 100644 --- a/openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py +++ b/openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py @@ -271,28 +271,29 @@ def _account_move_fast_fill_display_type(env): openupgrade.logged_query( env.cr, """ - WITH sub AS ( - SELECT - aml.id, - CASE - WHEN am.move_type NOT IN - ('out_invoice', 'out_refund', 'in_invoice', - 'in_refund', 'in_receipt', 'out_receipt') - THEN 'product' - WHEN aml.tax_line_id IS NOT NULL THEN 'tax' - WHEN aa.account_type IN - ('asset_receivable', 'liability_payable') THEN 'payment_term' - ELSE 'product' - END AS display_type - FROM account_move_line AS aml - LEFT JOIN account_move AS am ON am.id = aml.move_id - LEFT JOIN account_account AS aa ON aa.id = aml.account_id - WHERE aml.display_type IS NULL AND am.id = aml.move_id - ) - UPDATE account_move_line AS aml - SET display_type = sub.display_type - FROM sub - WHERE aml.id = sub.id; + UPDATE + account_move_line AS aml2 + SET + display_type = COALESCE(( + SELECT + CASE WHEN am.move_type NOT IN ( + 'out_invoice', 'out_refund', 'in_invoice', 'in_refund', + 'in_receipt', 'out_receipt') THEN + 'product' + WHEN aml.tax_line_id IS NOT NULL THEN + 'tax' + WHEN aa.account_type IN ('asset_receivable', 'liability_payable') THEN + 'payment_term' + ELSE + 'product' + END AS display_type + FROM account_move_line AS aml + INNER JOIN account_move AS am ON am.id = aml.move_id + INNER JOIN account_account AS aa ON aa.id = aml.account_id + WHERE + aml.id = aml2.id), 'product') + WHERE + aml2.display_type IS NULL; """, ) # Extra actions: set quantity = 0 for lines of type tax or payment_term according diff --git a/openupgrade_scripts/scripts/account/16.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/account/16.0.1.2/upgrade_analysis_work.txt index 158d8c7a1bfd..e930b2bda5f0 100644 --- a/openupgrade_scripts/scripts/account/16.0.1.2/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/account/16.0.1.2/upgrade_analysis_work.txt @@ -91,9 +91,11 @@ account / account.analytic.line / partner_id (False) : previo # NOTHING TO DO account / account.bank.statement / _order : _order is now 'first_line_index desc' ('date desc, name desc, id desc') -account / account.bank.statement / attachment_ids (many2many) : NEW relation: ir.attachment # NOTHING TO DO +account / account.bank.statement / attachment_ids (many2many) : NEW relation: ir.attachment +# DONE: post-migration: fill this field with the existing chatter attachments + account / account.bank.statement / cashbox_end_id (many2one) : DEL relation: account.bank.statement.cashbox account / account.bank.statement / cashbox_start_id (many2one) : DEL relation: account.bank.statement.cashbox account / account.bank.statement / date (date) : now a function diff --git a/openupgrade_scripts/scripts/account_check_printing/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/account_check_printing/16.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..fee818c6f894 --- /dev/null +++ b/openupgrade_scripts/scripts/account_check_printing/16.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,5 @@ +---Models in module 'account_check_printing'--- +---Fields in module 'account_check_printing'--- +---XML records in module 'account_check_printing'--- +---nothing has changed in this module-- +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py b/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py index 6fddc4c5d4f0..447545088d6b 100644 --- a/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py +++ b/openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py @@ -170,6 +170,64 @@ def update_translatable_fields(cr): ) +_TECHNICAL_MODELS = ( + "ir.actions.act_url", + "ir.actions.act_window", + "ir.actions.client", + "ir.actions.report", + "ir.actions.server", + "ir.actions.todo", + "ir.cron", + "ir.filters", + "ir.model.access", + "ir.property", + "ir.rule", + "ir.ui.menu", + "ir.ui.view", + "mail.template", + "website.menu", +) + + +def release_records_of_lost_modules(cr): + """A module that is removed without a successor is merged into the module + it extended (apriori.lost_modules), and the update of that module deletes + the records it no longer finds in the data files, except the noupdate + ones: release the technical records, so that they are deleted too, and + detach the xml ids of the records of models that go with the module (the + rows stay). Business records stay. + """ + from odoo.addons.openupgrade_scripts import apriori as _apriori + + lost_modules = tuple(getattr(_apriori, "lost_modules", [])) + if not lost_modules: + return + openupgrade.logged_query( + cr, + """ + UPDATE ir_model_data SET noupdate = FALSE + WHERE noupdate AND module IN %s AND model IN %s + """, + (lost_modules, _TECHNICAL_MODELS), + ) + openupgrade.logged_query( + cr, + """ + DELETE FROM ir_model_data d + WHERE d.module IN %s AND d.model IN ( + SELECT m.model + FROM ir_model m + JOIN ir_model_data md ON md.model = 'ir.model' + AND md.res_id = m.id AND md.module IN %s + WHERE NOT EXISTS ( + SELECT 1 FROM ir_model_data o + WHERE o.model = 'ir.model' AND o.res_id = m.id + AND o.module NOT IN %s)) + """, + (lost_modules,) * 3, + ) + + @openupgrade.migrate(use_env=False) def migrate(cr, version): """ @@ -185,8 +243,13 @@ def migrate(cr, version): ) login_or_registration_required_at_checkout(cr) enable_coupon_sharing_within_entity(cr) - openupgrade.update_module_names(cr, renamed_modules.items()) - openupgrade.update_module_names(cr, merged_modules.items(), merge_modules=True) + release_records_of_lost_modules(cr) + openupgrade.update_module_names( + cr, renamed_modules.items(), environment_namespec=True + ) + openupgrade.update_module_names( + cr, merged_modules.items(), merge_modules=True, environment_namespec=True + ) openupgrade.clean_transient_models(cr) # restricting inherited views to groups isn't allowed anymore cr.execute( @@ -194,6 +257,10 @@ def migrate(cr, version): "USING ir_ui_view v " "WHERE r.view_id=v.id AND v.inherit_id IS NOT NULL AND v.mode != 'primary'" ) + # pre-create res.partner~company_registry + openupgrade.logged_query( + cr, "ALTER TABLE res_partner ADD IF NOT EXISTS company_registry VARCHAR" + ) # Renamed model in ir_translation changed_models = dict(**apriori.renamed_models, **apriori.merged_models) for old_model, new_model in changed_models.items(): diff --git a/openupgrade_scripts/scripts/base/16.0.1.3/tests/__init__.py b/openupgrade_scripts/scripts/base/16.0.1.3/tests/__init__.py index 8e84cc263319..aa4adee7d02e 100644 --- a/openupgrade_scripts/scripts/base/16.0.1.3/tests/__init__.py +++ b/openupgrade_scripts/scripts/base/16.0.1.3/tests/__init__.py @@ -1 +1,2 @@ from . import test_base_migration +from . import test_newly_installed_end_migration diff --git a/openupgrade_scripts/scripts/base/16.0.1.3/tests/end-migration_test.py b/openupgrade_scripts/scripts/base/16.0.1.3/tests/end-migration_test.py new file mode 100644 index 000000000000..d28d5562205b --- /dev/null +++ b/openupgrade_scripts/scripts/base/16.0.1.3/tests/end-migration_test.py @@ -0,0 +1,14 @@ +# Copyright 2023 Odoo Community Association (OCA) +# Copyright 2023 Guillaume Masson +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging + +from openupgradelib import openupgrade + +_logger = logging.getLogger(__name__) + + +@openupgrade.migrate(no_version=True) +def migrate(env, version): + params = env["ir.config_parameter"].sudo() + params.set_param("openupgrade.test_end_migration", "Executed") diff --git a/openupgrade_scripts/scripts/base/16.0.1.3/tests/test_newly_installed_end_migration.py b/openupgrade_scripts/scripts/base/16.0.1.3/tests/test_newly_installed_end_migration.py new file mode 100644 index 000000000000..4e722769eb73 --- /dev/null +++ b/openupgrade_scripts/scripts/base/16.0.1.3/tests/test_newly_installed_end_migration.py @@ -0,0 +1,10 @@ +from odoo.tests import TransactionCase, tagged + + +@tagged("-at_install", "post_install") +class TestNewlyInstalledEndMigration(TransactionCase): + def test_newly_installed_end_migration(self): + """Make sure the code of the end-migration script has been executed""" + params = self.env["ir.config_parameter"].sudo() + res = params.get_param("openupgrade.test_end_migration", default="Not executed") + self.assertEqual(res, "Executed") diff --git a/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis_work.txt index 20b1b9d6fb79..19f8a77bc847 100644 --- a/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/base/16.0.1.3/upgrade_analysis_work.txt @@ -28,7 +28,6 @@ base / res.company / active (boolean) : NEW ha base / res.company / company_registry (char) : not stored anymore base / res.company / company_registry (char) : now related base / res.company / font (selection) : selection_keys is now '['Lato', 'Montserrat', 'Open_Sans', 'Oswald', 'Raleway', 'Roboto', 'Tajawal']' ('['Lato', 'Montserrat', 'Open_Sans', 'Oswald', 'Raleway', 'Roboto']') -base / res.partner / company_registry (char) : NEW hasdefault: compute base / res.partner / credit_limit (float) : module is now 'account' ('base') base / res.partner / credit_limit (float) : not stored anymore base / res.partner.bank / allow_out_payment (boolean) : NEW hasdefault: default @@ -40,6 +39,9 @@ base / res.users.deletion / user_id_int (integer) : NEW is # NOTHING TO DO +base / res.partner / company_registry (char) : NEW hasdefault: compute +# DONE: pre-migration: Pre-create the field for not triggering the compute. Further modules scripts (right now only l10n_be and l10n_ro seems to override the method) have to include the computation, or trigger the computation on end-migration. + ---XML records in module 'base'--- DEL ir.actions.act_window: base.action_translation DEL ir.actions.act_window: base.action_wizard_update_translations diff --git a/openupgrade_scripts/scripts/base_address_extended/16.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/base_address_extended/16.0.1.1/pre-migration.py new file mode 100644 index 000000000000..7a43ee068f1c --- /dev/null +++ b/openupgrade_scripts/scripts/base_address_extended/16.0.1.1/pre-migration.py @@ -0,0 +1,58 @@ +# Copyright 2025 Dixmit +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + +_add_fields = [ + ( + "street_name", + "res.partner", + "res_partner", + "char", + None, + "base_address_extended", + None, + ), + ( + "street_number", + "res.partner", + "res_partner", + "char", + None, + "base_address_extended", + None, + ), + ( + "street_number2", + "res.partner", + "res_partner", + "char", + None, + "base_address_extended", + None, + ), +] + + +@openupgrade.migrate() +def migrate(env, _version): + openupgrade.add_fields(env, _add_fields) + # We need to use the subquery because the regex is not allowed inside the UPDATE statement + openupgrade.logged_query( + env.cr, + """ + UPDATE res_partner + SET + street_name = TRIM(rgx[1]), + street_number = TRIM(rgx[2]), + street_number2 = TRIM(rgx[3]) + FROM ( + SELECT + id, + regexp_match(street, '^(.*?)(?:\\s([0-9][0-9^\\s]*))?(?: - (.+))?$') AS rgx + FROM res_partner + WHERE street IS NOT NULL + ) AS sub + WHERE res_partner.id = sub.id; + """, + ) diff --git a/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py b/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py index 29c17edd3c8a..0e241b2bffd3 100644 --- a/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py +++ b/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py @@ -16,10 +16,10 @@ def create_work_contact(env): res.user as a work_contact_id. If the employee is not linked to a res.user. Then we try to match an - existing partner with the same email address and mobile (when the employee - has one of them). If one is found, then we assign it as work_contact_id. - If several are found, we raise a warning and we link the first one found. - If none are found, then we create a new partner. + existing partner with the same email address. If one is found, then + we assign it as work_contact_id. If several are found, we raise a + warning and we link the first one found. If none are found, then we + create a new partner. """ employees = env["hr.employee"].search([]) @@ -44,18 +44,16 @@ def create_work_contact(env): partner.id, ) else: - # Without email nor mobile, the search would match every partner - # that has neither of them, and an unrelated contact would become - # the work contact (the private address is merged into it in 17.0) - matching_partner = env["res.partner"] - if employee.work_email or employee.mobile_phone: - matching_partner = matching_partner.search( + if employee.work_email and employee.mobile_phone: + matching_partner = env["res.partner"].search( [ ("email", "=", employee.work_email), ("mobile", "=", employee.mobile_phone), ] ) - nb_matching_partner = len(matching_partner) + nb_matching_partner = len(matching_partner) + else: + nb_matching_partner = 0 if nb_matching_partner == 1: employee.work_contact_id = matching_partner _logger.info( @@ -77,7 +75,7 @@ def create_work_contact(env): partner.id, employee.id, ) - else: + elif employee.work_email or employee.mobile_phone: partner_vals = { "name": employee.name, "email": employee.work_email, diff --git a/openupgrade_scripts/scripts/l10n_de/16.0.1.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/l10n_de/16.0.1.0/upgrade_analysis.txt deleted file mode 100644 index 1515731f1c39..000000000000 --- a/openupgrade_scripts/scripts/l10n_de/16.0.1.0/upgrade_analysis.txt +++ /dev/null @@ -1,196 +0,0 @@ ----Models in module 'l10n_de'--- ----Fields in module 'l10n_de'--- ----XML records in module 'l10n_de'--- -NEW account.report: l10n_de.tax_report -NEW account.report.column: l10n_de.tax_report_balance -NEW account.report.expression: l10n_de.tax_report_de_tag_21_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_24_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_26_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_27_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_33_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_34_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_35_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_36_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_39_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_41_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_42_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_43_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_44_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_45_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_47_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_48_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_49_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_52_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_53_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_59_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_60_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_61_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_62_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_63_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_64_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_65_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_66_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_67_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_68_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_69_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_73_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_74_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_76_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_77_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_78_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_79_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_80_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_81_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_83_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_84_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_85_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_86_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_89_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_91_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_93_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_94_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_95_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_96_tag -NEW account.report.expression: l10n_de.tax_report_de_tag_98_tag -NEW account.report.expression: l10n_de.tax_report_de_tax_tag_45_tag -NEW account.report.line: l10n_de.tax_report_de_tag_01 -NEW account.report.line: l10n_de.tax_report_de_tag_02 -NEW account.report.line: l10n_de.tax_report_de_tag_17 -NEW account.report.line: l10n_de.tax_report_de_tag_18 -NEW account.report.line: l10n_de.tax_report_de_tag_19 -NEW account.report.line: l10n_de.tax_report_de_tag_21 -NEW account.report.line: l10n_de.tax_report_de_tag_24 -NEW account.report.line: l10n_de.tax_report_de_tag_25 -NEW account.report.line: l10n_de.tax_report_de_tag_26 -NEW account.report.line: l10n_de.tax_report_de_tag_27 -NEW account.report.line: l10n_de.tax_report_de_tag_31 -NEW account.report.line: l10n_de.tax_report_de_tag_33 -NEW account.report.line: l10n_de.tax_report_de_tag_34 -NEW account.report.line: l10n_de.tax_report_de_tag_35 -NEW account.report.line: l10n_de.tax_report_de_tag_36 -NEW account.report.line: l10n_de.tax_report_de_tag_37 -NEW account.report.line: l10n_de.tax_report_de_tag_39 -NEW account.report.line: l10n_de.tax_report_de_tag_41 -NEW account.report.line: l10n_de.tax_report_de_tag_42 -NEW account.report.line: l10n_de.tax_report_de_tag_43 -NEW account.report.line: l10n_de.tax_report_de_tag_44 -NEW account.report.line: l10n_de.tax_report_de_tag_45 -NEW account.report.line: l10n_de.tax_report_de_tag_46 -NEW account.report.line: l10n_de.tax_report_de_tag_47 -NEW account.report.line: l10n_de.tax_report_de_tag_48 -NEW account.report.line: l10n_de.tax_report_de_tag_49 -NEW account.report.line: l10n_de.tax_report_de_tag_52 -NEW account.report.line: l10n_de.tax_report_de_tag_53 -NEW account.report.line: l10n_de.tax_report_de_tag_59 -NEW account.report.line: l10n_de.tax_report_de_tag_60 -NEW account.report.line: l10n_de.tax_report_de_tag_61 -NEW account.report.line: l10n_de.tax_report_de_tag_62 -NEW account.report.line: l10n_de.tax_report_de_tag_63 -NEW account.report.line: l10n_de.tax_report_de_tag_64 -NEW account.report.line: l10n_de.tax_report_de_tag_65 -NEW account.report.line: l10n_de.tax_report_de_tag_66 -NEW account.report.line: l10n_de.tax_report_de_tag_67 -NEW account.report.line: l10n_de.tax_report_de_tag_68 -NEW account.report.line: l10n_de.tax_report_de_tag_69 -NEW account.report.line: l10n_de.tax_report_de_tag_73 -NEW account.report.line: l10n_de.tax_report_de_tag_74 -NEW account.report.line: l10n_de.tax_report_de_tag_76 -NEW account.report.line: l10n_de.tax_report_de_tag_77 -NEW account.report.line: l10n_de.tax_report_de_tag_78 -NEW account.report.line: l10n_de.tax_report_de_tag_79 -NEW account.report.line: l10n_de.tax_report_de_tag_80 -NEW account.report.line: l10n_de.tax_report_de_tag_81 -NEW account.report.line: l10n_de.tax_report_de_tag_83 -NEW account.report.line: l10n_de.tax_report_de_tag_84 -NEW account.report.line: l10n_de.tax_report_de_tag_85 -NEW account.report.line: l10n_de.tax_report_de_tag_86 -NEW account.report.line: l10n_de.tax_report_de_tag_89 -NEW account.report.line: l10n_de.tax_report_de_tag_91 -NEW account.report.line: l10n_de.tax_report_de_tag_93 -NEW account.report.line: l10n_de.tax_report_de_tag_94 -NEW account.report.line: l10n_de.tax_report_de_tag_95 -NEW account.report.line: l10n_de.tax_report_de_tag_96 -NEW account.report.line: l10n_de.tax_report_de_tag_98 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_17 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_18 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_31 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_37 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_45 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_46 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_55 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_64 -NEW account.report.line: l10n_de.tax_report_de_tax_tag_66 -DEL account.tax.report: l10n_de.tax_report -DEL account.tax.report.line: l10n_de.tax_report_de_tag_01 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_02 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_17 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_18 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_19 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_21 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_24 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_25 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_26 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_27 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_31 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_33 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_34 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_35 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_36 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_37 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_39 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_41 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_42 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_43 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_44 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_45 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_46 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_47 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_48 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_49 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_52 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_53 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_59 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_60 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_61 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_62 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_63 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_64 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_65 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_66 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_67 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_68 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_69 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_73 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_74 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_76 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_77 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_78 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_79 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_80 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_81 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_83 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_84 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_85 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_86 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_89 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_91 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_93 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_94 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_95 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_96 -DEL account.tax.report.line: l10n_de.tax_report_de_tag_98 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_17 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_18 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_31 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_37 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_45 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_46 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_55 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_64 -DEL account.tax.report.line: l10n_de.tax_report_de_tax_tag_66 -DEL ir.ui.menu: l10n_de.account_reports_de_statements_menu -DEL ir.ui.view: l10n_de.din5008_css -DEL ir.ui.view: l10n_de.external_layout_din5008 -DEL report.layout: l10n_de.report_layout_din5008 [renamed to l10n_din5008 module] -DEL report.paperformat: l10n_de.paperformat_euro_din [renamed to l10n_din5008 module] -DEL report.paperformat: l10n_de.paperformat_euro_din_a [renamed to l10n_din5008 module] diff --git a/openupgrade_scripts/scripts/l10n_de/16.0.2.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/l10n_de/16.0.2.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..e291df62de99 --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_de/16.0.2.0/upgrade_analysis_work.txt @@ -0,0 +1,63 @@ +---Models in module 'l10n_de'--- +---Fields in module 'l10n_de'--- +---XML records in module 'l10n_de'--- +NEW account.report.column: l10n_de.tax_report_balance +NEW account.report.expression: l10n_de.tax_report_de_tag_21_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_24_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_26_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_27_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_33_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_34_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_35_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_36_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_37_74_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_39_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_41_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_42_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_43_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_44_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_45_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_47_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_48_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_49_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_50_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_59_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_60_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_61_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_62_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_63_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_64_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_65_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_66_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_67_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_69_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_73_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_74_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_76_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_77_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_80_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_81_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_83_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_84_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_85_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_86_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_87_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_89_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_90_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_91_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_93_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_94_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_95_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_96_tag +NEW account.report.expression: l10n_de.tax_report_de_tag_98_tag +# NOTHING TO DO: New data for the account tax report engine + +DEL ir.ui.menu: l10n_de.account_reports_de_statements_menu +DEL ir.ui.view: l10n_de.din5008_css +DEL ir.ui.view: l10n_de.external_layout_din5008 +# NOTHING TO DO: ir noupdate=0 stuff + +DEL report.layout: l10n_de.report_layout_din5008 [renamed to l10n_din5008 module] +DEL report.paperformat: l10n_de.paperformat_euro_din [renamed to l10n_din5008 module] +DEL report.paperformat: l10n_de.paperformat_euro_din_a [renamed to l10n_din5008 module] +# NOTHING TO DO: To be renamed in pre in l10n_din5008 diff --git a/openupgrade_scripts/scripts/l10n_es/16.0.5.3/post-migration.py b/openupgrade_scripts/scripts/l10n_es/16.0.5.3/post-migration.py new file mode 100644 index 000000000000..21c4fb13bb05 --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_es/16.0.5.3/post-migration.py @@ -0,0 +1,25 @@ +# Copyright 2025 Dixmit +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from openupgradelib import openupgrade + +IRNR_TAX_GROUP_MAP = { + "l10n_es.%s_account_tax_template_s_irpfnrnue24": "l10n_es.tax_group_retenciones_24", + "l10n_es.%s_account_tax_template_p_irpfnrnue24p": "l10n_es.tax_group_retenciones_24", + "l10n_es.%s_account_tax_template_s_irpfnrue19": "l10n_es.tax_group_retenciones_19", + "l10n_es.%s_account_tax_template_p_irpfnrue19p": "l10n_es.tax_group_retenciones_19", + "l10n_es.%s_account_tax_template_s_irpfnrnue0": "l10n_es.tax_group_retenciones_0", + "l10n_es.%s_account_tax_template_p_irpfnrnue0p": "l10n_es.tax_group_retenciones_0", + "l10n_es.%s_account_tax_template_s_irpfnrue0": "l10n_es.tax_group_retenciones_0", + "l10n_es.%s_account_tax_template_p_irpfnrue0p": "l10n_es.tax_group_retenciones_0", +} + + +@openupgrade.migrate() +def migrate(env, version): + for company in env["res.company"].search([]): + for irnr_tax_ref in IRNR_TAX_GROUP_MAP: + irnr_tax = env.ref(irnr_tax_ref % company.id, raise_if_not_found=False) + if irnr_tax: + irnr_tax.tax_group_id = env.ref(IRNR_TAX_GROUP_MAP[irnr_tax_ref]) diff --git a/openupgrade_scripts/scripts/mass_mailing_themes/16.0.1.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/mass_mailing_themes/16.0.1.1/upgrade_analysis_work.txt new file mode 100644 index 000000000000..16a8001a7391 --- /dev/null +++ b/openupgrade_scripts/scripts/mass_mailing_themes/16.0.1.1/upgrade_analysis_work.txt @@ -0,0 +1,11 @@ +---Models in module 'mass_mailing_themes'--- +---Fields in module 'mass_mailing_themes'--- +---XML records in module 'mass_mailing_themes'--- +NEW ir.ui.view: mass_mailing_themes.email_designer_snippets +NEW ir.ui.view: mass_mailing_themes.theme_bignews_template +NEW ir.ui.view: mass_mailing_themes.theme_bold_template +NEW ir.ui.view: mass_mailing_themes.theme_newsletter_template +NEW ir.ui.view: mass_mailing_themes.theme_solar_template +NEW ir.ui.view: mass_mailing_themes.theme_tech_template +NEW ir.ui.view: mass_mailing_themes.theme_vip_template +# NOTHING TO DO: new module containing only predefined mailing theme views diff --git a/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/post-migration.py b/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/post-migration.py index b52597b685e1..8e0581e21692 100644 --- a/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/post-migration.py +++ b/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/post-migration.py @@ -27,11 +27,16 @@ def copy_register_balance(cr): openupgrade.logged_query( cr, """ - UPDATE pos_session session - SET cash_register_balance_end_real=statement.balance_end_real, - cash_register_balance_start=statement.balance_start - FROM account_bank_statement statement - WHERE statement.pos_session_id=session.id + update pos_session as ps + set + cash_register_balance_end_real = coalesce(abs.balance_end_real, 0), + cash_register_balance_start = coalesce(abs.balance_start, 0) + from pos_session as ps2 + left outer join account_bank_statement as abs on + abs.pos_session_id = ps2.id and + abs.journal_id = ps2.cash_journal_id + where + ps2.id = ps.id """, ) @@ -44,6 +49,7 @@ def migrate(env, version): env, [ "point_of_sale.rule_pos_cashbox_line_accountant", + "point_of_sale.rule_pos_bank_statement_user", "point_of_sale.500_00", ], ) diff --git a/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/upgrade_analysis_work.txt index 74767f5a7ca1..f944791fd8ff 100644 --- a/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/point_of_sale/16.0.1.0.1/upgrade_analysis_work.txt @@ -79,10 +79,8 @@ DEL ir.model.access: point_of_sale.access_money_in_out_wizard # NOTHING TO DO: the relevant models no longer exist DEL ir.rule: point_of_sale.rule_pos_bank_statement_user (noupdate) -# NOTHING TO DO: pos_session_id no longer stored on account.bank.statement. - DEL ir.rule: point_of_sale.rule_pos_cashbox_line_accountant (noupdate) -# DONE: post-migration: Remove safely the rule +# DONE: post-migration: Remove safely the rules DEL ir.ui.menu: point_of_sale.menu_pos_config_pos NEW ir.ui.view: point_of_sale.ticket_validation_screen diff --git a/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/post-migration.py b/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/post-migration.py index ed6fac44c7d2..b31913bdd0b0 100644 --- a/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/post-migration.py +++ b/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/post-migration.py @@ -1,8 +1,9 @@ +# Copyright 2024,2025 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openupgradelib import openupgrade def fill_purchase_order_group_from_tenders(env): - tender_type = env.ref("purchase_requisition.type_multi") openupgrade.logged_query( env.cr, """ @@ -10,60 +11,33 @@ def fill_purchase_order_group_from_tenders(env): ADD COLUMN IF NOT EXISTS old_purchase_requisition_id INTEGER """, ) + # Create a group if there is more than one PO per requisition openupgrade.logged_query( env.cr, - f""" - INSERT INTO purchase_order_group (old_purchase_requisition_id, - create_date, create_uid, write_date, write_uid) - SELECT DISTINCT ON (pr.id) pr.id, - pr.create_date, pr.create_uid, pr.write_date, pr.write_uid - FROM purchase_requisition pr - JOIN purchase_order po1 ON po1.requisition_id = pr.id - JOIN purchase_order po2 ON po2.requisition_id = pr.id AND po1.id != po2.id - -- only create group if there is more than one purchase - WHERE pr.type_id = {tender_type.id} - RETURNING old_purchase_requisition_id + """ + INSERT INTO purchase_order_group + (old_purchase_requisition_id, create_date, create_uid, write_date, write_uid) + SELECT + t.requisition_id, pr.create_date, pr.create_uid, pr.write_date, pr.write_uid + FROM ( + SELECT *, row_number() + over (partition BY requisition_id ORDER BY id) AS rnum + FROM purchase_order + ) t + JOIN purchase_requisition pr ON pr.id = t.requisition_id + WHERE t.rnum = 2; """, ) - tender_requisition_ids = [x[0] for x in env.cr.fetchall()] - if tender_requisition_ids: - openupgrade.logged_query( - env.cr, - """ - UPDATE purchase_order po - SET purchase_group_id = pog.id - FROM purchase_order_group pog - WHERE po.requisition_id = pog.old_purchase_requisition_id - """, - ) + # Assign it to the purchase orders openupgrade.logged_query( env.cr, - f""" - SELECT pr.id - FROM purchase_requisition pr - WHERE pr.type_id = {tender_type.id} - """, + """ + UPDATE purchase_order po + SET purchase_group_id = pog.id + FROM purchase_order_group pog + WHERE po.requisition_id = pog.old_purchase_requisition_id + """, ) - obsolete_requisition_ids = [x[0] for x in env.cr.fetchall()] - if obsolete_requisition_ids: - openupgrade.logged_query( - env.cr, - f""" - UPDATE purchase_order po - SET requisition_id = NULL - FROM purchase_requisition pr - WHERE po.requisition_id = pr.id AND pr.type_id = {tender_type.id} - """, - ) - openupgrade.logged_query( - env.cr, - """ - UPDATE purchase_requisition pr - SET state = 'draft' - WHERE pr.state not in ('draft', 'cancel') - """, - ) - env["purchase.requisition"].browse(obsolete_requisition_ids).unlink() @openupgrade.migrate() diff --git a/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/upgrade_analysis_work.txt index 53c101c4b961..e45f2c2cda8a 100644 --- a/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/purchase_requisition/16.0.0.1/upgrade_analysis_work.txt @@ -2,7 +2,7 @@ new model purchase.order.group purchase_requisition / purchase.order / purchase_group_id (many2one) : NEW relation: purchase.order.group purchase_requisition / purchase.order.group / order_ids (one2many) : NEW relation: purchase.order -# DONE: post-migration: group purchases by their requisition if it has the deleted type "purchase_requisition.type_multi" +# DONE: post-migration: group purchases by their requisition if there's more than one PO per requisition new model purchase.requisition.alternative.warning [transient] new model purchase.requisition.create.alternative [transient] diff --git a/openupgrade_scripts/scripts/repair/16.0.1.0/post-migration.py b/openupgrade_scripts/scripts/repair/16.0.1.0/post-migration.py index ba276ec8be70..86b90105c577 100644 --- a/openupgrade_scripts/scripts/repair/16.0.1.0/post-migration.py +++ b/openupgrade_scripts/scripts/repair/16.0.1.0/post-migration.py @@ -4,13 +4,9 @@ from openupgradelib import openupgrade -def _compute_repair_price_total(env, model): - fees = env[model].search([]) - fees._compute_price_total_and_subtotal() - - @openupgrade.migrate() def migrate(env, version): openupgrade.load_data(env.cr, "repair", "16.0.1.0/noupdate_changes.xml") - _compute_repair_price_total(env, "repair.fee") - _compute_repair_price_total(env, "repair.line") + openupgrade.delete_record_translations( + env.cr, "repair", ["mail_template_repair_quotation"], ["name", "description"] + ) diff --git a/openupgrade_scripts/scripts/repair/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/repair/16.0.1.0/upgrade_analysis_work.txt index 942a17d54a3c..650f5d61d89e 100644 --- a/openupgrade_scripts/scripts/repair/16.0.1.0/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/repair/16.0.1.0/upgrade_analysis_work.txt @@ -2,7 +2,7 @@ ---Fields in module 'repair'--- repair / repair.fee / price_total (float) : is now stored repair / repair.line / price_total (float) : is now stored -# DONE: recomputed in post_migration +# NOTIHING TO DO: handled by ORM repair / repair.line / lot_id (many2one) : relation is now 'stock.lot' ('stock.production.lot') [nothing to do] repair / repair.order / lot_id (many2one) : relation is now 'stock.lot' ('stock.production.lot') [nothing to do] diff --git a/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/noupdate_changes.xml b/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/noupdate_changes.xml index f070bee44fc6..15010d560ef7 100644 --- a/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/noupdate_changes.xml +++ b/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/noupdate_changes.xml @@ -1,5 +1,6 @@ +
diff --git a/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/upgrade_analysis.txt index 337005f04eda..4aeed77c7742 100644 --- a/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/sale_quotation_builder/16.0.1.0/upgrade_analysis.txt @@ -2,4 +2,6 @@ ---Fields in module 'sale_quotation_builder'--- sale_quotation_builder / sale.order.template.line / website_description (html) : is now stored sale_quotation_builder / sale.order.template.line / website_description (html) : not related anymore +# NOTHING TO DO: quotation_description in product_template is store=False, so let the ORM recompute the field here. + ---XML records in module 'sale_quotation_builder'--- diff --git a/openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/noupdate_changes.xml b/openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/noupdate_changes.xml new file mode 100644 index 000000000000..7ccd52fce3c3 --- /dev/null +++ b/openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/noupdate_changes.xml @@ -0,0 +1,8 @@ + + + + + [('project_id', '=', False)] + + diff --git a/openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/pre-migration.py index 8d92a1fef264..3632a3a246ed 100644 --- a/openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/pre-migration.py +++ b/openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/pre-migration.py @@ -29,6 +29,7 @@ def _update_account_analytic_line_timesheet_invoice_type(env): @openupgrade.migrate() def migrate(env, version): + openupgrade.load_data(env.cr, "sale_timesheet", "16.0.1.0/noupdate_changes.xml") _update_account_analytic_line_timesheet_invoice_type(env) # Remove SQL view project_profitability_report not used anymore in Odoo 16 openupgrade.logged_query( diff --git a/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py b/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py index 73fa805a363d..ea22681aa08a 100644 --- a/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py +++ b/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py @@ -45,6 +45,9 @@ def convert_field_html_string_bootstrap_4to5(env): "mailing.mailing", "account.invoice.send", "mail.alias", + "survey.survey", + "survey.question", + "forum.forum", ] # We could want to refine a certain field logic to discard a good bunch of records field_special_domain = { @@ -54,6 +57,16 @@ def convert_field_html_string_bootstrap_4to5(env): ] }, } + # Certain fields had sanitize=False or other sanitization disablings (like + # sanitize_attributes=False or sanitize_form=False), so when converting to BS 5, + # we should allow to save the result without re-sanitizing such content. For that, + # if the user is not on the sanitize overridable group, we add it, removing it after + # conversion + group_overridable = False + if not env.user._has_group("base.group_sanitize_override"): + group_overridable = env.ref("base.group_sanitize_override") + env.user.groups_id = [(4, group_overridable.id)] + # Search fields = env["ir.model.fields"].search( [ ("ttype", "=", "html"), @@ -72,6 +85,9 @@ def convert_field_html_string_bootstrap_4to5(env): env.cr, env[model]._table, field.name ): convert_field_bootstrap_4to5(env, model, field.name, domain=domain) + # Remove the group if applicable + if group_overridable: + env.user.groups_id = [(3, group_overridable.id)] def rename_t_group_website_restricted_editor(env): @@ -117,3 +133,4 @@ def migrate(env, version): convert_field_html_string_bootstrap_4to5(env) rename_t_group_website_restricted_editor(env) _sync_website_visitor_access_token(env) + openupgrade.cow_templates_replicate_upstream(env.cr) diff --git a/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py b/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py index f0da611d290c..f6c5d7b3c39f 100644 --- a/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py +++ b/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py @@ -4,3 +4,9 @@ @openupgrade.migrate() def migrate(env, version): openupgrade.load_data(env.cr, "website", "16.0.1.0/noupdate_changes.xml") + # Website editors that come from v15, where there was no sanitization, would expect + # the same on the new version, or worst: they introduce some content like iframe, + # and re-editing that content in 16 leads to lose it when saving it. Thus, let's + # add all of them to the override sanitization group for keeping the same behavior. + users = env.ref("website.group_website_restricted_editor").users + users.groups_id = [(4, env.ref("base.group_sanitize_override").id)] diff --git a/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py index ff900193e13e..b3aa387aad3e 100644 --- a/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py +++ b/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py @@ -148,3 +148,4 @@ def migrate(env, version): _reset_customize_show_in_website_views(env) _fill_homepage_url(env) _mig_s_progress_steps_contents(env) + openupgrade.cow_templates_mark_if_equal_to_upstream(env.cr) diff --git a/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/pre-migration.py index 40cd4335cc16..7ac4b5a17189 100644 --- a/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/pre-migration.py +++ b/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/pre-migration.py @@ -1,16 +1,23 @@ +# Copyright 2025 Tecnativa - Carlos Lopez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openupgradelib import openupgrade -@openupgrade.migrate() -def migrate(env, version): - # update detailed_type of the course product +def _update_detailed_type_to_course(env): + """ + Adapt all products using into a course to the new detailed_type=course + """ openupgrade.logged_query( env.cr, - """ - UPDATE product_template pt - SET detailed_type = 'course' + """UPDATE product_template pt + SET detailed_type = 'course' FROM product_product pp - JOIN slide_channel sc ON sc.product_id = pp.id - WHERE pt.id = pp.product_tmpl_id + JOIN slide_channel sc ON sc.product_id = pp.id + WHERE pp.product_tmpl_id = pt.id; """, ) + + +@openupgrade.migrate() +def migrate(env, version): + _update_detailed_type_to_course(env) diff --git a/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/upgrade_analysis_work.txt index 313a7ab577ac..936115e82a1c 100644 --- a/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/website_sale_slides/16.0.1.0/upgrade_analysis_work.txt @@ -1,7 +1,7 @@ ---Models in module 'website_sale_slides'--- ---Fields in module 'website_sale_slides'--- website_sale_slides / product.template / detailed_type (False) : previously in module gift_card -# DONE: pre-migration: converted detailed_type = 'course' +# DONE: pre-migration: Update detailed_type=course on products used in courses ---XML records in module 'website_sale_slides'--- NEW ir.ui.view: website_sale_slides.cart_summary_inherit_website_sale_slides @@ -15,4 +15,4 @@ NEW ir.ui.view: website_sale_slides.website_sale_confirmation_slide DEL ir.ui.view: website_sale_slides.course_sidebar NEW product.category: website_sale_slides.product_category_courses NEW product.product: website_sale_slides.default_product_course -# NOTHING TO DO +# NOTHING TO DO: new features diff --git a/openupgrade_scripts/scripts/website_slides/16.0.2.6/end-migration.py b/openupgrade_scripts/scripts/website_slides/16.0.2.6/end-migration.py index 4588e229de93..6ca280d1e939 100644 --- a/openupgrade_scripts/scripts/website_slides/16.0.2.6/end-migration.py +++ b/openupgrade_scripts/scripts/website_slides/16.0.2.6/end-migration.py @@ -1,9 +1,20 @@ +# Copyright 2025 Tecnativa - Carlos Lopez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openupgradelib import openupgrade -def _fill_values_on_slide_slide(env): +@openupgrade.logging() +def _recompute_slide_slide_type(env): + """Recompute the field by calling its compute method. + + Archived slides are included: their column still holds the 15.0 values. + """ slides = env["slide.slide"].with_context(active_test=False).search([]) slides._compute_slide_type() + + +def _fill_values_on_slide_slide(env): + slides = env["slide.slide"].with_context(active_test=False).search([]) slides._compute_slides_statistics() @@ -15,5 +26,6 @@ def _fill_nbr_article_on_slide_channel(env): @openupgrade.migrate() def migrate(env, version): + _recompute_slide_slide_type(env) _fill_values_on_slide_slide(env) _fill_nbr_article_on_slide_channel(env) diff --git a/openupgrade_scripts/scripts/website_slides/16.0.2.6/pre-migration.py b/openupgrade_scripts/scripts/website_slides/16.0.2.6/pre-migration.py index 2f04f270465f..ce2b63853ffc 100644 --- a/openupgrade_scripts/scripts/website_slides/16.0.2.6/pre-migration.py +++ b/openupgrade_scripts/scripts/website_slides/16.0.2.6/pre-migration.py @@ -26,7 +26,6 @@ def _create_and_fill_data_from_slide_type_to_slide_category(env): [("webpage", "article"), ("presentation", "document")], table="slide_slide", ) - openupgrade.rename_columns(env.cr, {"slide_slide": [("slide_type", None)]}) def _create_and_fill_data_for_source_type(env): diff --git a/openupgrade_scripts/scripts/website_slides/16.0.2.6/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_slides/16.0.2.6/upgrade_analysis_work.txt index 3231a053a9ac..8494de7ba235 100644 --- a/openupgrade_scripts/scripts/website_slides/16.0.2.6/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/website_slides/16.0.2.6/upgrade_analysis_work.txt @@ -45,7 +45,7 @@ website_slides / slide.slide / slide_category (selection) : NEW # DONE: pre-migration: copy column slide_type + map values that changes website_slides / slide.slide / slide_type (selection) : selection_keys is now '['article', 'doc', 'google_drive_video', 'image', 'pdf', 'quiz', 'sheet', 'slides', 'vimeo_video', 'youtube_video']' ('['document', 'infographic', 'presentation', 'quiz', 'video', 'webpage']') -# NOTHING TO DO: Let ORM handle recomputes this field +# DONE (end-migration): Let ORM handle recomputes this field website_slides / slide.slide / source_type (selection) : NEW required, selection_keys: ['external', 'local_file'], hasdefault: default # DONE: post-migration: Switch to external for those with `google_drive_id`, that are the only where these applies: https://github.com/odoo/odoo/blob/42bcc3ef284ca355e2323641176573b53e7d2e28/addons/website_slides/controllers/main.py#L1197 diff --git a/openupgrade_scripts/scripts/website_slides_forum/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_slides_forum/16.0.1.0/upgrade_analysis_work.txt index 20cd9670702a..f4b8b71b7431 100644 --- a/openupgrade_scripts/scripts/website_slides_forum/16.0.1.0/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/website_slides_forum/16.0.1.0/upgrade_analysis_work.txt @@ -6,4 +6,4 @@ DEL ir.ui.menu: website_slides_forum.website_slides_menu_report_forum NEW ir.ui.view: website_slides_forum.forum_forum_view_tree_slides NEW ir.ui.view: website_slides_forum.res_config_settings_view_form NEW ir.ui.view: website_slides_forum.snippet_options -# NOTHING TODO +# NOTHING TO DO: ir noupdate=0 stuff diff --git a/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/post-migration.py b/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/post-migration.py index c34e1fa66ee1..fe8ebd98db8b 100644 --- a/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/post-migration.py +++ b/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/post-migration.py @@ -1,3 +1,6 @@ +# Copyright 2025 Tecnativa - Carlos Lopez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from openupgradelib import openupgrade @@ -6,3 +9,8 @@ def migrate(env, version): openupgrade.load_data( env.cr, "website_slides_survey", "16.0.1.0/noupdate_changes.xml" ) + openupgrade.delete_record_translations( + env.cr, + "website_slides_survey", + ["mail_template_user_input_certification_failed"], + ) diff --git a/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/pre-migration.py index 1c5f56851280..a7881b496b5c 100644 --- a/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/pre-migration.py +++ b/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/pre-migration.py @@ -1,6 +1,19 @@ +# Copyright 2025 Tecnativa - Carlos Lopez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from openupgradelib import openupgrade +def _delete_sql_constraints(env): + """Delete constraints to recreate it""" + openupgrade.delete_sql_constraint_safely( + env, "website_slides_survey", "slide_slide", "check_survey_id" + ) + openupgrade.delete_sql_constraint_safely( + env, "website_slides_survey", "slide_slide", "check_certification_preview" + ) + + def _fast_fill_name_on_slide_slide(env): openupgrade.logged_query( env.cr, @@ -20,24 +33,6 @@ def _fast_fill_name_on_slide_slide(env): ) -def _fast_fill_slide_category_on_slide_slide(env): - openupgrade.logged_query( - env.cr, - """ - ALTER TABLE slide_slide - ADD COLUMN IF NOT EXISTS slide_category VARCHAR - """, - ) - openupgrade.logged_query( - env.cr, - """ - UPDATE slide_slide - SET slide_category = 'certification' - WHERE slide_type = 'certification' - """, - ) - - def _set_is_preview_on_slide_slide_for_certification(env): openupgrade.logged_query( env.cr, @@ -51,6 +46,6 @@ def _set_is_preview_on_slide_slide_for_certification(env): @openupgrade.migrate() def migrate(env, version): + _delete_sql_constraints(env) _fast_fill_name_on_slide_slide(env) - _fast_fill_slide_category_on_slide_slide(env) _set_is_preview_on_slide_slide_for_certification(env) diff --git a/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/upgrade_analysis_work.txt index 82684efa4fc1..976159d1281a 100644 --- a/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/website_slides_survey/16.0.1.0/upgrade_analysis_work.txt @@ -2,21 +2,27 @@ ---Fields in module 'website_slides_survey'--- website_slides_survey / slide.slide / name (False) : NEW mode: modify, hasdefault: compute # DONE: pre-migration to fill value for empty name +# The field exists in the website_slides module as storable; just changed it to computed. website_slides_survey / slide.slide / slide_category (False) : NEW selection_keys: ['article', 'certification', 'document', 'infographic', 'quiz', 'video'], mode: modify -# DONE: pre-migration to set slide_category = 'certification' if slide_type = 'certification' +# NOTHING TO DO: The field exists in the website_slides module, the migration script is done on website_slides website_slides_survey / slide.slide / slide_type (False) : selection_keys is now '['article', 'certification', 'doc', 'google_drive_video', 'image', 'pdf', 'quiz', 'sheet', 'slides', 'vimeo_video', 'youtube_video']' ('['certification', 'document', 'infographic', 'presentation', 'quiz', 'video', 'webpage']') -# NOTHING TO DO +# NOTHING TO DO: This is handled in the end-migration step of the website_slides module ---XML records in module 'website_slides_survey'--- DEL ir.actions.act_window: website_slides_survey.survey_survey_action_slides_report +DEL ir.ui.menu: website_slides_survey.website_slides_menu_report_certification +# NOTHING TO DO: Handled by ORM + +ir.model.constraint: website_slides_survey.constraint_slide_slide_check_certification_preview (changed definition: is now 'check(slide_category != 'certification' or is_preview = false)' ('check(slide_type != 'certification' or is_preview = false)')) +ir.model.constraint: website_slides_survey.constraint_slide_slide_check_survey_id (changed definition: is now 'check(slide_category != 'certification' or survey_id is not null)' ('check(slide_type != 'certification' or survey_id is not null)')) +# DONE: pre-migration: safely delete constraints for letting ORM to recreate them +# DONE: pre-migration: set is_preview = false on the certification slides so that check_certification_preview can be recreated + NEW ir.actions.act_window.view: website_slides_survey.survey_survey_action_slides_view_form NEW ir.actions.act_window.view: website_slides_survey.survey_survey_action_slides_view_kanban NEW ir.actions.act_window.view: website_slides_survey.survey_survey_action_slides_view_tree -ir.model.constraint: website_slides_survey.constraint_slide_slide_check_certification_preview (changed definition: is now 'check(slide_category != 'certification' or is_preview = false)' ('check(slide_type != 'certification' or is_preview = false)')) -ir.model.constraint: website_slides_survey.constraint_slide_slide_check_survey_id (changed definition: is now 'check(slide_category != 'certification' or survey_id is not null)' ('check(slide_type != 'certification' or survey_id is not null)')) -DEL ir.ui.menu: website_slides_survey.website_slides_menu_report_certification NEW ir.ui.view: website_slides_survey.res_config_settings_view_form NEW ir.ui.view: website_slides_survey.slide_sidebar_done_button NEW ir.ui.view: website_slides_survey.slide_slide_partner_view_form @@ -25,4 +31,4 @@ NEW ir.ui.view: website_slides_survey.slide_slide_partner_view_tree NEW ir.ui.view: website_slides_survey.survey_survey_view_kanban NEW ir.ui.view: website_slides_survey.survey_survey_view_search_slides NEW ir.ui.view: website_slides_survey.survey_survey_view_tree_slides -# NOTHING TO DO: noupdate="0" records +# NOTHING TO DO: it's noupdate=0 stuff diff --git a/openupgrade_scripts/static/description/index.html b/openupgrade_scripts/static/description/index.html index ecfbcfb92084..05c9dd91c5d9 100644 --- a/openupgrade_scripts/static/description/index.html +++ b/openupgrade_scripts/static/description/index.html @@ -3,7 +3,7 @@ -Openupgrade Scripts +README.rst -
-

Openupgrade Scripts

+
+ + +Odoo Community Association + +
+

Openupgrade Scripts

-

Beta License: AGPL-3 OCA/OpenUpgrade Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/OpenUpgrade Translate me on Weblate Try me on Runboat

This module is a containers of migration script to migrate from 15.0 to 16.0 version.

Table of contents

@@ -385,12 +390,12 @@

Openupgrade Scripts

-

Installation

+

Installation

This module does not need to be installed on a database. It simply needs to be available via your addons-path.

-

Configuration

+

Configuration

  • call your odoo instance with the option --upgrade-path=/PATH_TO_openupgrade_scripts_MODULE/scripts/
  • @@ -405,7 +410,7 @@

    Configuration

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -413,9 +418,9 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -428,5 +433,6 @@

Maintainers

+