forked from tvtma/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [MIG] hr_timesheet: migrate 15 to 16 * Update openupgrade_scripts/scripts/hr_timesheet/16.0.1.0/upgrade_analysis_work.txt --------- Co-authored-by: Roy Le <[email protected]>
- Loading branch information
1 parent
0fbc58d
commit cdc0ea1
Showing
3 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
openupgrade_scripts/scripts/hr_timesheet/16.0.1.0/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def update_rename_field(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE hr_employee | ||
ADD COLUMN IF NOT EXISTS hourly_cost numeric | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE hr_employee | ||
SET hourly_cost = timesheet_cost | ||
""", | ||
) | ||
|
||
|
||
def create_ancestor_task_id(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE account_analytic_line | ||
ADD COLUMN IF NOT EXISTS ancestor_task_id integer | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE account_analytic_line AS aal | ||
SET ancestor_task_id = pt.ancestor_id | ||
FROM project_task AS pt | ||
WHERE pt.id = aal.task_id | ||
""", | ||
) | ||
|
||
|
||
def create_manager_id(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE account_analytic_line | ||
ADD COLUMN IF NOT EXISTS manager_id integer | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE account_analytic_line AS aal | ||
SET manager_id = he.parent_id | ||
FROM hr_employee AS he | ||
WHERE he.id = aal.employee_id | ||
""", | ||
) | ||
|
||
|
||
def delete_constraint_project_task_create_timesheet_time_positive(env): | ||
openupgrade.delete_sql_constraint_safely( | ||
env, | ||
"hr_timesheet", | ||
"project_task", | ||
"create_timesheet_time_positive", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
update_rename_field(env) | ||
create_ancestor_task_id(env) | ||
create_manager_id(env) | ||
delete_constraint_project_task_create_timesheet_time_positive(env) |
76 changes: 76 additions & 0 deletions
76
openupgrade_scripts/scripts/hr_timesheet/16.0.1.0/upgrade_analysis_work.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
---Models in module 'hr_timesheet'--- | ||
obsolete model project.task.create.timesheet [transient] | ||
new model timesheets.analysis.report [sql_view] | ||
|
||
# NOTHING TO DO | ||
|
||
---Fields in module 'hr_timesheet'--- | ||
hr_timesheet / account.analytic.line / ancestor_task_id (many2one) : NEW relation: project.task, isrelated: related, stored | ||
hr_timesheet / account.analytic.line / manager_id (many2one) : NEW relation: hr.employee, isrelated: related, stored | ||
|
||
# DONE: create column and load data in pre-migration | ||
|
||
hr_timesheet / account.analytic.line / partner_id (False) : module is now 'account' ('hr_timesheet') | ||
hr_timesheet / hr.employee / currency_id (many2one) : module is now 'hr_hourly_cost' ('hr_timesheet') | ||
|
||
# NOTHING TO DO | ||
|
||
hr_timesheet / hr.employee / timesheet_cost (float) : DEL | ||
|
||
# DONE: changed to hourly_cost field in pre-migration | ||
|
||
hr_timesheet / project.project / allocated_hours (float) : NEW | ||
|
||
# NOTHING TO DO: remove in master | ||
|
||
hr_timesheet / project.project / timesheet_count (boolean) : type is now 'integer' ('boolean') | ||
|
||
# NOTHING TO DO: field store = False | ||
|
||
---XML records in module 'hr_timesheet'--- | ||
NEW ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_line_by_project_view_form | ||
NEW ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_line_by_project_view_graph | ||
NEW ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_line_by_project_view_kanban | ||
NEW ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_line_by_project_view_pivot | ||
NEW ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_line_by_project_view_tree | ||
DEL ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_report_form | ||
DEL ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_report_kanban | ||
DEL ir.actions.act_window.view: hr_timesheet.act_hr_timesheet_report_tree | ||
DEL ir.actions.act_window.view: hr_timesheet.timesheet_action_view_report_by_project_form | ||
DEL ir.actions.act_window.view: hr_timesheet.timesheet_action_view_report_by_project_kanban | ||
DEL ir.actions.act_window.view: hr_timesheet.timesheet_action_view_report_by_project_tree | ||
DEL ir.actions.act_window.view: hr_timesheet.timesheet_action_view_report_by_task_form | ||
DEL ir.actions.act_window.view: hr_timesheet.timesheet_action_view_report_by_task_kanban | ||
DEL ir.actions.act_window.view: hr_timesheet.timesheet_action_view_report_by_task_tree | ||
NEW ir.actions.report: hr_timesheet.timesheet_report_task_timesheets | ||
NEW ir.model.access: hr_timesheet.access_timesheets_analysis_report_manager | ||
NEW ir.model.access: hr_timesheet.access_timesheets_analysis_report_user | ||
DEL ir.model.access: hr_timesheet.access_project_task_create_timesheet | ||
|
||
# NOTHING TO DO | ||
|
||
DEL ir.model.constraint: hr_timesheet.constraint_project_task_create_timesheet_time_positive | ||
|
||
# DONE : delete safely in pre-migration | ||
|
||
NEW ir.rule: hr_timesheet.timesheets_analysis_report_comp_rule (noupdate) | ||
NEW ir.ui.view: hr_timesheet.hr_timesheet_report_search | ||
NEW ir.ui.view: hr_timesheet.project_project_view_tree_inherit_sale_project | ||
NEW ir.ui.view: hr_timesheet.project_sharing_project_task_view_search_inherit_timesheet | ||
NEW ir.ui.view: hr_timesheet.project_update_view_search_inherit | ||
NEW ir.ui.view: hr_timesheet.rating_rating_view_search_project_inherited | ||
NEW ir.ui.view: hr_timesheet.report_timesheet_task | ||
NEW ir.ui.view: hr_timesheet.timesheet_project_task_page | ||
NEW ir.ui.view: hr_timesheet.timesheets_analysis_report_graph_employee | ||
NEW ir.ui.view: hr_timesheet.timesheets_analysis_report_graph_project | ||
NEW ir.ui.view: hr_timesheet.timesheets_analysis_report_graph_task | ||
NEW ir.ui.view: hr_timesheet.timesheets_analysis_report_pivot_employee | ||
NEW ir.ui.view: hr_timesheet.timesheets_analysis_report_pivot_project | ||
NEW ir.ui.view: hr_timesheet.timesheets_analysis_report_pivot_task | ||
NEW ir.ui.view: hr_timesheet.view_hr_timesheet_line_graph_by_employee | ||
NEW ir.ui.view: hr_timesheet.view_project_project_filter_inherit_timesheet | ||
NEW ir.ui.view: hr_timesheet.view_task_search_form_hr_extended | ||
DEL ir.ui.view: hr_timesheet.project_sharing_inherit_project_task_view_search | ||
DEL ir.ui.view: hr_timesheet.project_task_create_timesheet_view_form | ||
|
||
# NOTHING TO DO |