forked from tvtma/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] hr: finish hr migration 17 (#641)
* [MIG] hr: finish hr migration 17 * Update post-migration.py --------- Co-authored-by: Roy Le <[email protected]>
- Loading branch information
1 parent
3d52787
commit 3622408
Showing
5 changed files
with
185 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def _merge_employee_contact(env): | ||
""" | ||
Performing merge 'address_home_id' into 'work_contact_id' | ||
""" | ||
partner_merge_wizard = env["base.partner.merge.automatic.wizard"] | ||
partner = env["res.partner"] | ||
env.cr.execute( | ||
""" | ||
SELECT address_home_id, work_contact_id | ||
FROM hr_employee | ||
""" | ||
) | ||
for address_home_id, work_contact_id in env.cr.fetchall(): | ||
partner_merge_wizard._merge( | ||
[address_home_id, work_contact_id], partner.browse(work_contact_id) | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
_merge_employee_contact(env) |
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