[IMP] mail: make use of is_mail_thread and allow filtering on it
Purpose of this commit is to use is_mail_thread field in a constraint instead of manually checking classes. Field is also made visible on model search and group to ease its use. closes odoo/odoo#37867 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Thibault Delavallée
parent
dc55294953
commit
6bc944f589
@@ -65,7 +65,7 @@ class ServerActions(models.Model):
|
||||
@api.constrains('state', 'model_id')
|
||||
def _check_activity_mixin(self):
|
||||
for action in self:
|
||||
if action.state == 'next_activity' and not issubclass(self.pool[action.model_id.model], self.pool['mail.thread']):
|
||||
if action.state == 'next_activity' and not action.model_id.is_mail_thread:
|
||||
raise ValidationError(_("A next activity can only be planned on models that use the chatter"))
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<field name="transient" position="after">
|
||||
<field name="is_mail_thread" attrs="{'readonly': [('state','!=', 'manual')]}" groups="base.group_no_one"/>
|
||||
<field name="is_mail_activity" attrs="{'readonly': [('state','!=', 'manual')]}" groups="base.group_no_one"/>
|
||||
<field name="is_mail_blacklist" attrs="{'readonly': [('state','!=', 'manual')]}" groups="base.group_no_one"/>
|
||||
</field>
|
||||
<xpath expr="//field[@name='field_id']//field[@name='copied']" position="after">
|
||||
<field name="tracking" attrs="{'readonly': [('state','!=', 'manual')]}"/>
|
||||
@@ -22,6 +23,7 @@
|
||||
<field name="model" position="after">
|
||||
<filter string="Mail Thread" name="is_mail_thread" domain="[('is_mail_thread', '=', True)]"/>
|
||||
<filter string="Mail Activity" name="is_mail_activity" domain="[('is_mail_activity', '=', True)]"/>
|
||||
<filter string="Mail Blacklist" name="is_mail_blacklist" domain="[('is_mail_blacklist', '=', True)]"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user