Skip to content

Commit

Permalink
Merge PR #4113 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Sep 2, 2023
2 parents 5029819 + 4e3599f commit 8cedbd1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openupgrade_scripts/apriori.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"account_move_force_removal": "account",
# OCA/account-invoice-reporting
"account_invoice_report_due_list": "account",
# OCA/e-commerce
"website_sale_require_login": "website_sale",
# OCA/purchase-workflow
"product_form_purchase_link": "purchase",
}
Expand Down
27 changes: 27 additions & 0 deletions openupgrade_scripts/scripts/base/16.0.1.3/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@
_logger = logging.getLogger(__name__)


def login_or_registration_required_at_checkout(cr):
""" website_sale_require_login merged into website_sale. Check if the
website_sale_require_login module was installed in v15 to set the
website.account_on_checkout field as mandatory so that the functionality
remains the same, login/registration required for checkout. """
# Check if the module is installed and its status is "installed".
module_name = "website_sale_require_login"
if openupgrade.is_module_installed(cr, module_name):
# Add the field 'account_on_checkout' to the 'website' table if it doesn't exist yet.
openupgrade.logged_query(
cr,
"""
ALTER TABLE website
ADD COLUMN IF NOT EXISTS account_on_checkout
""",
)
# Set the value 'mandatory' in the field for all records in the table 'website'.
openupgrade.logged_query(
cr,
"""
UPDATE website
SET account_on_checkout = 'mandatory'
""",
)


def update_translatable_fields(cr):
# map of nonstandard table names
model2table = {
Expand Down Expand Up @@ -102,6 +128,7 @@ def migrate(cr, version):
"recommended to run the Odoo with --load=openupgrade_framework "
"when migrating your database."
)
login_or_registration_required_at_checkout(cr)
openupgrade.update_module_names(cr, renamed_modules.items())
openupgrade.update_module_names(cr, merged_modules.items(), merge_modules=True)
# restricting inherited views to groups isn't allowed any more
Expand Down

0 comments on commit 8cedbd1

Please sign in to comment.