[REF]mail_activity_plan:change relation between plans and templates
This commit is contained in:
@@ -9,17 +9,18 @@ Use Odoo normal module installation procedure to install ``mail_activity_plan``.
|
|||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
To create activity templates, go to Settings > Technical > Discuss > Activity templates :
|
|
||||||
|
|
||||||
Select a activiy type, select a user to assign, fiel the other fields (summary, note)
|
|
||||||
|
|
||||||
To create activities plans, go to Settings > Technical > Discuss > Activity plans :
|
To create activities plans, go to Settings > Technical > Discuss > Activity plans :
|
||||||
|
|
||||||
Provide a name, select or create activity templates
|
Provice a name
|
||||||
|
|
||||||
|
Add activity templates :
|
||||||
|
|
||||||
|
Select an activity type, write a summary. Optionnaly assigne to a user and write a note.
|
||||||
|
|
||||||
A plan can be related to many activity templates
|
A plan can be related to many activity templates
|
||||||
|
|
||||||
A activity template can be related to many plans
|
A activity template can be related to only one plan
|
||||||
|
|
||||||
A activity template is related to only one activity type
|
A activity template is related to only one activity type
|
||||||
|
|
||||||
@@ -33,7 +34,9 @@ Go to Settings > Technical > Actions > Server Actions
|
|||||||
Provide a name, select a model, select action "[generate_activities]", select a plan.
|
Provide a name, select a model, select action "[generate_activities]", select a plan.
|
||||||
|
|
||||||
Once your new server action is configured, go to an instance of the chosen model,
|
Once your new server action is configured, go to an instance of the chosen model,
|
||||||
click on the server action to generate automatically the activities of the plan
|
click on the server action to generate automatically the activities of the plan.
|
||||||
|
|
||||||
|
If nobody is assigned to a activity, the current user will be automatically assigned.
|
||||||
|
|
||||||
Known issues / Roadmap
|
Known issues / Roadmap
|
||||||
======================
|
======================
|
||||||
|
@@ -6,8 +6,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 14.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-10-13 08:34+0000\n"
|
"POT-Creation-Date: 2023-10-16 15:18+0000\n"
|
||||||
"PO-Revision-Date: 2023-10-13 08:34+0000\n"
|
"PO-Revision-Date: 2023-10-16 15:18+0000\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@@ -29,20 +29,9 @@ msgstr ""
|
|||||||
|
|
||||||
#. module: mail_activity_plan
|
#. module: mail_activity_plan
|
||||||
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_plan_view_form
|
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_plan_view_form
|
||||||
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_template_view_tree
|
|
||||||
msgid "Activities"
|
msgid "Activities"
|
||||||
msgstr "Activités"
|
msgstr "Activités"
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
|
||||||
#: model:ir.model.fields,field_description:mail_activity_plan.field_mail_activity_template__mail_activity_plan_ids
|
|
||||||
msgid "Activities plan"
|
|
||||||
msgstr "Plan d'activités"
|
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
|
||||||
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_template_view_form
|
|
||||||
msgid "Activity"
|
|
||||||
msgstr "Activité"
|
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
#. module: mail_activity_plan
|
||||||
#: model:ir.model.fields,field_description:mail_activity_plan.field_mail_activity_template__mail_activity_type_id
|
#: model:ir.model.fields,field_description:mail_activity_plan.field_mail_activity_template__mail_activity_type_id
|
||||||
msgid "Activity Type"
|
msgid "Activity Type"
|
||||||
@@ -54,17 +43,6 @@ msgstr "Type d'activité"
|
|||||||
msgid "Activity plans"
|
msgid "Activity plans"
|
||||||
msgstr "Plans d'activités"
|
msgstr "Plans d'activités"
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
|
||||||
#: model:ir.model.fields,field_description:mail_activity_plan.field_mail_activity_plan__mail_activity_template_ids
|
|
||||||
msgid "Activity template"
|
|
||||||
msgstr "Modèle d'activité"
|
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
|
||||||
#: model:ir.actions.act_window,name:mail_activity_plan.mail_activity_template_action
|
|
||||||
#: model:ir.ui.menu,name:mail_activity_plan.menu_mail_activity_template
|
|
||||||
msgid "Activity templates"
|
|
||||||
msgstr "Modèles d'activités"
|
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
#. module: mail_activity_plan
|
||||||
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_plan_view_form
|
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_plan_view_form
|
||||||
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_plan_view_search
|
#: model_terms:ir.ui.view,arch_db:mail_activity_plan.mail_activity_plan_view_search
|
||||||
@@ -133,6 +111,11 @@ msgstr ""
|
|||||||
msgid "Last Updated on"
|
msgid "Last Updated on"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: mail_activity_plan
|
||||||
|
#: model:ir.model.fields,field_description:mail_activity_plan.field_mail_activity_template__mail_activity_plan_id
|
||||||
|
msgid "Mail Activity Plan"
|
||||||
|
msgstr "Plan d'activités"
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
#. module: mail_activity_plan
|
||||||
#: model:ir.model,name:mail_activity_plan.model_mail_activity_plan
|
#: model:ir.model,name:mail_activity_plan.model_mail_activity_plan
|
||||||
msgid "Mail activity plan"
|
msgid "Mail activity plan"
|
||||||
@@ -164,6 +147,11 @@ msgstr ""
|
|||||||
msgid "Planning"
|
msgid "Planning"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: mail_activity_plan
|
||||||
|
#: model:ir.model.fields,field_description:mail_activity_plan.field_mail_activity_template__sequence
|
||||||
|
msgid "Sequence"
|
||||||
|
msgstr "Ordre"
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
#. module: mail_activity_plan
|
||||||
#: model:ir.model,name:mail_activity_plan.model_ir_actions_server
|
#: model:ir.model,name:mail_activity_plan.model_ir_actions_server
|
||||||
msgid "Server Action"
|
msgid "Server Action"
|
||||||
@@ -174,6 +162,11 @@ msgstr "Action du serveur"
|
|||||||
msgid "Summary"
|
msgid "Summary"
|
||||||
msgstr "Résumé"
|
msgstr "Résumé"
|
||||||
|
|
||||||
|
#. module: mail_activity_plan
|
||||||
|
#: model:ir.model.fields,field_description:mail_activity_plan.field_mail_activity_plan__mail_activity_template_ids
|
||||||
|
msgid "Template Activities"
|
||||||
|
msgstr "Modèles d'activités"
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
#. module: mail_activity_plan
|
||||||
#: model:ir.model.fields,help:mail_activity_plan.field_base_automation__state
|
#: model:ir.model.fields,help:mail_activity_plan.field_base_automation__state
|
||||||
#: model:ir.model.fields,help:mail_activity_plan.field_ir_actions_server__state
|
#: model:ir.model.fields,help:mail_activity_plan.field_ir_actions_server__state
|
||||||
@@ -196,7 +189,12 @@ msgstr ""
|
|||||||
"- 'Envoyer E-Mail': envoyer un e-mail automatiquement (Discutez)\n"
|
"- 'Envoyer E-Mail': envoyer un e-mail automatiquement (Discutez)\n"
|
||||||
"- 'Ajouter Abonnés': ajouter des abonnés à un enregistrement (Discutez)\n"
|
"- 'Ajouter Abonnés': ajouter des abonnés à un enregistrement (Discutez)\n"
|
||||||
"- 'Créer une Nouvelle Activité': créer une activité (Discutez)\n"
|
"- 'Créer une Nouvelle Activité': créer une activité (Discutez)\n"
|
||||||
"- 'Générer les activités d'un plan d'activités': créer automatiquement les activités du plan dans le modèle choisi"
|
"- 'Générer les activités d'un plan d'activités': créer une action générant automatiquement les activités du plan"
|
||||||
|
|
||||||
|
#. module: mail_activity_plan
|
||||||
|
#: model:ir.model.fields,help:mail_activity_plan.field_mail_activity_template__sequence
|
||||||
|
msgid "Used to order activities."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: mail_activity_plan
|
#. module: mail_activity_plan
|
||||||
#: model:ir.model.fields,help:mail_activity_plan.field_base_automation__plan_id
|
#: model:ir.model.fields,help:mail_activity_plan.field_base_automation__plan_id
|
||||||
|
@@ -20,13 +20,12 @@ class IrActionsServer(models.Model):
|
|||||||
records = self.env[self.model_name].browse(self._context.get('active_ids', self._context.get('active_id')))
|
records = self.env[self.model_name].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||||
for record in records :
|
for record in records :
|
||||||
for mail_activity_template in self.plan_id.mail_activity_template_ids:
|
for mail_activity_template in self.plan_id.mail_activity_template_ids:
|
||||||
date_deadline = self.env['mail.activity']._calculate_date_deadline(mail_activity_template.mail_activity_type_id)
|
|
||||||
record.activity_schedule(
|
record.activity_schedule(
|
||||||
activity_type_id=mail_activity_template.mail_activity_type_id.id,
|
activity_type_id=mail_activity_template.mail_activity_type_id.id,
|
||||||
summary=mail_activity_template.summary,
|
summary=mail_activity_template.summary,
|
||||||
note=mail_activity_template.note,
|
note=mail_activity_template.note,
|
||||||
user_id=mail_activity_template.user_id.id,
|
user_id=self.env.uid if not mail_activity_template.user_id else mail_activity_template.user_id.id,
|
||||||
date_deadline=date_deadline
|
date_deadline=self.env['mail.activity']._calculate_date_deadline(mail_activity_template.mail_activity_type_id)
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
from odoo.exceptions import UserError
|
|
||||||
|
|
||||||
class MailActivityTemplate(models.Model):
|
class MailActivityTemplate(models.Model):
|
||||||
'''
|
'''
|
||||||
@@ -10,16 +9,19 @@ class MailActivityTemplate(models.Model):
|
|||||||
'''
|
'''
|
||||||
_name = 'mail.activity.template'
|
_name = 'mail.activity.template'
|
||||||
_description = 'Mail activity template'
|
_description = 'Mail activity template'
|
||||||
|
_order = 'sequence'
|
||||||
|
|
||||||
mail_activity_plan_ids = fields.Many2many('mail.activity.plan', string='Activities plan', ondelete='restrict')
|
mail_activity_plan_id = fields.Many2one('mail.activity.plan', ondelete='restrict')
|
||||||
|
|
||||||
mail_activity_type_id = fields.Many2one(
|
mail_activity_type_id = fields.Many2one(
|
||||||
'mail.activity.type', 'Activity Type',
|
'mail.activity.type', 'Activity Type',
|
||||||
default=lambda self: self.env.ref('mail.mail_activity_data_todo'),
|
default=lambda self: self.env.ref('mail.mail_activity_data_todo'),
|
||||||
ondelete='restrict'
|
ondelete='restrict'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sequence = fields.Integer('Sequence', default=1, help="Used to order activities.")
|
||||||
summary = fields.Char('Summary', compute="_compute_default_summary", store=True, readonly=False)
|
summary = fields.Char('Summary', compute="_compute_default_summary", store=True, readonly=False)
|
||||||
user_id = fields.Many2one('res.users', string='Assigned to', required=True)
|
user_id = fields.Many2one('res.users', string='Assigned to')
|
||||||
note = fields.Html('Note')
|
note = fields.Html('Note')
|
||||||
|
|
||||||
@api.depends('mail_activity_type_id')
|
@api.depends('mail_activity_type_id')
|
||||||
@@ -38,5 +40,5 @@ class MailActivityPlan(models.Model):
|
|||||||
_description = 'Mail activity plan'
|
_description = 'Mail activity plan'
|
||||||
|
|
||||||
name = fields.Char('Name', required=True)
|
name = fields.Char('Name', required=True)
|
||||||
mail_activity_template_ids = fields.Many2many('mail.activity.template', string='Activity template', ondelete='restrict')
|
mail_activity_template_ids = fields.One2many('mail.activity.template', 'mail_activity_plan_id', string='Template Activities')
|
||||||
active = fields.Boolean(default=True)
|
active = fields.Boolean(default=True)
|
||||||
|
@@ -37,10 +37,11 @@
|
|||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<group string="Activities">
|
<group string="Activity Templates">
|
||||||
<field name="active" invisible="1"/>
|
<field name="active" invisible="1"/>
|
||||||
<field name="mail_activity_template_ids" nolabel="1">
|
<field name="mail_activity_template_ids" nolabel="1">
|
||||||
<tree editable="bottom">
|
<tree>
|
||||||
|
<field name="sequence" widget="handle"/>
|
||||||
<field name="mail_activity_type_id"/>
|
<field name="mail_activity_type_id"/>
|
||||||
<field name="summary"/>
|
<field name="summary"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id"/>
|
||||||
@@ -52,36 +53,6 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="mail_activity_template_view_tree" model="ir.ui.view">
|
|
||||||
<field name="name">mail.activity.template.view.tree</field>
|
|
||||||
<field name="model">mail.activity.template</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<tree string="Activities">
|
|
||||||
<field name="mail_activity_type_id"/>
|
|
||||||
<field name="summary"/>
|
|
||||||
<field name="mail_activity_plan_ids"/>
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="mail_activity_template_view_form" model="ir.ui.view">
|
|
||||||
<field name="name">mail.activity.template.view.form</field>
|
|
||||||
<field name="model">mail.activity.template</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form string="Activity">
|
|
||||||
<sheet>
|
|
||||||
<group>
|
|
||||||
<field name="mail_activity_type_id"/>
|
|
||||||
<field name="summary"/>
|
|
||||||
<field name="user_id"/>
|
|
||||||
<field name="mail_activity_plan_ids"/>
|
|
||||||
<field name="note"/>
|
|
||||||
</group>
|
|
||||||
</sheet>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="mail_activity_plan_action" model="ir.actions.act_window">
|
<record id="mail_activity_plan_action" model="ir.actions.act_window">
|
||||||
<field name="name">Activity plans</field>
|
<field name="name">Activity plans</field>
|
||||||
<field name="res_model">mail.activity.plan</field>
|
<field name="res_model">mail.activity.plan</field>
|
||||||
@@ -96,18 +67,5 @@
|
|||||||
sequence="12"
|
sequence="12"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<record id="mail_activity_template_action" model="ir.actions.act_window">
|
|
||||||
<field name="name">Activity templates</field>
|
|
||||||
<field name="res_model">mail.activity.template</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<menuitem
|
|
||||||
id="menu_mail_activity_template"
|
|
||||||
action="mail_activity_template_action"
|
|
||||||
parent="mail.mail_menu_technical"
|
|
||||||
sequence="13"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
Reference in New Issue
Block a user