-
-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2789 from ForgeFlow/14.0-mig-hr
[14.0][MIG] hr
- Loading branch information
Showing
4 changed files
with
90 additions
and
9 deletions.
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
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
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,43 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def fill_hr_employee_company_id(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE hr_employee he | ||
SET company_id = COALESCE(hd.company_id, ru.company_id) | ||
FROM hr_employee he2 | ||
JOIN res_users ru ON ru.id = COALESCE(he2.create_uid, 1) | ||
LEFT JOIN hr_department hd ON hd.id = he2.department_id | ||
WHERE he.id = he2.id AND he.company_id is NULL | ||
""", | ||
) | ||
|
||
|
||
def update_new_private_admin_partner(env): | ||
private_partner = env.ref("hr.res_partner_admin_private_address") | ||
public_partner = env.ref("hr.employee_admin").address_home_id | ||
private_partner.update( | ||
{ | ||
"name": public_partner.name, | ||
"company_id": public_partner.company_id, | ||
"email": public_partner.email, | ||
"image_1920": public_partner.image_1920, | ||
} | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
fill_hr_employee_company_id(env) | ||
update_new_private_admin_partner(env) | ||
openupgrade.load_data(env.cr, "hr", "14.0.1.1/noupdate_changes.xml") | ||
openupgrade.delete_record_translations( | ||
env.cr, "hr", ["mail_template_data_unknown_employee_email_address"] | ||
) | ||
openupgrade.delete_records_safely_by_xml_id( | ||
env.cr, ["hr.mail_template_data_unknown_employee_email_address"] | ||
) |
38 changes: 38 additions & 0 deletions
38
openupgrade_scripts/scripts/hr/14.0.1.1/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,38 @@ | ||
---Models in module 'hr'--- | ||
---Fields in module 'hr'--- | ||
hr / hr.employee / address_id (many2one) : now a function | ||
hr / hr.employee / coach_id (many2one) : now a function | ||
hr / hr.employee / parent_id (many2one) : now a function | ||
hr / hr.employee / job_title (char) : now a function | ||
hr / hr.employee / work_phone (char) : now a function | ||
hr / hr.plan.activity.type / summary (char) : now a function | ||
# NOTHING TO DO: Converted to computed writable fields and the depends are not being changed (nor the dependency chain) | ||
|
||
hr / hr.employee / certificate (selection) : selection_keys is now '['bachelor', 'doctor', 'graduate', 'master', 'other']' ('['bachelor', 'master', 'other']') | ||
# NOTHING TO DO: Only extra values | ||
|
||
hr / hr.employee / company_id (many2one) : now required, req_default: function | ||
# DONE: post-migration: Filled with the most proper data those without company_id | ||
|
||
hr / hr.employee / departure_date (date) : NEW | ||
# NOTHING TO DO: New info field | ||
|
||
hr / res.users / barcode (char) : module is now 'base' ('hr') | ||
# NOTHING TO DO | ||
|
||
---XML records in module 'hr'--- | ||
NEW ir.actions.act_window: hr.hr_department_kanban_action | ||
NEW ir.actions.act_window: hr.hr_department_tree_action | ||
DEL ir.actions.act_window: hr.open_module_tree_department | ||
NEW ir.model.access: hr.access_hr_departure_wizard | ||
NEW ir.model.access: hr.access_hr_plan_wizard | ||
DEL ir.model.access: hr.access_ir_property_hr_user | ||
NEW ir.ui.menu: hr.menu_hr_department_kanban | ||
NEW ir.ui.view: hr.qunit_suite | ||
# NOTHING TO DO: noupdate=0 records | ||
|
||
DEL mail.template: hr.mail_template_data_unknown_employee_email_address (noupdate) | ||
# DONE: post-migration: deleted xmlid safely (and its translations) | ||
|
||
NEW res.partner: hr.res_partner_admin_private_address (noupdate) | ||
# DONE: post-migration: update this partner with actual admin data |