[IMP] rma: Add customer as suggested recipient

This commit is contained in:
Ernesto Tejeda
2020-11-30 08:57:00 -05:00
parent 5e70e26545
commit 49e0bb6d91

View File

@@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.exceptions import AccessError, ValidationError
from odoo.tests import Form
from odoo.tools import html2plaintext
import odoo.addons.decimal_precision as dp
@@ -1147,6 +1147,17 @@ class Rma(models.Model):
self_with_context = self.with_context(mail_post_autofollow=True)
return super(Rma, self_with_context).message_post(**kwargs)
@api.multi
def message_get_suggested_recipients(self):
recipients = super().message_get_suggested_recipients()
try:
for record in self.filtered("partner_id"):
record._message_add_suggested_recipient(
recipients, partner=record.partner_id, reason=_('Customer'))
except AccessError: # no read access rights
pass
return recipients
# Reporting business methods
def _get_report_base_filename(self):
self.ensure_one()