Simone
5 years ago
committed by
newtratip
6 changed files with 31 additions and 45 deletions
-
10partner_contact_gender/README.rst
-
22partner_contact_gender/__manifest__.py
-
17partner_contact_gender/hooks.py
-
10partner_contact_gender/models/res_partner.py
-
6partner_contact_gender/static/description/index.html
-
11partner_contact_gender/tests/test_partner_contact_gender.py
@ -1,19 +1,16 @@ |
|||
# Copyright 2016-2018 Therp BV <https://therp.nl>. |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
from odoo import api, SUPERUSER_ID |
|||
from odoo import SUPERUSER_ID, api |
|||
|
|||
|
|||
def post_init_hook(cr, registry): |
|||
env = api.Environment(cr, SUPERUSER_ID, {}) |
|||
gender_mappings = { |
|||
'female': |
|||
env.ref('base.res_partner_title_madam') + |
|||
env.ref('base.res_partner_title_miss'), |
|||
'male': env.ref('base.res_partner_title_mister') |
|||
"female": env.ref("base.res_partner_title_madam") |
|||
+ env.ref("base.res_partner_title_miss"), |
|||
"male": env.ref("base.res_partner_title_mister"), |
|||
} |
|||
for gender, titles in list(gender_mappings.items()): |
|||
env['res.partner'].with_context(active_test=False).search([ |
|||
('title', 'in', titles.ids), |
|||
]).write({ |
|||
'gender': gender, |
|||
}) |
|||
env["res.partner"].with_context(active_test=False).search( |
|||
[("title", "in", titles.ids)] |
|||
).write({"gender": gender}) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue