-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] joint_buying_base : Add company code in the name of the partner
- Loading branch information
1 parent
28f6e4c
commit e331459
Showing
3 changed files
with
25 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import logging | ||
|
||
from openupgradelib import openupgrade | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
@openupgrade.migrate(use_env=True) | ||
def migrate(env, version): | ||
ResCompany = env["res.company"].with_context(active_test=False) | ||
companies = ResCompany.search([]) | ||
for company in companies: | ||
partner = company.joint_buying_partner_id.with_context( | ||
write_joint_buying_partner=True | ||
) | ||
new_name = company._prepare_joint_buying_partner_vals()["name"] | ||
_logger.info(f"Rename {partner.name} into {new_name} ...") | ||
partner.name = new_name |
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