Skip to content

Commit

Permalink
[MIG] website_sale_stock: Migration scripts to v15
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-teruel committed Feb 22, 2023
1 parent 69a4730 commit ab225f3
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docsource/modules140-150.rst
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ Module coverage 14.0 -> 15.0
+-------------------------------------------------+----------------------+-------------------------------------------------+
| website_sale_slides | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| website_sale_stock | | |
| website_sale_stock |Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| website_sale_stock_product_configurator | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
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
""",
)
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",
),
],
)
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

0 comments on commit ab225f3

Please sign in to comment.