-
-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] website_sale_stock: Migration scripts to v15
- Loading branch information
1 parent
69a4730
commit ab225f3
Showing
4 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
openupgrade_scripts/scripts/website_sale_stock/15.0.1.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.logged_query( | ||
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 | ||
""", | ||
) |
19 changes: 19 additions & 0 deletions
19
openupgrade_scripts/scripts/website_sale_stock/15.0.1.0/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.convert_field_to_html( | ||
env.cr, "product_template", "custom_message", "custom_message" | ||
) | ||
openupgrade.rename_fields( | ||
env, | ||
[ | ||
( | ||
"product.template", | ||
"product_template", | ||
"custom_message", | ||
"out_of_stock_message", | ||
), | ||
], | ||
) |
18 changes: 18 additions & 0 deletions
18
openupgrade_scripts/scripts/website_sale_stock/15.0.1.0/upgrade_analysis_work.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
---Models in module 'website_sale_stock'--- | ||
---Fields in module 'website_sale_stock'--- | ||
website_sale_stock / product.template / allow_out_of_stock_order (boolean): NEW hasdefault | ||
# DONE: set allow_out_of_stock_order as True if inventory_availability = never | ||
|
||
website_sale_stock / product.template / show_availability (boolean) : NEW hasdefault | ||
# DONE: pre-migration: set show_availability as True if inventory_availability = threshold | ||
|
||
website_sale_stock / product.template / custom_message (text) : DEL | ||
website_sale_stock / product.template / out_of_stock_message (html) : NEW | ||
# DONE: pre-migration: convert text to html, renamed fields | ||
|
||
website_sale_stock / product.template / inventory_availability (selection): DEL selection_keys: ['always', 'custom', 'never', 'threshold'] | ||
# NOTHING TO DO | ||
|
||
---XML records in module 'website_sale_stock'--- | ||
DEL ir.ui.view: website_sale_stock.assets_frontend | ||
# NOTHING TO DO |