Skip to content
Snippets Groups Projects
Commit 71200fdc authored by Thibault Delavallée's avatar Thibault Delavallée
Browse files

[MERGE][IMP] mail: improve propagation of model through activity type configuration

Activity types can be either generic, either related to a given model.
This task aims at improving the model propagation through several commits

 * prefill model when configuring application activity types;
 * limit previous / next activity types to generic or same model;
 * propagate model when creating new activity types through recommended
   activity m2m;

See sub commits for more details.

This merge is linked to task ID 1844644 and closes PR #25843.
parents 0bf4986c ec16901c
No related branches found
No related tags found
No related merge requests found
......@@ -258,6 +258,7 @@
<record id="sales_team.mail_activity_type_action_config_sales" model="ir.actions.act_window">
<field name="domain">['|', ('res_model_id', '=', False), ('res_model_id.model', 'in', ['crm.lead', 'res.partner'])]</field>
<field name="context">{'default_res_model': 'crm.lead'}</field>
</record>
</odoo>
......@@ -7,6 +7,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">['|', ('res_model_id', '=', False), ('res_model_id.model', '=', 'hr.applicant')]</field>
<field name="context">{'default_res_model': 'hr.applicant'}</field>
</record>
<menuitem id="hr_recruitment_menu_config_activity_type"
action="mail_activity_type_action_config_hr_applicant"
......
......@@ -46,9 +46,11 @@ class MailActivityType(models.Model):
' and not available when managing activities for other models.')
next_type_ids = fields.Many2many(
'mail.activity.type', 'mail_activity_rel', 'activity_id', 'recommended_id',
domain="['|', ('res_model_id', '=', False), ('res_model_id', '=', res_model_id)]",
string='Recommended Next Activities')
previous_type_ids = fields.Many2many(
'mail.activity.type', 'mail_activity_rel', 'recommended_id', 'activity_id',
domain="['|', ('res_model_id', '=', False), ('res_model_id', '=', res_model_id)]",
string='Preceding Activities')
category = fields.Selection([
('default', 'Other')], default='default',
......
......@@ -29,7 +29,8 @@
</div>
</group>
<group>
<field name="next_type_ids" widget="many2many_tags"/>
<field name="next_type_ids" widget="many2many_tags"
context="{'default_res_model_id': res_model_id}"/>
</group>
</group>
</sheet>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment