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

[17.0][OU-ADD] fleet: Migration scripts #4666

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
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/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
Loading