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

[13.0][MIG] fleet #2283

Merged
merged 1 commit into from
Apr 19, 2020
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
87 changes: 87 additions & 0 deletions addons/fleet/migrations/13.0.0.1/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---Models in module 'fleet'---
---Fields in module 'fleet'---
fleet / fleet.vehicle / future_driver_id (many2one) : NEW relation: res.partner
fleet / fleet.vehicle / net_car_value (float) : NEW
fleet / fleet.vehicle / next_assignation_date (date) : NEW
fleet / fleet.vehicle / plan_to_change_car (boolean) : NEW isrelated: related, stored
# NOTHING TO DO: New features

fleet / fleet.vehicle.cost / company_id (many2one) : NEW relation: res.company, hasdefault
Yasaie marked this conversation as resolved.
Show resolved Hide resolved
# DONE: Post-migration: Filled with vehicle company_id

fleet / fleet.vehicle.model / manager_id (many2one) : NEW relation: res.users, hasdefault
Yasaie marked this conversation as resolved.
Show resolved Hide resolved
# DONE: Pre-migration: Pre created field to avoid uid=1 default value

fleet / res.partner / plan_to_change_car (boolean) : NEW hasdefault

fleet / fleet.vehicle.model.brand / image (binary) : DEL attachment: True
fleet / fleet.vehicle.model.brand / image_128 (binary) : NEW attachment: True
fleet / fleet.vehicle.model.brand / image_medium (binary) : DEL attachment: True
fleet / fleet.vehicle.model.brand / image_small (binary) : DEL attachment: True
# DONE: Pre-migration

---XML records in module 'fleet'---
NEW fleet.vehicle.model: fleet.model_a1
NEW fleet.vehicle.model: fleet.model_a3
NEW fleet.vehicle.model: fleet.model_a4
NEW fleet.vehicle.model: fleet.model_a5
NEW fleet.vehicle.model: fleet.model_a6
NEW fleet.vehicle.model: fleet.model_a7
NEW fleet.vehicle.model: fleet.model_a8
NEW fleet.vehicle.model: fleet.model_agila
NEW fleet.vehicle.model: fleet.model_ampera
NEW fleet.vehicle.model: fleet.model_antara
NEW fleet.vehicle.model: fleet.model_astra
NEW fleet.vehicle.model: fleet.model_astragtc
NEW fleet.vehicle.model: fleet.model_classa
NEW fleet.vehicle.model: fleet.model_classb
NEW fleet.vehicle.model: fleet.model_classc
NEW fleet.vehicle.model: fleet.model_classcl
NEW fleet.vehicle.model: fleet.model_classcls
NEW fleet.vehicle.model: fleet.model_classe
NEW fleet.vehicle.model: fleet.model_classgl
NEW fleet.vehicle.model: fleet.model_classglk
NEW fleet.vehicle.model: fleet.model_classm
NEW fleet.vehicle.model: fleet.model_classr
NEW fleet.vehicle.model: fleet.model_classs
NEW fleet.vehicle.model: fleet.model_classslk
NEW fleet.vehicle.model: fleet.model_classsls
NEW fleet.vehicle.model: fleet.model_combotour
NEW fleet.vehicle.model: fleet.model_corsa
NEW fleet.vehicle.model: fleet.model_insignia
NEW fleet.vehicle.model: fleet.model_meriva
NEW fleet.vehicle.model: fleet.model_mokka
NEW fleet.vehicle.model: fleet.model_q3
NEW fleet.vehicle.model: fleet.model_q5
NEW fleet.vehicle.model: fleet.model_q7
NEW fleet.vehicle.model: fleet.model_serie1
NEW fleet.vehicle.model: fleet.model_serie3
NEW fleet.vehicle.model: fleet.model_serie5
NEW fleet.vehicle.model: fleet.model_serie6
NEW fleet.vehicle.model: fleet.model_serie7
NEW fleet.vehicle.model: fleet.model_seriehybrid
NEW fleet.vehicle.model: fleet.model_seriem
NEW fleet.vehicle.model: fleet.model_seriex
NEW fleet.vehicle.model: fleet.model_seriez4
NEW fleet.vehicle.model: fleet.model_tt
NEW fleet.vehicle.model: fleet.model_zafira
NEW fleet.vehicle.model: fleet.model_zafiratourer
# NOTHING TO DO: New records

NEW fleet.vehicle.model.brand: fleet.brand_corre_la_licorne
DEL fleet.vehicle.model.brand: fleet.brand_corre la licorne
NEW fleet.vehicle.model.brand: fleet.brand_land_rover
DEL fleet.vehicle.model.brand: fleet.brand_land rover
NEW fleet.vehicle.model.brand: fleet.brand_tesla_motors
DEL fleet.vehicle.model.brand: fleet.brand_tesla motors
NEW ir.actions.act_window: fleet.fleet_config_settings_action [renamed from l10n_be_hr_payroll_fleet module]
NEW ir.ui.menu: fleet.fleet_config_settings_menu [renamed from l10n_be_hr_payroll_fleet module]
# DONE: Pre-migration (renamed)
Yasaie marked this conversation as resolved.
Show resolved Hide resolved

NEW ir.rule: fleet.ir_rule_fleet_vehicle (noupdate)
NEW ir.ui.view: fleet.fleet_vehicle_log_contract_view_activity
NEW ir.ui.view: fleet.fleet_vehicle_model_view_kanban
NEW ir.ui.view: fleet.fleet_vehicle_tag_view_view_tree
NEW ir.ui.view: fleet.fleet_vehicle_view_activity
NEW ir.ui.view: fleet.res_config_settings_view_form
# NOTHING TO DO: New records
20 changes: 20 additions & 0 deletions addons/fleet/migrations/13.0.0.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 Payam Yasaie <https://www.tashilgostar.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


def fill_fleet_vehicle_cost_company_id(cr):
openupgrade.logged_query(
cr, """
UPDATE fleet_vehicle_cost fvc
SET company_id = fv.company_id
FROM fleet_vehicle fv
WHERE fvc.vehicle_id = fv.id
"""
)


@openupgrade.migrate()
def migrate(env, version):
fill_fleet_vehicle_cost_company_id(env.cr)
openupgrade.load_data(env.cr, 'fleet', 'migrations/13.0.0.1/noupdate_changes.xml')
38 changes: 38 additions & 0 deletions addons/fleet/migrations/13.0.0.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2020 Payam Yasaie <https://www.tashilgostar.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade

_xmlid_renames = [
# fleet.vehicle.model.brand
('fleet.brand_corre la licorne', 'fleet.brand_corre_la_licorne'),
('fleet.brand_land rover', 'fleet.brand_land_rover'),
('fleet.brand_tesla motors', 'fleet.brand_tesla_motors'),
# ir.actions.act_window
('l10n_be_hr_payroll_fleet.fleet_config_settings_action', 'fleet.fleet_config_settings_action'),
# ir.ui.menu
('l10n_be_hr_payroll_fleet.fleet_config_settings_action', 'fleet.fleet_config_settings_action'),
]

_field_renames = [
('fleet.vehicle.model.brand', 'fleet_vehicle_model_brand', 'image_medium', 'image_128'),
]

_field_adds = [
("manager_id", "fleet.vehicle.model", "fleet_vehicle_model", "many2one", False, "fleet"),
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_xmlids(env.cr, _xmlid_renames)
openupgrade.rename_fields(env, _field_renames)
openupgrade.add_fields(env, _field_adds)
# Fix image of fleet.vehicle.model.brand after renaming column to image_128
openupgrade.logged_query(
env.cr,
"""
UPDATE ir_attachment
SET res_field = 'image_128'
WHERE res_field = 'image_medium' and res_model = 'fleet.vehicle.model.brand'
""",
)
2 changes: 1 addition & 1 deletion odoo/openupgrade/doc/source/modules120-130.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ missing in the new release are marked with |del|.
+----------------------------------------------+-------------------------------------------------+
|fetchmail | Done |
+----------------------------------------------+-------------------------------------------------+
|fleet | |
|fleet | Done |
+----------------------------------------------+-------------------------------------------------+
|gamification | |
+----------------------------------------------+-------------------------------------------------+
Expand Down