Set full domain on email template setup

issue10517
review352191002
This commit is contained in:
Sergi Almacellas Abellana committed 2021-06-29 11:57:04 +02:00
1 parent f6e320efd1
commit 4445c2d69e
1 file changed
+9 -14
+9 -14
View File
@@ -256,13 +256,10 @@ class EmailTemplate(ModelSQL, ModelView):
name = fields.Char("Name", required=True, translate=True)
recipients = fields.Many2One(
'ir.model.field', "Recipients",
domain=[
('model', '=', Eval('model')),
],
states={
'invisible': Bool(Eval('recipients_pyson')),
},
depends=['model', 'recipients_pyson'],
depends=['recipients_pyson'],
help="The field that contains the recipient(s).")
recipients_pyson = fields.Char(
"Recipients",
@@ -274,13 +271,10 @@ class EmailTemplate(ModelSQL, ModelView):
'with the record represented by "self".')
recipients_secondary = fields.Many2One(
'ir.model.field', "Secondary Recipients",
domain=[
('model', '=', Eval('model')),
],
states={
'invisible': Bool(Eval('recipients_secondary_pyson')),
},
depends=['model', 'recipients_secondary_pyson'],
depends=['recipients_secondary_pyson'],
help="The field that contains the secondary recipient(s).")
recipients_secondary_pyson = fields.Char(
"Secondary Recipients",
@@ -292,13 +286,10 @@ class EmailTemplate(ModelSQL, ModelView):
'of secondary recipients with the record represented by "self".')
recipients_hidden = fields.Many2One(
'ir.model.field', "Hidden Recipients",
domain=[
('model', '=', Eval('model')),
],
states={
'invisible': Bool(Eval('recipients_hidden_pyson')),
},
depends=['model', 'recipients_hidden_pyson'],
depends=['recipients_hidden_pyson'],
help="The field that contains the secondary recipient(s).")
recipients_hidden_pyson = fields.Char(
"Hidden Recipients",
@@ -330,13 +321,17 @@ class EmailTemplate(ModelSQL, ModelView):
'recipients_hidden',
]:
field = getattr(cls, field)
field.domain.append(['OR',
field.domain = [
('model', '=', Eval('model')),
['OR',
('relation', 'in', cls.email_models()),
[
('model.model', 'in', cls.email_models()),
('name', '=', 'id'),
],
])
]
]
field.depends.append('model')
cls.__rpc__.update({
'get': RPC(instantiate=0),
'get_default': RPC(),