diff --git a/docsource/modules150-160.rst b/docsource/modules150-160.rst index 20d035409bb0..110afa66d924 100644 --- a/docsource/modules150-160.rst +++ b/docsource/modules150-160.rst @@ -172,7 +172,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | hr_expense | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| hr_fleet | | | +| hr_fleet | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | hr_gamification | |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/hr_fleet/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/hr_fleet/16.0.1.0/pre-migration.py new file mode 100644 index 000000000000..9fd5ae7b5340 --- /dev/null +++ b/openupgrade_scripts/scripts/hr_fleet/16.0.1.0/pre-migration.py @@ -0,0 +1,26 @@ +from openupgradelib import openupgrade + + +def create_drive_employee(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE fleet_vehicle_assignation_log + ADD IF NOT EXISTS driver_employee_id INT + """, + ) + + openupgrade.logged_query( + env.cr, + """ + UPDATE fleet_vehicle_assignation_log log + SET driver_employee_id = emp.id + FROM hr_employee emp + WHERE log.driver_id IS NOT NULL and log.driver_id = emp.address_home_id + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + create_drive_employee(env) diff --git a/openupgrade_scripts/scripts/hr_fleet/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/hr_fleet/16.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..e8dabfd7731f --- /dev/null +++ b/openupgrade_scripts/scripts/hr_fleet/16.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,13 @@ +---Models in module 'hr_fleet'--- +---Fields in module 'hr_fleet'--- +hr_fleet / fleet.vehicle.assignation.log / driver_employee_id (many2one) : is now stored +hr_fleet / fleet.vehicle.assignation.log / driver_employee_id (many2one) : not related anymore + +# DONE: fill data from old related field for now store current compute field in pre-migration + +---XML records in module 'hr_fleet'--- +NEW ir.ui.view: hr_fleet.fleet_vehicle_assignation_log_employee_view_list +NEW ir.ui.view: hr_fleet.fleet_vehicle_view_tree_inherit_hr +NEW ir.ui.view: hr_fleet.view_attachment_kanban_inherit_hr + +# NOTHING TO DO \ No newline at end of file