You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
677 B

  1. # Copyright 2016-2018 Therp BV <https://therp.nl>.
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  3. from odoo import api, SUPERUSER_ID
  4. def post_init_hook(cr, registry):
  5. env = api.Environment(cr, SUPERUSER_ID, {})
  6. gender_mappings = {
  7. 'female':
  8. env.ref('base.res_partner_title_madam') +
  9. env.ref('base.res_partner_title_miss'),
  10. 'male': env.ref('base.res_partner_title_mister')
  11. }
  12. for gender, titles in list(gender_mappings.items()):
  13. env['res.partner'].with_context(active_test=False).search([
  14. ('title', 'in', titles.ids),
  15. ]).write({
  16. 'gender': gender,
  17. })