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.

33 lines
1.3 KiB

  1. # Copyright (C) 2015 Therp BV <http://therp.nl>
  2. # Copyright (C) 2017 Komit <http://www.komit-consulting.com>
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. from lxml import etree
  5. from odoo import api, models
  6. class MailWizardInvite(models.TransientModel):
  7. _inherit = 'mail.wizard.invite'
  8. @api.model
  9. def _mail_restrict_follower_selection_get_domain(self):
  10. parameter_name = 'mail_restrict_follower_selection.domain'
  11. return self.env['ir.config_parameter'].get_param(
  12. "{0}.{1}".format(parameter_name,
  13. self.env.context.get('default_res_model')),
  14. self.env['ir.config_parameter'].get_param(
  15. parameter_name, default='[]')
  16. )
  17. @api.model
  18. def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
  19. submenu=False):
  20. result = super(MailWizardInvite, self).fields_view_get(
  21. view_id=view_id, view_type=view_type, toolbar=toolbar,
  22. submenu=submenu)
  23. arch = etree.fromstring(result['arch'])
  24. for field in arch.xpath('//field[@name="partner_ids"]'):
  25. field.attrib['domain'] = self\
  26. ._mail_restrict_follower_selection_get_domain()
  27. result['arch'] = etree.tostring(arch)
  28. return result