-
-
Notifications
You must be signed in to change notification settings - Fork 697
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 #3518 from ForgeFlow/v15_mig_purchase_odoo
[15.0][MIG] purchase: add mig script
- Loading branch information
Showing
5 changed files
with
103 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
14 changes: 14 additions & 0 deletions
14
openupgrade_scripts/scripts/purchase/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,14 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
all_purchase_order_lines = env["purchase.order.line"].search( | ||
[ | ||
("product_packaging_id", "!=", False), | ||
("state", "in", ["draft", "sent", "to approve"]), | ||
] | ||
) | ||
for line in all_purchase_order_lines: | ||
line._onchange_suggest_packaging() | ||
line._onchange_update_product_packaging_qty() |
22 changes: 22 additions & 0 deletions
22
openupgrade_scripts/scripts/purchase/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,22 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.convert_field_to_html( | ||
env.cr, | ||
"purchase_order", | ||
openupgrade.get_legacy_name("notes"), | ||
"notes", | ||
verbose=False, | ||
) | ||
openupgrade.load_data(env.cr, "purchase", "15.0.1.2/noupdate_changes.xml") | ||
openupgrade.delete_record_translations( | ||
env.cr, | ||
"purchase", | ||
[ | ||
"email_template_edi_purchase", | ||
"email_template_edi_purchase_done", | ||
"email_template_edi_purchase_reminder", | ||
], | ||
) |
35 changes: 35 additions & 0 deletions
35
openupgrade_scripts/scripts/purchase/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,35 @@ | ||
from openupgradelib import openupgrade | ||
|
||
_columns_copy = { | ||
"purchase_order": [ | ||
("notes", None, None), | ||
], | ||
} | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.copy_columns(env.cr, _columns_copy) | ||
openupgrade.set_xml_ids_noupdate_value( | ||
env, | ||
"purchase", | ||
[ | ||
"track_po_line_qty_received_template", | ||
"track_po_line_template", | ||
], | ||
True, | ||
) | ||
openupgrade.add_fields( | ||
env, | ||
[ | ||
( | ||
"purchase", | ||
"product.packaging", | ||
"product_packaging", | ||
"boolean", | ||
"bool", | ||
"purchase", | ||
True, | ||
) | ||
], | ||
) |
31 changes: 31 additions & 0 deletions
31
openupgrade_scripts/scripts/purchase/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,31 @@ | ||
---Models in module 'purchase'--- | ||
---Fields in module 'purchase'--- | ||
purchase / product.packaging / purchase (boolean) : NEW hasdefault | ||
# DONE: pre-migration: fast filled with True value | ||
|
||
purchase / purchase.order / notes (text) : type is now 'html' ('text') | ||
# DONE: post-migration: convert plaintext to html | ||
|
||
purchase / purchase.order.line / product_packaging_id (many2one): NEW relation: product.packaging | ||
purchase / purchase.order.line / product_packaging_qty (float) : NEW | ||
# DONE: end-migration: filled product_packaging_id | ||
|
||
---XML records in module 'purchase'--- | ||
NEW ir.actions.act_window: purchase.action_accrued_expense_entry | ||
NEW ir.ui.menu: purchase.purchase_report_main | ||
NEW ir.ui.view: purchase.account_analytic_account_view_form_purchase | ||
NEW ir.ui.view: purchase.portal_my_purchase_rfqs | ||
NEW ir.ui.view: purchase.product_packaging_form_view_purchase | ||
NEW ir.ui.view: purchase.product_packaging_tree_view_purchase | ||
NEW ir.ui.view: purchase.purchase_order_portal_content | ||
NEW ir.ui.view: purchase.purchase_order_portal_content_totals_table | ||
NEW ir.ui.view: purchase.purchase_report_view_tree | ||
# NOTHING TO DO | ||
|
||
ir.ui.view: purchase.track_po_line_qty_received_template (noupdate) (noupdate switched) | ||
ir.ui.view: purchase.track_po_line_template (noupdate) (noupdate switched) | ||
# DONE: pre-migration: change noupdate to "1" | ||
|
||
DEL ir.ui.view: purchase.assets_backend | ||
DEL ir.ui.view: purchase.assets_frontend | ||
# NOTHING TO DO |