-
-
Notifications
You must be signed in to change notification settings - Fork 705
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3516 from ForgeFlow/v15_mig_sale_1
[15.0][MIG] sale: migration script
- Loading branch information
Showing
5 changed files
with
100 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
11 changes: 11 additions & 0 deletions
11
openupgrade_scripts/scripts/sale/15.0.1.2/end-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,11 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
all_sale_order_lines = env["sale.order.line"].search( | ||
[("product_packaging_id", "!=", False), ("state", "in", ["draft", "sent"])] | ||
) | ||
for line in all_sale_order_lines: | ||
line._onchange_suggest_packaging() | ||
line._onchange_update_product_packaging_qty() |
17 changes: 17 additions & 0 deletions
17
openupgrade_scripts/scripts/sale/15.0.1.2/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.convert_field_to_html( | ||
env.cr, "sale_order", openupgrade.get_legacy_name("note"), "note", verbose=False | ||
) | ||
openupgrade.load_data(env.cr, "sale", "15.0.1.2/noupdate_changes.xml") | ||
openupgrade.delete_record_translations( | ||
env.cr, | ||
"sale", | ||
[ | ||
"email_template_edi_sale", | ||
"mail_template_sale_confirmation", | ||
], | ||
) |
38 changes: 38 additions & 0 deletions
38
openupgrade_scripts/scripts/sale/15.0.1.2/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,38 @@ | ||
from openupgradelib import openupgrade | ||
|
||
_columns_copy = { | ||
"sale_order": [ | ||
("note", None, None), | ||
], | ||
} | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.copy_columns(env.cr, _columns_copy) | ||
if openupgrade.column_exists(env.cr, "sale_order_line", "product_packaging"): | ||
openupgrade.rename_fields( | ||
env, | ||
[ | ||
( | ||
"sale.order.line", | ||
"sale_order_line", | ||
"product_packaging", | ||
"product_packaging_id", | ||
) | ||
], | ||
) | ||
openupgrade.add_fields( | ||
env, | ||
[ | ||
( | ||
"sales", | ||
"product.packaging", | ||
"product_packaging", | ||
"boolean", | ||
"bool", | ||
"sale", | ||
True, | ||
) | ||
], | ||
) |
33 changes: 33 additions & 0 deletions
33
openupgrade_scripts/scripts/sale/15.0.1.2/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,33 @@ | ||
---Models in module 'sale'--- | ||
---Fields in module 'sale'--- | ||
sale / product.packaging / sales (boolean) : NEW hasdefault | ||
# DONE: pre-migration: fast filled with True value | ||
|
||
sale / sale.order / note (text) : type is now 'html' ('text') | ||
# DONE: post-migration: convert text to html | ||
|
||
sale / sale.order.line / product_packaging_id (many2one): NEW relation: product.packaging, hasdefault | ||
sale / sale.order.line / product_packaging_qty (float) : NEW | ||
# DONE: pre-migration: renamed from product_packaging (from sale_stock) | ||
# DONE: end-migration: filled product_packaging_id | ||
|
||
---XML records in module 'sale'--- | ||
NEW ir.actions.act_window: sale.action_accrued_revenue_entry | ||
NEW ir.actions.act_window: sale.action_sale_order_form_view | ||
NEW ir.cron: sale.send_invoice_cron (noupdate) | ||
DEL ir.model.access: sale.access_product_group_res_partner_sale_manager | ||
NEW ir.ui.view: sale.account_invoice_report_view_tree | ||
NEW ir.ui.view: sale.badge_extra_price | ||
NEW ir.ui.view: sale.crm_team_view_kanban_dashboard | ||
NEW ir.ui.view: sale.payment_checkout_inherit | ||
NEW ir.ui.view: sale.payment_manage_inherit | ||
NEW ir.ui.view: sale.product_packaging_form_view_sale | ||
NEW ir.ui.view: sale.product_packaging_tree_view_sale | ||
NEW ir.ui.view: sale.sale_report_view_tree | ||
DEL ir.ui.view: sale.assets_backend_inherit_sale | ||
DEL ir.ui.view: sale.assets_frontend_inherit_sale | ||
DEL ir.ui.view: sale.assets_tests | ||
DEL ir.ui.view: sale.crm_team_salesteams_view_kanban | ||
DEL ir.ui.view: sale.qunit_suite | ||
DEL ir.ui.view: sale.report_assets_common_inherit_sale | ||
# NOTHING TO DO: noupdate="0" records |