-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] cooperator: Migration script to populate company fields
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
- Loading branch information
1 parent
02ad6ec
commit 9157219
Showing
2 changed files
with
19 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
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 @@ | ||
# SPDX-FileCopyrightText: 2023 Coop IT Easy SC | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
import logging | ||
|
||
from odoo import SUPERUSER_ID, api | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def migrate(cr, version): | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
mail_template_fields = env["res.company"]._get_cooperator_mail_template_fields() | ||
for field, xmlid in mail_template_fields.items(): | ||
company_ids = env["res.company"].search([(field, "=", False)]) | ||
_logger.info("populating field %s on companies %s", field, company_ids) | ||
company_ids._assign_default_cooperator_mail_template(field, xmlid) |