From 46715e72e874fe00458d9bb9e257a446d3fc1c57 Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Wed, 14 Dec 2022 14:06:05 +0100 Subject: [PATCH] [MIG] website_sale_stock_available_display: Migration to 15.0 --- openupgrade_scripts/apriori.py | 2 ++ .../15.0.1.0/post-migration.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openupgrade_scripts/apriori.py b/openupgrade_scripts/apriori.py index 70048176dd09..8e6f65626e1d 100644 --- a/openupgrade_scripts/apriori.py +++ b/openupgrade_scripts/apriori.py @@ -52,6 +52,8 @@ "website_sale_cart_no_redirect": "website_sale", # OCA/hr "hr_recruitment_notification": "hr_recruitment", + # OCA/e-commerce + "website_sale_stock_available_display": "website_sale_stock", # OCA/hr-attendance "hr_attendance_user_list": "hr_attendance", # OCA/product-attribute diff --git a/openupgrade_scripts/scripts/website_sale_stock/15.0.1.0/post-migration.py b/openupgrade_scripts/scripts/website_sale_stock/15.0.1.0/post-migration.py index 782fcc3758dd..125289c2a512 100644 --- a/openupgrade_scripts/scripts/website_sale_stock/15.0.1.0/post-migration.py +++ b/openupgrade_scripts/scripts/website_sale_stock/15.0.1.0/post-migration.py @@ -7,11 +7,15 @@ def migrate(env, version): env.cr, """UPDATE product_template SET allow_out_of_stock_order = CASE - WHEN inventory_availability IN ('never', 'custom') - THEN true ELSE false END, show_availability = CASE - WHEN inventory_availability IN ('always', 'threshold') - THEN true ELSE false END, - available_threshold = CASE WHEN inventory_availability = 'always' - THEN 999999999 END + WHEN inventory_availability IN ('never', 'custom', 'always_no_lock') + THEN true ELSE false END, + show_availability = CASE + WHEN inventory_availability IN ('always', 'threshold', 'always_no_lock') + THEN true ELSE false END, + available_threshold = CASE + WHEN inventory_availability IN ('always', 'always_no_lock') + THEN 999999999 END, + out_of_stock_message = CASE + WHEN inventory_availability = 'always_no_lock' THEN '0 Stock' END """, )