Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][OU-ADD] repair: Migration scripts #2997

Merged
merged 2 commits into from
Mar 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules130-140.rst
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ Module coverage 13.0 -> 14.0
+--------------------------------------------+-------------------------------------------------+
|rating | Done |
+--------------------------------------------+-------------------------------------------------+
|repair | |
|repair | Done |
+--------------------------------------------+-------------------------------------------------+
|resource | Nothing to do |
+--------------------------------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
<record id="seq_repair" model="ir.sequence">
<field name="company_id" eval="False"/>
</record>
<!-- manually added: -->
<record id="repair_order_rule" model="ir.rule">
<field name="domain_force">[('company_id', 'in', company_ids)]</field>
<field name="name">repair order multi-company</field>
</record>
</odoo>
13 changes: 13 additions & 0 deletions openupgrade_scripts/scripts/repair/14.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (C) 2021 Open Source Integrators
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
# Load noupdate changes
openupgrade.load_data(env.cr, "repair", "14.0.1.0/noupdate_changes.xml")
openupgrade.delete_record_translations(
env.cr, "repair", ["mail_template_repair_quotation"]
)
12 changes: 12 additions & 0 deletions openupgrade_scripts/scripts/repair/14.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade

_xmlid_renames = [
("repair.repair_rule", "repair.repair_order_rule"),
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_xmlids(env.cr, _xmlid_renames)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---Models in module 'repair'---
obsolete model repair.cancel [transient]
# NOTHING TO DO

---Fields in module 'repair'---
repair / repair.line / repair_id (many2one) : now required
repair / repair.order / company_id (many2one) : now required, req_default: function
# NOTHING TO DO: Already filled for all records that came regularly by Odoo UI

repair / repair.fee / company_id (many2one) : NEW relation: res.company, isrelated: related, stored
repair / repair.line / company_id (many2one) : NEW relation: res.company, isrelated: related, stored
# NOTHING TO DO: Filled by ORM

---XML records in module 'repair'---
DEL ir.actions.act_window: repair.action_cancel_repair
NEW ir.model.access: repair.access_repair_order_make_invoice
NEW ir.model.access: repair.access_stock_warn_insufficient_qty_repair
DEL ir.ui.view: repair.view_cancel_repair
# NOTHING TO DO: noupdate=0 ir records

NEW ir.rule: repair.repair_order_rule (noupdate)
DEL ir.rule: repair.repair_rule (noupdate)
# DONE: pre-migration: renamed xmlid

NEW ir.rule: repair.repair_fee_rule (noupdate)
NEW ir.rule: repair.repair_line_rule (noupdate)
# NOTHING TO DO: New records