Skip to content

Commit

Permalink
[MIG] mail_partner_forwarding: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelZilli authored and nicomacr committed Jan 2, 2023
1 parent 3b26697 commit 06aa4b3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mail_partner_forwarding/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Partner Mail Forwarding
:target: https://runbot.odoo-community.org/runbot/205/13.0
:alt: Try me on Runbot

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

This module allows to select a related partner (called "Forwarding Partner") in each partner in order to send all the notifications
to the Forwarding Partner.
Expand Down
2 changes: 1 addition & 1 deletion mail_partner_forwarding/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Partner Mail Forwarding",
"summary": "Forwarding notifications for partners",
"version": "13.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": "ADHOC SA, Odoo Community Association (OCA)",
Expand Down
10 changes: 5 additions & 5 deletions mail_partner_forwarding/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
class MailThread(models.AbstractModel):
_inherit = "mail.thread"

def _notify_compute_recipients(self, message, msg_vals):
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_compute_recipients(message, msg_vals)
if not recipient_data.get("partners", False):
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.get("partners")}
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
Expand Down Expand Up @@ -39,5 +39,5 @@ def _notify_compute_recipients(self, message, msg_vals):
"notif": notif,
}
)
recipient_data["partners"].append(data)
recipient_data.append(data)
return recipient_data
13 changes: 7 additions & 6 deletions mail_partner_forwarding/models/res_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class ResUsers(models.Model):
related="partner_id.forwarding_partner_id", readonly=False
)

def __init__(self, pool, cr):
super().__init__(pool, cr)
self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
self.SELF_WRITEABLE_FIELDS.append("forwarding_partner_id")
self.SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
self.SELF_READABLE_FIELDS.append("forwarding_partner_id")
@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"]

0 comments on commit 06aa4b3

Please sign in to comment.