Skip to content

Commit

Permalink
[OU-ADD] fleet: Migration scripts
Browse files Browse the repository at this point in the history
TT49301
  • Loading branch information
victoralmau committed Nov 18, 2024
1 parent 12e94d8 commit 55d900d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docsource/modules160-170.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Module coverage 16.0 -> 17.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| event_sms | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| fleet | | |
| fleet | Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| gamification | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
20 changes: 20 additions & 0 deletions openupgrade_scripts/scripts/fleet/17.0.0.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE fleet_vehicle_model_brand
ADD COLUMN IF NOT EXISTS active BOOLEAN
""",
)
openupgrade.logged_query(
env.cr,
"""UPDATE fleet_vehicle_model_brand
SET active = True
""",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---Models in module 'fleet'---
---Fields in module 'fleet'---
fleet / fleet.vehicle / activity_user_id (many2one) : not related anymore
fleet / fleet.vehicle / activity_user_id (many2one) : now a function
fleet / fleet.vehicle / image_1024 (binary) : NEW attachment: True, isrelated: related, stored
fleet / fleet.vehicle / image_128 (binary) : is now stored
fleet / fleet.vehicle / image_1920 (binary) : NEW attachment: True
fleet / fleet.vehicle / image_256 (binary) : NEW attachment: True, isrelated: related, stored
fleet / fleet.vehicle / image_512 (binary) : NEW attachment: True, isrelated: related, stored
fleet / fleet.vehicle / message_main_attachment_id (many2one): DEL relation: ir.attachment
fleet / fleet.vehicle / order_date (date) : NEW
fleet / fleet.vehicle / vehicle_properties (properties): NEW hasdefault: compute
# NOTHING TO DO
fleet / fleet.vehicle.log.contract / activity_user_id (many2one) : not related anymore
fleet / fleet.vehicle.log.contract / activity_user_id (many2one) : now a function
fleet / fleet.vehicle.log.contract / message_main_attachment_id (many2one): DEL relation: ir.attachment
fleet / fleet.vehicle.log.services / activity_user_id (many2one) : not related anymore
fleet / fleet.vehicle.log.services / activity_user_id (many2one) : now a function
fleet / fleet.vehicle.log.services / message_main_attachment_id (many2one): DEL relation: ir.attachment
# NOTHING TO DO
fleet / fleet.vehicle.model / image_1024 (binary) : NEW attachment: True, isrelated: related, stored
fleet / fleet.vehicle.model / image_128 (binary) : is now stored
fleet / fleet.vehicle.model / image_1920 (binary) : NEW attachment: True
fleet / fleet.vehicle.model / image_256 (binary) : NEW attachment: True, isrelated: related, stored
fleet / fleet.vehicle.model / image_512 (binary) : NEW attachment: True, isrelated: related, stored
fleet / fleet.vehicle.model / vehicle_properties_definition (properties_definition): NEW
# NOTHING TO DO
fleet / fleet.vehicle.model.brand / active (boolean) : NEW hasdefault: default
# DONE: Create the column and set the default value in pre-migration
---XML records in module 'fleet'---
NEW fleet.service.type: fleet.type_contract_leasing (noupdate)
NEW fleet.service.type: fleet.type_contract_omnium (noupdate)
NEW ir.ui.view: fleet.fleet_vechicle_costs_report_view_form

0 comments on commit 55d900d

Please sign in to comment.