Skip to content

Commit

Permalink
[OU-ADD] repair: Migration scripts for v16
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-filament committed Feb 14, 2024
1 parent 0cf87c6 commit e8f1479
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
14 changes: 14 additions & 0 deletions openupgrade_scripts/scripts/repair/16.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Le Filament
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade

def _compute_repair_price_total(env, model):
fees = env[model].search([])
fees._compute_price_total_and_subtotal()

@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env.cr, "resource", "16.0.1.0/noupdate_changes.xml")
_compute_repair_price_total(env, "repair.fee")
_compute_repair_price_total(env, "repair.line")
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---Models in module 'repair'---
---Fields in module 'repair'---
repair / repair.fee / price_total (float) : is now stored
repair / repair.line / price_total (float) : is now stored
# DONE: recomputed in post_migration

repair / repair.line / lot_id (many2one) : relation is now 'stock.lot' ('stock.production.lot') [nothing to do]
repair / repair.order / lot_id (many2one) : relation is now 'stock.lot' ('stock.production.lot') [nothing to do]
# NOTHING TO DO: renaming done in stock

repair / repair.order / location_id (many2one) : now a function
repair / repair.order / product_uom (many2one) : now a function
# NOTHING TO DO: field already existed (was a onchange)

repair / repair.order / picking_id (many2one) : NEW relation: stock.picking
repair / stock.picking / repair_ids (one2many) : NEW relation: repair.order
# NOTHING TO DO: new relation

repair / stock.picking.type / is_repairable (boolean) : NEW hasdefault: compute
repair / stock.picking.type / return_type_of_ids (one2many) : NEW relation: stock.picking.type
# NOTHING TO DO: new fields

---XML records in module 'repair'---
NEW ir.ui.view: repair.repair_view_picking_form
NEW ir.ui.view: repair.repair_view_picking_type_form
# NOTHING TO DO

0 comments on commit e8f1479

Please sign in to comment.