-
-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea3301f
commit 7ab8744
Showing
15 changed files
with
702 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
============================= | ||
Mail Chatter Company Tracking | ||
============================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:ca51bb1b96e2d7172d7613e71850bbe20451d0456244169c33db61cee68193eb | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github | ||
:target: https://github.com/OCA/social/tree/14.0/mail_chatter_company_tracking | ||
:alt: OCA/social | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_chatter_company_tracking | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This add-on includes the company name in the email chatter tracking | ||
and filters tracking based on allowed companies. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_chatter_company_tracking%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Binhex | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Binhex <https://www.binhex.cloud>`_: | ||
* Adasat Torres de León <a.torres@binhex.cloud> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
.. |maintainer-adasatorres| image:: https://github.com/adasatorres.png?size=40px | ||
:target: https://github.com/adasatorres | ||
:alt: adasatorres | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-adasatorres| | ||
|
||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/14.0/mail_chatter_company_tracking>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "Mail Chatter Company Tracking", | ||
"summary": """ | ||
This add-on includes the company name in the email chatter | ||
tracking and filters tracking based on allowed companies. | ||
""", | ||
"author": "Binhex, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/social", | ||
"license": "AGPL-3", | ||
"category": "social", | ||
"version": "14.0.1.0.0", | ||
"depends": [ | ||
"mail", | ||
], | ||
"data": [], | ||
"qweb": ["static/src/components/message/message.xml"], | ||
"maintainers": ["adasatorres"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import mail_tracking_value | ||
from . import mail_message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from odoo import models | ||
|
||
|
||
class Message(models.Model): | ||
_inherit = "mail.message" | ||
|
||
def _message_format(self, fnames): | ||
vals_list = super()._message_format(fnames) | ||
allowed_companies = self.env.context.get("allowed_company_ids", []) | ||
for pos, vals in enumerate(vals_list): | ||
tracking_ids = map(lambda x: x.get("id"), vals["tracking_value_ids"]) | ||
trackings = self.env["mail.tracking.value"].browse(tracking_ids) | ||
tracking_value_ids = [] | ||
for tracking in trackings: | ||
if tracking.company_id.id in allowed_companies: | ||
tracking_value_ids.append( | ||
{ | ||
"id": tracking.id, | ||
"changed_field": tracking.field_desc, | ||
"old_value": tracking.get_old_display_value()[0], | ||
"new_value": tracking.get_new_display_value()[0], | ||
"field_type": tracking.field_type, | ||
"company_name": ( | ||
tracking.company_id.name | ||
if tracking.company_id and len(allowed_companies) > 1 | ||
else False | ||
), | ||
} | ||
) | ||
vals_list[pos]["tracking_value_ids"] = tracking_value_ids | ||
return vals_list |
31 changes: 31 additions & 0 deletions
31
mail_chatter_company_tracking/models/mail_tracking_value.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class MailTrackingValue(models.Model): | ||
_inherit = "mail.tracking.value" | ||
|
||
company_id = fields.Many2one( | ||
"res.company", | ||
default=lambda self: self.env.company, | ||
) | ||
|
||
@api.model | ||
def create_tracking_values( | ||
self, | ||
initial_value, | ||
new_value, | ||
col_name, | ||
col_info, | ||
tracking_sequence, | ||
model_name, | ||
): | ||
res = super().create_tracking_values( | ||
initial_value, new_value, col_name, col_info, tracking_sequence, model_name | ||
) | ||
if res: | ||
res.update( | ||
{ | ||
"company_id": self.env.company.id, | ||
} | ||
) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* `Binhex <https://www.binhex.cloud>`_: | ||
* Adasat Torres de León <a.torres@binhex.cloud> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This add-on includes the company name in the email chatter tracking | ||
and filters tracking based on allowed companies. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.