2018-03-06 09:18:36 +01:00
|
|
|
# Copyright (C) 2015 Therp BV <http://therp.nl>
|
|
|
|
# Copyright (C) 2017 Komit <http://www.komit-consulting.com>
|
|
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
|
|
|
2015-07-08 11:32:21 +02:00
|
|
|
from lxml import etree
|
2018-03-06 09:18:36 +01:00
|
|
|
from odoo import api, models
|
2015-07-08 11:32:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
class MailWizardInvite(models.TransientModel):
|
|
|
|
_inherit = 'mail.wizard.invite'
|
|
|
|
|
|
|
|
@api.model
|
|
|
|
def _mail_restrict_follower_selection_get_domain(self):
|
|
|
|
parameter_name = 'mail_restrict_follower_selection.domain'
|
|
|
|
return self.env['ir.config_parameter'].get_param(
|
2018-03-06 09:18:36 +01:00
|
|
|
"{0}.{1}".format(parameter_name,
|
|
|
|
self.env.context.get('default_res_model')),
|
2015-07-08 11:32:21 +02:00
|
|
|
self.env['ir.config_parameter'].get_param(
|
|
|
|
parameter_name, default='[]')
|
|
|
|
)
|
|
|
|
|
|
|
|
@api.model
|
|
|
|
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
|
|
|
|
submenu=False):
|
|
|
|
result = super(MailWizardInvite, self).fields_view_get(
|
|
|
|
view_id=view_id, view_type=view_type, toolbar=toolbar,
|
|
|
|
submenu=submenu)
|
|
|
|
arch = etree.fromstring(result['arch'])
|
|
|
|
for field in arch.xpath('//field[@name="partner_ids"]'):
|
|
|
|
field.attrib['domain'] = self\
|
|
|
|
._mail_restrict_follower_selection_get_domain()
|
|
|
|
result['arch'] = etree.tostring(arch)
|
|
|
|
return result
|