[NEW] mail_prevent_send_note_to_external

This commit is contained in:
clementthomas
2024-06-27 10:58:42 +02:00
parent cbe6182711
commit 1e762d8c47
5 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
====================
mail_activity_plan
====================
Installation
============
Use Odoo normal module installation procedure to install ``mail_activity_plan``.
Configuration
=============
To create activities plans, go to Settings > Technical > Discuss > Activity plans :
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 activity template can be related to only one plan
A activity template is related to only one activity type
Usage
=====
Once your plan is configured, you can define a server-action to launch automatically the activities for a choose model
Go to Settings > Technical > Actions > Server Actions
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,
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
======================
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
------------
* Laetitia Da Costa (https://github.com/LaetitiaElabore)
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