[NEW] mail_message_copy_in_partner

This commit is contained in:
clementthomas
2024-06-27 14:40:34 +02:00
parent b636093219
commit 5312b8383f
5 changed files with 159 additions and 0 deletions

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,88 @@
# 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
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,14 @@
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)
self.partner_id.message_post(body=msg, **kwargs)
return super(MailThread, self).message_post(body=body, **kwargs)