Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] mail_partner_forwarding: Migration to 18.0 #1515

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions mail_partner_forwarding/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
=======================
Partner Mail Forwarding
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6aea6f497ed772e5eac7409531ab7f024bd98331ebe2a6cc8250cde45b4361c0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/18.0/mail_partner_forwarding
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_partner_forwarding
: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=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to select a related user (called "Forwarding
partner") in each partner in order to send all the notifications to the
Forwarding partner.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

- Install it.
- Set a Forwarding partner in your partner.
- Your Forwarding partner also will be notify of your notifications

Changelog
=========

13.0.1.0.0 (2022-01-03)
-----------------------

- [NEW] Module in v13.

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_partner_forwarding%0Aversion:%2018.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
-------

* ADHOC SA

Contributors
------------

- Nicolás Mac Rouillon <nmr@adhoc.com.ar>

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.

This module is part of the `OCA/social <https://github.com/OCA/social/tree/18.0/mail_partner_forwarding>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mail_partner_forwarding/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions mail_partner_forwarding/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2022 AdHoc SA - Pablo Paez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Partner Mail Forwarding",
"summary": "Forwarding notifications for partners",
"version": "18.0.1.0.0",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": "ADHOC SA, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["mail"],
"data": ["views/res_user_views.xml", "views/res_partner_views.xml"],
"development_status": "Production/Stable",
"maintainers": [],
}
56 changes: 56 additions & 0 deletions mail_partner_forwarding/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_partner_forwarding
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-02-08 19:35+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_mail_thread
msgid "Email Thread"
msgstr "Hilo de Correo Electrónico"

#. module: mail_partner_forwarding
#: model:ir.model.fields,field_description:mail_partner_forwarding.field_res_partner__forwarding_partner_id
#: model:ir.model.fields,field_description:mail_partner_forwarding.field_res_users__forwarding_partner_id
msgid "Forwarding Partner"
msgstr "Socio Transitario"

#. module: mail_partner_forwarding
#: model:ir.model.fields,help:mail_partner_forwarding.field_res_partner__forwarding_partner_id
#: model:ir.model.fields,help:mail_partner_forwarding.field_res_users__forwarding_partner_id
msgid ""
"Messages will be forwarded only for partners that are followers but no "
"partners being notify because they belong to channel that is following the "
"thread"
msgstr ""
"Los mensajes sólo se reenviarán a los socios que sean seguidores, pero no se "
"notificará a los socios que pertenezcan a un canal que esté siguiendo el hilo"

#. module: mail_partner_forwarding
#. odoo-python
#: code:addons/mail_partner_forwarding/tests/test_mail_forwarding.py:0
#, python-format
msgid "Test"
msgstr "Prueba"

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_res_users
msgid "User"
msgstr "Usuario"
56 changes: 56 additions & 0 deletions mail_partner_forwarding/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_partner_forwarding
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-02-04 22:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_mail_thread
msgid "Email Thread"
msgstr "Discussione e-mail"

#. module: mail_partner_forwarding
#: model:ir.model.fields,field_description:mail_partner_forwarding.field_res_partner__forwarding_partner_id
#: model:ir.model.fields,field_description:mail_partner_forwarding.field_res_users__forwarding_partner_id
msgid "Forwarding Partner"
msgstr "Partner inoltro"

#. module: mail_partner_forwarding
#: model:ir.model.fields,help:mail_partner_forwarding.field_res_partner__forwarding_partner_id
#: model:ir.model.fields,help:mail_partner_forwarding.field_res_users__forwarding_partner_id
msgid ""
"Messages will be forwarded only for partners that are followers but no "
"partners being notify because they belong to channel that is following the "
"thread"
msgstr ""
"I messaggi verranno inoltrati solo per partner che seguono ma nessun partner "
"è stato avvisato perché apprtiene al canale che segue la discussione"

#. module: mail_partner_forwarding
#. odoo-python
#: code:addons/mail_partner_forwarding/tests/test_mail_forwarding.py:0
#, python-format
msgid "Test"
msgstr "Test"

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_res_users
msgid "User"
msgstr "Utente"
51 changes: 51 additions & 0 deletions mail_partner_forwarding/i18n/mail_partner_forwarding.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_partner_forwarding
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_res_partner
msgid "Contact"
msgstr ""

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_mail_thread
msgid "Email Thread"
msgstr ""

#. module: mail_partner_forwarding
#: model:ir.model.fields,field_description:mail_partner_forwarding.field_res_partner__forwarding_partner_id
#: model:ir.model.fields,field_description:mail_partner_forwarding.field_res_users__forwarding_partner_id
msgid "Forwarding Partner"
msgstr ""

#. module: mail_partner_forwarding
#: model:ir.model.fields,help:mail_partner_forwarding.field_res_partner__forwarding_partner_id
#: model:ir.model.fields,help:mail_partner_forwarding.field_res_users__forwarding_partner_id
msgid ""
"Messages will be forwarded only for partners that are followers but no "
"partners being notify because they belong to channel that is following the "
"thread"
msgstr ""

#. module: mail_partner_forwarding
#. odoo-python
#: code:addons/mail_partner_forwarding/tests/test_mail_forwarding.py:0
#, python-format
msgid "Test"
msgstr ""

#. module: mail_partner_forwarding
#: model:ir.model,name:mail_partner_forwarding.model_res_users
msgid "User"
msgstr ""
3 changes: 3 additions & 0 deletions mail_partner_forwarding/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import res_partner
from . import res_user
from . import mail_thread
43 changes: 43 additions & 0 deletions mail_partner_forwarding/models/mail_thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from odoo import models


class MailThread(models.AbstractModel):
_inherit = "mail.thread"

def _notify_get_recipients(self, message, msg_vals, **kwargs):
"""Inherit this method to add in the list of partners to be notify
the forwarding_partner_id of any partners in the list"""
recipient_data = super()._notify_get_recipients(message, msg_vals, **kwargs)
if not recipient_data:
return recipient_data
partner_dict = {x.get("id"): x for x in recipient_data}
forwarded_partner_ids = []
# for each partner being notified we check if it has a
# forwarding_partner_id configured that is not being notified yet
for partner in (
self.env["res.partner"]
.sudo()
.with_context(prefetch_fields=False)
.browse(partner_dict.keys())
):
if (
partner.forwarding_partner_id
and partner.forwarding_partner_id.id not in partner_dict.keys()
and partner.forwarding_partner_id.id not in forwarded_partner_ids
):
forwarded_partner_ids.append(partner.forwarding_partner_id.id)
data = partner_dict[partner.id].copy()
notif = (
partner.forwarding_partner_id.user_ids
and partner.forwarding_partner_id.user_ids[0].notification_type
or "email"
)
data.update(
{
"id": partner.forwarding_partner_id.id,
"share": partner.partner_share,
"notif": notif,
}
)
recipient_data.append(data)
return recipient_data
13 changes: 13 additions & 0 deletions mail_partner_forwarding/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

forwarding_partner_id = fields.Many2one(
"res.partner",
string="Forwarding Partner",
help="Messages will be forwarded only for partners that are followers but no"
" partners being notify because they belong to channel that is following"
" the thread",
)
17 changes: 17 additions & 0 deletions mail_partner_forwarding/models/res_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from odoo import fields, models


class ResUsers(models.Model):
_inherit = "res.users"

forwarding_partner_id = fields.Many2one(
related="partner_id.forwarding_partner_id", readonly=False
)

@property
def SELF_WRITEABLE_FIELDS(self):
return super().SELF_WRITEABLE_FIELDS + ["forwarding_partner_id"]

@property
def SELF_READABLE_FIELDS(self):
return super().SELF_READABLE_FIELDS + ["forwarding_partner_id"]
3 changes: 3 additions & 0 deletions mail_partner_forwarding/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions mail_partner_forwarding/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Nicolás Mac Rouillon \<<nmr@adhoc.com.ar>\>
3 changes: 3 additions & 0 deletions mail_partner_forwarding/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module allows to select a related user (called "Forwarding
partner") in each partner in order to send all the notifications to the
Forwarding partner.
3 changes: 3 additions & 0 deletions mail_partner_forwarding/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 13.0.1.0.0 (2022-01-03)

- \[NEW\] Module in v13.
5 changes: 5 additions & 0 deletions mail_partner_forwarding/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

- Install it.
- Set a Forwarding partner in your partner.
- Your Forwarding partner also will be notify of your notifications
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading