From 170400096e40626519bc7539d5300943397f6587 Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Tue, 1 Dec 2020 09:37:45 -0500 Subject: [PATCH] [IMP] rma: Add customer as suggested recipient --- rma/__manifest__.py | 2 +- rma/i18n/es.po | 2 ++ rma/i18n/pt_BR.po | 2 ++ rma/i18n/rma.pot | 2 ++ rma/models/rma.py | 13 ++++++++++++- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/rma/__manifest__.py b/rma/__manifest__.py index ecc7ce28..aac3ec2c 100644 --- a/rma/__manifest__.py +++ b/rma/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Return Merchandise Authorization Management", "summary": "Return Merchandise Authorization (RMA)", - "version": "13.0.1.0.0", + "version": "13.0.1.0.1", "development_status": "Production/Stable", "category": "RMA", "website": "https://github.com/OCA/rma", diff --git a/rma/i18n/es.po b/rma/i18n/es.po index cbea57be..1388d618 100644 --- a/rma/i18n/es.po +++ b/rma/i18n/es.po @@ -466,7 +466,9 @@ msgid "Created on" msgstr "Creado el" #. module: rma +#: code:addons/rma/models/rma.py:0 #: model:ir.model.fields,field_description:rma.field_rma__partner_id +#, python-format msgid "Customer" msgstr "Cliente" diff --git a/rma/i18n/pt_BR.po b/rma/i18n/pt_BR.po index c7e484c0..7a06f38f 100644 --- a/rma/i18n/pt_BR.po +++ b/rma/i18n/pt_BR.po @@ -446,7 +446,9 @@ msgid "Created on" msgstr "Criado em" #. module: rma +#: code:addons/rma/models/rma.py:0 #: model:ir.model.fields,field_description:rma.field_rma__partner_id +#, python-format msgid "Customer" msgstr "Cliente" diff --git a/rma/i18n/rma.pot b/rma/i18n/rma.pot index 36cce617..de5d61ab 100644 --- a/rma/i18n/rma.pot +++ b/rma/i18n/rma.pot @@ -424,7 +424,9 @@ msgid "Created on" msgstr "" #. module: rma +#: code:addons/rma/models/rma.py:0 #: model:ir.model.fields,field_description:rma.field_rma__partner_id +#, python-format msgid "Customer" msgstr "" diff --git a/rma/models/rma.py b/rma/models/rma.py index 78b19acb..8e7ddf4c 100644 --- a/rma/models/rma.py +++ b/rma/models/rma.py @@ -4,7 +4,7 @@ from collections import Counter 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 @@ -1135,6 +1135,17 @@ class Rma(models.Model): self_with_context = self.with_context(mail_post_autofollow=True) return super(Rma, self_with_context).message_post(**kwargs) + 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()