9 Commits

Author SHA1 Message Date
clementthomas
47f27480ee [IMP] mail_message_copy_in_partner:
new message is a note without recipients
2024-06-27 14:58:10 +02:00
clementthomas
5312b8383f [NEW] mail_message_copy_in_partner 2024-06-27 14:40:34 +02:00
clementthomas
b636093219 [IMP] mail_prevent_send_note_to_external:
better module description
2024-06-27 11:03:44 +02:00
clementthomas
1e762d8c47 [NEW] mail_prevent_send_note_to_external 2024-06-27 10:58:42 +02:00
clementthomas
cbe6182711 [IMP] mail_activity_plan:
fix view error : page without notebook
2024-03-29 12:34:53 +01:00
clementthomas
be31e8a7ad manage copy of mail activity plan 2024-03-04 09:43:09 +01:00
55a9885dfa [MIG]mail_activity_plan:migration to v16 2023-11-22 12:34:08 +01:00
c2b6f1f54e [REM]mail_activity_plan:remove compute fonction in summary and note 2023-10-17 16:55:09 +02:00
4da9279dc6 [IMP]mail_activity_plan:use mail.activity.type default_description as activity.template default note 2023-10-16 17:58:06 +02:00
14 changed files with 377 additions and 21 deletions

View File

@@ -1,2 +1 @@
from . import mail_activity_plan
from . import ir_actions
from . import ir_actions, mail_activity_plan

View File

@@ -3,6 +3,7 @@
from odoo import fields, models
class IrActionsServer(models.Model):
""" Add activity plan option in server actions. """
_inherit = 'ir.actions.server'

View File

@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo import _, api, fields, models
class MailActivityTemplate(models.Model):
'''
@@ -10,6 +11,7 @@ class MailActivityTemplate(models.Model):
_name = 'mail.activity.template'
_description = 'Mail activity template'
_order = 'sequence'
_rec_name = 'summary'
mail_activity_plan_id = fields.Many2one('mail.activity.plan', ondelete='restrict')
@@ -20,16 +22,10 @@ class MailActivityTemplate(models.Model):
)
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')
user_id = fields.Many2one('res.users', string='Assigned to')
note = fields.Html('Note')
@api.depends('mail_activity_type_id')
def _compute_default_summary(self):
for mail_activity_template in self:
if not mail_activity_template.summary and mail_activity_template.mail_activity_type_id and mail_activity_template.mail_activity_type_id.summary:
mail_activity_template.summary = mail_activity_template.mail_activity_type_id.summary
class MailActivityPlan(models.Model):
'''
Create a plan
@@ -39,6 +35,12 @@ class MailActivityPlan(models.Model):
_name = 'mail.activity.plan'
_description = 'Mail activity plan'
@api.returns('self', lambda value: value.id)
def copy(self, default=None):
default = dict(default or {},
name=_("%s (copy)", self.name))
return super(MailActivityPlan, self).copy(default=default)
name = fields.Char('Name', required=True)
mail_activity_template_ids = fields.One2many('mail.activity.template', 'mail_activity_plan_id', string='Template Activities')
mail_activity_template_ids = fields.One2many('mail.activity.template', 'mail_activity_plan_id', string='Template Activities', copy=True)
active = fields.Boolean(default=True)

View File

@@ -37,22 +37,42 @@
<field name="name"/>
</h1>
</div>
<group string="Activity Templates">
<field name="active" invisible="1"/>
<field name="mail_activity_template_ids" nolabel="1">
<tree>
<field name="sequence" widget="handle"/>
<field name="mail_activity_type_id"/>
<field name="summary"/>
<field name="user_id"/>
</tree>
</field>
<notebook>
<page string="Activity Templates">
<field name="active" invisible="1"/>
<field name="mail_activity_template_ids">
<tree>
<field name="sequence" widget="handle"/>
<field name="mail_activity_type_id"/>
<field name="summary"/>
<field name="user_id"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</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="note"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="mail_activity_plan_action" model="ir.actions.act_window">
<field name="name">Activity plans</field>
<field name="res_model">mail.activity.plan</field>

View File

@@ -0,0 +1,52 @@
====================
mail_message_copy_in_partner
====================
Installation
============
Use Odoo normal module installation procedure to install ``mail_message_copy_in_partner``.
Configuration
=============
Nothing to do
Usage
=====
If module is installed, notes will never send email to partners not linked to internal users.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/ux-tools/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models

View File

@@ -0,0 +1,89 @@
# Copyright 2022 Laetitia Élabore (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "mail_message_copy_in_partner",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://github.com/elabore-coop/ux-tools",
"maintainer": "Clément",
"license": "AGPL-3",
"category": "Tools",
"summary": "If current model has partner_id field, all messages will be copied in partner's chatter",
"description": """
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=================
mail_message_copy_in_partner
=================
If current model has partner_id field, all messages will be copied in partner's chatter
New message is a note without recipients
Installation
============
Install ``mail_message_copy_in_partner``, all dependencies will be installed by default.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website
<https://github.com/elabore-coop/ux-tools/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
Credits
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.
""",
# any module necessary for this one to work correctly
'depends' : ['base_setup'],
"qweb": [
# "static/src/xml/*.xml",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -0,0 +1 @@
from . import mail_thread

View File

@@ -0,0 +1,24 @@
from odoo import api, models, _
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
@api.returns('mail.message', lambda value: value.id)
def message_post(self, body='', **kwargs):
#send message to related partner
if hasattr(self, 'partner_id') and self.partner_id:
msg = _('<b>[%(object)s]</b> %(body)s',object=self._get_html_link(), body=body)
new_kwargs = kwargs.copy()
#new message is a note
new_kwargs['subtype_xmlid'] = "mail.mt_note"
#do not send anything
new_kwargs['partner_ids'] = []
self.partner_id.message_post(body=msg, **new_kwargs)
return super(MailThread, self).message_post(body=body, **kwargs)

View File

@@ -0,0 +1,52 @@
====================
mail_prevent_send_note_to_external
====================
Installation
============
Use Odoo normal module installation procedure to install ``mail_prevent_send_note_to_external``.
Configuration
=============
Nothing to do
Usage
=====
If module is installed, notes will never send email to partners not linked to internal users.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/ux-tools/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models

View File

@@ -0,0 +1,88 @@
# Copyright 2022 Laetitia Élabore (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "mail_prevent_send_note_to_external",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://github.com/elabore-coop/ux-tools",
"maintainer": "Clément",
"license": "AGPL-3",
"category": "Tools",
"summary": "Prevent chatter note to send email to external partner",
"description": """
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=================
mail_prevent_send_note_to_external
=================
Prevent chatter note to send email to external partner
Installation
============
Install ``mail_prevent_send_note_to_external``, all dependencies will be installed by default.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website
<https://github.com/elabore-coop/ux-tools/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
Credits
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Clément Thomas
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.
""",
# any module necessary for this one to work correctly
'depends' : ['base_setup'],
"qweb": [
# "static/src/xml/*.xml",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -0,0 +1 @@
from . import mail_thread

View File

@@ -0,0 +1,19 @@
from odoo import api, models, _
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
@api.returns('mail.message', lambda value: value.id)
def message_post(self, **kwargs):
#check subtype_xmlid and partner_ids, and remove external partners if subtype is "note"
if kwargs.get("subtype_xmlid") == 'mail.mt_note' and "partner_ids" in kwargs:
new_partner_ids = []
for partner_id in kwargs["partner_ids"]:
user = self.env["res.users"].search([('partner_id','=',partner_id)])
if user.active and user.has_group('base.group_user'):
new_partner_ids.append(partner_id)
kwargs["partner_ids"] = new_partner_ids
message = super(MailThread, self).message_post(**kwargs)
return message