Compare commits
9 Commits
14.0
...
16.0_pr_ma
Author | SHA1 | Date | |
---|---|---|---|
|
47f27480ee | ||
|
5312b8383f | ||
|
b636093219 | ||
|
1e762d8c47 | ||
|
cbe6182711 | ||
|
be31e8a7ad | ||
55a9885dfa | |||
c2b6f1f54e | |||
4da9279dc6 |
@@ -1,2 +1 @@
|
||||
from . import mail_activity_plan
|
||||
from . import ir_actions
|
||||
from . import ir_actions, mail_activity_plan
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class IrActionsServer(models.Model):
|
||||
""" Add activity plan option in server actions. """
|
||||
_inherit = 'ir.actions.server'
|
||||
|
@@ -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)
|
||||
|
@@ -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>
|
||||
|
52
mail_message_copy_in_partner/README.rst
Normal file
52
mail_message_copy_in_partner/README.rst
Normal 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.
|
4
mail_message_copy_in_partner/__init__.py
Normal file
4
mail_message_copy_in_partner/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
89
mail_message_copy_in_partner/__manifest__.py
Normal file
89
mail_message_copy_in_partner/__manifest__.py
Normal 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,
|
||||
}
|
1
mail_message_copy_in_partner/models/__init__.py
Normal file
1
mail_message_copy_in_partner/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import mail_thread
|
24
mail_message_copy_in_partner/models/mail_thread.py
Normal file
24
mail_message_copy_in_partner/models/mail_thread.py
Normal 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)
|
||||
|
52
mail_prevent_send_note_to_external/README.rst
Normal file
52
mail_prevent_send_note_to_external/README.rst
Normal 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.
|
4
mail_prevent_send_note_to_external/__init__.py
Normal file
4
mail_prevent_send_note_to_external/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
88
mail_prevent_send_note_to_external/__manifest__.py
Normal file
88
mail_prevent_send_note_to_external/__manifest__.py
Normal 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,
|
||||
}
|
1
mail_prevent_send_note_to_external/models/__init__.py
Normal file
1
mail_prevent_send_note_to_external/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import mail_thread
|
19
mail_prevent_send_note_to_external/models/mail_thread.py
Normal file
19
mail_prevent_send_note_to_external/models/mail_thread.py
Normal 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
|
Reference in New Issue
Block a user