From 296f49aa57025171f2ad245786801672f8c6559b Mon Sep 17 00:00:00 2001
From: david
Date: Thu, 20 Jan 2022 17:01:59 +0100
Subject: [PATCH 1/5] [IMP] rma_sale: avoid submit form in portal if no info
TT33572
---
rma_sale/static/src/js/rma_portal_form.js | 135 +++++++++++++++++-----
1 file changed, 107 insertions(+), 28 deletions(-)
diff --git a/rma_sale/static/src/js/rma_portal_form.js b/rma_sale/static/src/js/rma_portal_form.js
index f407ed47..1bda0788 100644
--- a/rma_sale/static/src/js/rma_portal_form.js
+++ b/rma_sale/static/src/js/rma_portal_form.js
@@ -4,42 +4,121 @@
odoo.define("rma_sale.animation", function (require) {
"use strict";
- var sAnimation = require("website.content.snippets.animation");
+ const publicWidget = require("web.public.widget");
- // In the customer portal when a RMA operation is selected show the comments
- // selector so the user doesn't miss the chance to add his comments
- sAnimation.registry.rma_operation_portal = sAnimation.Class.extend({
- selector: ".rma-operation",
- start: function () {
- this.id = this.el.name.replace("-operation_id", "");
- this.$comment = $("#comment-" + this.id);
- this.$comment_input = $("[name='" + this.id + "-description']");
- var _this = this;
- this.$el.on("change", function () {
- _this._onChangeOperationId();
- });
+ /**
+ * Adds some machinery to the customer portal RMA form:
+ *
+ * - Avoid submitting the form if no qty or operation is reported.
+ * - Show automatically the observations field when the operation is selected
+ * and hide it back with no operation selected.
+ */
+ publicWidget.registry.PortalRmaSale = publicWidget.Widget.extend({
+ selector: "#form-request-rma",
+ events: {
+ "change .rma-operation": "_onChangeOperationId",
+ "change #delivery-rma-qty input": "_onChangeQty",
},
- _show_comment: function () {
- if (this.$comment) {
- this.$comment.removeClass("show");
- this.$comment.addClass("show");
- if (this.$comment_input) {
- this.$comment_input.focus();
+
+ /**
+ * @override
+ */
+ start: function () {
+ const ids = this.$("[name*='-operation_id']")
+ .map(function () {
+ return this.name.replace("-operation_id", "");
+ })
+ .get();
+ this.$submit = $("#form-request-rma button[type='submit']");
+ this.rows_ids = ids;
+ // We'll build an object that will ease the form check. It could be further
+ // extended with additional checks.
+ this.rows = {};
+ _.each(ids, (id) => {
+ this.rows[id] = {
+ $comment: this.$(`#comment-${id}`),
+ $comment_input: this.$(`[name='${id}-description']`),
+ $operation: this.$(`[name='${id}-operation_id']`),
+ $qty: this.$(`[name='${id}-quantity']`),
+ };
+ });
+ this._checkCanSubmit();
+ },
+ /**
+ * @private
+ * @param {Object} row: the form row structure
+ */
+ _show_comment: function (row) {
+ if (row.$comment) {
+ row.$comment.addClass("show");
+ if (row.$comment_input) {
+ row.$comment_input.focus();
}
}
},
- _hide_comment: function () {
- if (this.$comment) {
- this.$comment.removeClass("show");
+ /**
+ * @private
+ * @param {Object} row: the form row structure
+ */
+ _hide_comment: function (row) {
+ if (row.$comment) {
+ row.$comment.removeClass("show");
}
},
- _onChangeOperationId: function () {
- // Toggle comment on or off if an operation is requested
- if (this.$el && this.$el.val()) {
- this._show_comment();
- } else {
- this._hide_comment();
+ /**
+ * We should be able to submit only when an operation is selected and a
+ * quantity entered in a row at least.
+ * @private
+ */
+ _canSubmit: function () {
+ var can_submit = false;
+ for (const id of this.rows_ids) {
+ const row = this.rows[id];
+ if (
+ row &&
+ // Qty greater than 0
+ row.$qty &&
+ row.$qty.val() &&
+ Number(row.$qty.val()) &&
+ // An operation is defined
+ row.$operation &&
+ row.$operation.val()
+ ) {
+ can_submit = true;
+ break;
+ }
}
+ return can_submit;
+ },
+ /**
+ * Checked every time we change the quantity or the operation and at start
+ *
+ * @private
+ * @param {Object} row: the form row structure
+ */
+ _checkCanSubmit: function () {
+ this.$submit.prop("disabled", !this._canSubmit());
+ },
+ /**
+ * @private
+ * @param {InputEvent} ev
+ */
+ _onChangeOperationId: function (ev) {
+ // Toggle comment on or off if an operation is requested
+ const id = ev.currentTarget.name.replace("-operation_id", "");
+ var row = this.rows[id];
+ if (row && row.$operation && row.$operation.val()) {
+ this._show_comment(row);
+ } else {
+ this._hide_comment(row);
+ }
+ this._checkCanSubmit();
+ },
+ /**
+ * @private
+ */
+ _onChangeQty: function () {
+ this._checkCanSubmit();
},
});
});
From e4e81d501e6712ac56377498ba17d127fa5dcd80 Mon Sep 17 00:00:00 2001
From: david
Date: Thu, 17 Feb 2022 13:06:56 +0100
Subject: [PATCH 2/5] [FIX] rma: refund permissions
Up to v12, account.invoice, was allowed for a wide variety of users. In
this version though, with account.move conversion, those permissions are
quite restricted.
We want to keep the possibility to open a refund for the RMA users.
Although only Invoicing users will be able to post it anyway.
TT34644
---
rma/models/rma.py | 6 ++++--
rma/security/ir.model.access.csv | 2 ++
rma/security/rma_security.xml | 17 +++++++++++++++++
rma/tests/test_rma.py | 12 +++++++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/rma/models/rma.py b/rma/models/rma.py
index b79c6903..bb2db4b6 100644
--- a/rma/models/rma.py
+++ b/rma/models/rma.py
@@ -649,7 +649,9 @@ class Rma(models.Model):
for rmas in group_dict.values():
origin = ", ".join(rmas.mapped("name"))
invoice_form = Form(
- self.env["account.move"].with_context(
+ self.env["account.move"]
+ .sudo()
+ .with_context(
default_move_type="out_refund",
company_id=rmas[0].company_id.id,
),
@@ -676,7 +678,7 @@ class Rma(models.Model):
}
)
refund.invoice_origin = origin
- refund.message_post_with_view(
+ refund.with_user(self.env.uid).message_post_with_view(
"mail.message_origin_link",
values={"self": refund, "origin": rmas},
subtype_id=self.env.ref("mail.mt_note").id,
diff --git a/rma/security/ir.model.access.csv b/rma/security/ir.model.access.csv
index 4955f969..0ab0e17b 100644
--- a/rma/security/ir.model.access.csv
+++ b/rma/security/ir.model.access.csv
@@ -14,3 +14,5 @@ access_rma_finalization_portal,rma.finalization.portal,model_rma_finalization,ba
access_rma_finalization_user_own,rma.finalization.user.own,model_rma_finalization,rma_group_user_own,1,0,0,0
access_rma_finalization_manager,rma.finalization.manager,model_rma_finalization,rma_group_manager,1,1,1,1
access_rma_finalization_wizard_user_own,rma.finalization.wizard.user.own,model_rma_finalization_wizard,group_rma_manual_finalization,1,1,1,1
+access_account_move_rma_user,account_move rma_user,account.model_account_move,rma.rma_group_user_own,1,0,0,0
+access_account_move_line_rma_user,account_move_line rma_user,account.model_account_move_line,rma.rma_group_user_own,1,0,0,0
diff --git a/rma/security/rma_security.xml b/rma/security/rma_security.xml
index f9c3ad48..54833bc1 100644
--- a/rma/security/rma_security.xml
+++ b/rma/security/rma_security.xml
@@ -91,6 +91,23 @@
name="domain_force"
> ['|', ('company_id', 'in', company_ids), ('company_id', '=', False)]
+
+
+ RMA Personal Invoice
+
+ [('move_type', '=', 'out_refund'), '|', ('invoice_user_id', '=', user.id), ('invoice_user_id', '=', False)]
+
+
+
+ RMA Personal Invoice Lines
+
+ [('move_id.move_type', '=', 'out_refund'), '|', ('move_id.invoice_user_id', '=', user.id), ('move_id.invoice_user_id', '=', False)]
+
+
diff --git a/rma/tests/test_rma.py b/rma/tests/test_rma.py
index 32243cdb..d373066f 100644
--- a/rma/tests/test_rma.py
+++ b/rma/tests/test_rma.py
@@ -2,13 +2,18 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.exceptions import UserError, ValidationError
-from odoo.tests import Form, SavepointCase
+from odoo.tests import Form, SavepointCase, new_test_user, users
class TestRma(SavepointCase):
@classmethod
def setUpClass(cls):
super(TestRma, cls).setUpClass()
+ cls.user_rma = new_test_user(
+ cls.env,
+ login="user_rma",
+ groups="rma.rma_group_user_own,stock.group_stock_user",
+ )
cls.res_partner = cls.env["res.partner"]
cls.product_product = cls.env["product.product"]
cls.company = cls.env.user.company_id
@@ -256,6 +261,7 @@ class TestRmaCase(TestRma):
self.assertEqual(rma_1.state, "draft")
self.assertEqual(rma_2.state, "received")
+ @users("__system__", "user_rma")
def test_action_refund(self):
rma = self._create_confirm_receive(self.partner, self.product, 10, self.rma_loc)
self.assertEqual(rma.state, "received")
@@ -272,6 +278,10 @@ class TestRmaCase(TestRma):
self.assertFalse(rma.can_be_refunded)
self.assertFalse(rma.can_be_returned)
self.assertFalse(rma.can_be_replaced)
+ # A regular user can create the refund but only Invoicing users will be able
+ # to edit it and post it
+ if self.env.user.login != "__system__":
+ return
with Form(rma.refund_line_id.move_id) as refund_form:
with refund_form.invoice_line_ids.edit(0) as refund_line:
refund_line.quantity = 9
From 7087d16a2023648b271d445e947885fda8f52391 Mon Sep 17 00:00:00 2001
From: david
Date: Tue, 22 Mar 2022 14:50:26 +0100
Subject: [PATCH 3/5] [FIX] rma_sale: subscribe portal users to RMA
notifications
TT35269
---
rma_sale/controllers/sale_portal.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/rma_sale/controllers/sale_portal.py b/rma_sale/controllers/sale_portal.py
index eb5ab385..967e12e4 100644
--- a/rma_sale/controllers/sale_portal.py
+++ b/rma_sale/controllers/sale_portal.py
@@ -67,9 +67,13 @@ class CustomerPortal(CustomerPortal):
rma = wizard.sudo().create_rma(from_portal=True)
for rec in rma:
rec.origin += _(" (Portal)")
- # Add the user as follower of the created RMAs so they can
- # later view them.
+ # Add the user as follower of the created RMAs so they can later view them.
rma.message_subscribe([request.env.user.partner_id.id])
+ # Subscribe the user to the notification subtype so he receives the confirmation
+ # note.
+ rma.message_follower_ids.filtered(
+ lambda x: x.partner_id == request.env.user.partner_id
+ ).subtype_ids += request.env.ref("rma.mt_rma_notification")
if len(rma) == 0:
route = order_sudo.get_portal_url()
else:
From eadf34e6f758ba1555e974dc6f21d2d94f5ff782 Mon Sep 17 00:00:00 2001
From: david
Date: Mon, 7 Mar 2022 17:40:03 +0100
Subject: [PATCH 4/5] [IMP] rma: optionally group returns to customer
TT34806
---
rma/README.rst | 8 +
rma/i18n/es.po | 320 +++++++++++-------------
rma/i18n/rma.pot | 2 +
rma/models/res_company.py | 4 +
rma/models/res_config_settings.py | 4 +
rma/models/rma.py | 9 +-
rma/readme/CONFIGURE.rst | 8 +
rma/static/description/index.html | 9 +-
rma/tests/test_rma.py | 35 +++
rma/views/res_config_settings_views.xml | 16 ++
rma/wizard/rma_delivery.py | 8 +-
rma/wizard/rma_delivery_views.xml | 4 +
12 files changed, 249 insertions(+), 178 deletions(-)
diff --git a/rma/README.rst b/rma/README.rst
index 5fa89305..b46e91f0 100644
--- a/rma/README.rst
+++ b/rma/README.rst
@@ -56,6 +56,14 @@ If you want to manually finish RMAs, you need to:
#. Go to *Settings > Inventory*.
#. Set *Finish RMAs manually* checkbox on.
+By default, returns to customer are grouped by shipping address, warehouse and company.
+If you want to avoid this grouping you can:
+
+#. Go to *Settings > Inventory*.
+#. Set *Group RMA returns by customer address and warehouse* checkbox off.
+
+The users will still be able to group those pickings from the wizard.
+
Usage
=====
diff --git a/rma/i18n/es.po b/rma/i18n/es.po
index b932f1a0..9d8d1a76 100644
--- a/rma/i18n/es.po
+++ b/rma/i18n/es.po
@@ -10,7 +10,6 @@ msgstr ""
"PO-Revision-Date: 2022-01-17 12:39+0000\n"
"Last-Translator: xavigutipujol \n"
"Language-Team: \n"
-"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -22,12 +21,12 @@ msgstr ""
#: model:mail.template,report_name:rma.mail_template_rma_notification
#: model:mail.template,report_name:rma.mail_template_rma_receipt_notification
msgid "${(object.name or '')}"
-msgstr ""
+msgstr "${(object.name or '')}"
#. module: rma
#: model:mail.template,subject:rma.mail_template_rma_notification
msgid "${object.company_id.name} RMA (Ref ${object.name or 'n/a' })"
-msgstr ""
+msgstr "${object.company_id.name} RMA (Ref ${object.name or 'n/a' })"
#. module: rma
#: model:mail.template,subject:rma.mail_template_rma_receipt_notification
@@ -42,11 +41,10 @@ msgstr ""
#. module: rma
#: model:mail.template,subject:rma.mail_template_rma_draft_notification
msgid ""
-"${object.company_id.name} Your RMA has been succesfully created (Ref "
-"${object.name or 'n/a' })"
+"${object.company_id.name} Your RMA has been succesfully created (Ref ${object.name or 'n/"
+"a' })"
msgstr ""
-"${object.company_id.name} Su RMA se ha creado con éxito (Ref ${object.name "
-"or 'n/a' })"
+"${object.company_id.name} Su RMA se ha creado con éxito (Ref ${object.name or 'n/a' })"
#. module: rma
#: code:addons/rma/models/rma_team.py:0
@@ -64,8 +62,8 @@ msgstr ""
#, python-format
msgid "E-mail subject: %s
E-mail body:
%s"
msgstr ""
-"Asunto del correo electrónico: %s
Cuerpo del correo "
-"electrónico:
%s"
+"Asunto del correo electrónico: %s
Cuerpo del correo electrónico:
%s"
#. module: rma
#: model:mail.template,body_html:rma.mail_template_rma_notification
@@ -77,8 +75,7 @@ msgid ""
" (${object.partner_id.parent_id.name})\n"
" % endif\n"
"
\n"
-" Here is the RMA ${object.name} from ${object.company_id."
-"name}.\n"
+" Here is the RMA ${object.name} from ${object.company_id.name}.\n"
"
\n"
" Do not hesitate to contact us if you have any question.\n"
"
\n"
@@ -92,8 +89,7 @@ msgstr ""
" (${object.partner_id.parent_id.name})\n"
" % endif\n"
"
\n"
-" Aquí tiene el RMA ${object.name} Desde ${object."
-"company_id.name}.\n"
+" Aquí tiene el RMA ${object.name} Desde ${object.company_id.name}.\n"
"
\n"
" No dude en ponerse en contacto con nosotros si tiene alguna pregunta.\n"
"\n"
@@ -170,12 +166,9 @@ msgstr ""
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
-msgid ""
-""
+msgid ""
msgstr ""
-""
+""
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
@@ -194,63 +187,63 @@ msgstr "Esperando Pago"
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
msgid ""
-""
-msgstr ""
-""
-
-#. module: rma
-#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
-msgid ""
-""
msgstr ""
-""
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
msgid ""
-" Cancelled"
+""
msgstr ""
-"Cancelado"
+""
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
msgid ""
-" Preparation"
+" "
+"Cancelled"
msgstr ""
-"Preparación"
+"Cancelado"
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
msgid ""
-" Shipped"
+" "
+"Preparation"
msgstr ""
-" Enviado"
+"Preparación"
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
msgid ""
-" Partially Available"
+" "
+"Shipped"
msgstr ""
-"Disponible parcialmente"
+" "
+"Enviado"
+
+#. module: rma
+#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
+msgid ""
+" "
+"Partially Available"
+msgstr ""
+"Disponible parcialmente"
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.res_config_settings_view_form
msgid ""
-""
+""
msgstr ""
+""
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.portal_rma_page
@@ -376,11 +369,11 @@ msgstr "Estado:"
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__alias_defaults
msgid ""
-"A Python dictionary that will be evaluated to provide default values when "
-"creating new records for this alias."
+"A Python dictionary that will be evaluated to provide default values when creating new "
+"records for this alias."
msgstr ""
-"Diccionario Python a evaluar para proporcionar valores por defecto cuando un "
-"nuevo registro se cree para este seudónimo."
+"Diccionario Python a evaluar para proporcionar valores por defecto cuando un nuevo "
+"registro se cree para este seudónimo."
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.rma_team_view_form
@@ -808,9 +801,7 @@ msgstr "Enviar correo al cliente una vez se recepcionen los productos del RMA."
#: model:ir.model.fields,help:rma.field_res_company__rma_mail_draft_confirmation_template_id
#: model:ir.model.fields,help:rma.field_res_config_settings__rma_mail_draft_confirmation_template_id
msgid "Email sent to the customer when they place an RMA from the portal"
-msgstr ""
-"Enviar correo de confirmación al cliente una vez se tramite el RMA desde el "
-"portal"
+msgstr "Enviar correo de confirmación al cliente una vez se tramite el RMA desde el portal"
#. module: rma
#: code:addons/rma/wizard/rma_split.py:0
@@ -914,14 +905,26 @@ msgstr "Agrupar por"
msgid "ID"
msgstr ""
+#. module: rma
+#: model:ir.model.fields,field_description:rma.field_res_company__rma_return_grouping
+#: model:ir.model.fields,field_description:rma.field_res_config_settings__rma_return_grouping
+#: model:ir.model.fields,field_description:rma.field_rma_delivery_wizard__rma_return_grouping
+msgid "Group RMA returns by customer address and warehouse"
+msgstr "Agrupar las devoluciones de RMA a cliente por dirección de envío y almacén"
+
+#. module: rma
+#: model_terms:ir.ui.view,arch_db:rma.res_config_settings_view_form
+msgid "Group RMA returns by customer and warehouse."
+msgstr "Agrupar las devoluciones de RMA a cliente por dirección de envío y almacén"
+
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__alias_parent_thread_id
msgid ""
-"ID of the parent record holding the alias (example: project holding the task "
-"creation alias)"
+"ID of the parent record holding the alias (example: project holding the task creation "
+"alias)"
msgstr ""
-"ID del registro padre que tiene el seudónimo. (ejemplo: el proyecto que "
-"contiene el seudónimo para la creación de tareas)"
+"ID del registro padre que tiene el seudónimo. (ejemplo: el proyecto que contiene el "
+"seudónimo para la creación de tareas)"
#. module: rma
#: model:ir.model.fields,field_description:rma.field_rma__activity_exception_icon
@@ -959,11 +962,10 @@ msgstr ""
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__active
msgid ""
-"If the active field is set to false, it will allow you to hide the RMA Team "
-"without removing it."
+"If the active field is set to false, it will allow you to hide the RMA Team without "
+"removing it."
msgstr ""
-"Si el campo activo se establece a Falso, permitirá ocultar El equipo de RMA "
-"sin eliminarlo."
+"Si el campo activo se establece a Falso, permitirá ocultar El equipo de RMA sin eliminarlo."
#. module: rma
#: code:addons/rma/models/rma.py:0
@@ -1078,19 +1080,17 @@ msgstr "Adjuntos principales"
#. module: rma
#: model_terms:ir.actions.act_window,help:rma.action_rma_finalization
msgid ""
-"Manage RMA finalization reasons to better classify them for tracking and "
-"analysis purposes."
+"Manage RMA finalization reasons to better classify them for tracking and analysis purposes."
msgstr ""
-"Adminitrar motivos de finalización de RMA para una mejor clasificación de "
-"estos para su seguimiento análisis posterior."
+"Adminitrar motivos de finalización de RMA para una mejor clasificación de estos para su "
+"seguimiento análisis posterior."
#. module: rma
#: model_terms:ir.actions.act_window,help:rma.action_rma_tag
-msgid ""
-"Manage RMA tags to better classify them for tracking and analysis purposes."
+msgid "Manage RMA tags to better classify them for tracking and analysis purposes."
msgstr ""
-"Administrar etiquetas de RMA para clasificarlos de modo que mejore el "
-"seguimiento y análisis de los mismos."
+"Administrar etiquetas de RMA para clasificarlos de modo que mejore el seguimiento y "
+"análisis de los mismos."
#. module: rma
#: model:ir.module.category,description:rma.rma_module_category
@@ -1199,13 +1199,12 @@ msgstr "Número de mensajes no leidos"
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__alias_force_thread_id
msgid ""
-"Optional ID of a thread (record) to which all incoming messages will be "
-"attached, even if they did not reply to it. If set, this will disable the "
-"creation of new records completely."
+"Optional ID of a thread (record) to which all incoming messages will be attached, even if "
+"they did not reply to it. If set, this will disable the creation of new records completely."
msgstr ""
-"Id. opcional de un hilo (registro) al que todos los mensajes entrantes serán "
-"adjuntados, incluso si no fueron respuestas del mismo. Si se establece, se "
-"deshabilitará completamente la creación de nuevos registros."
+"Id. opcional de un hilo (registro) al que todos los mensajes entrantes serán adjuntados, "
+"incluso si no fueron respuestas del mismo. Si se establece, se deshabilitará completamente "
+"la creación de nuevos registros."
#. module: rma
#: model:ir.ui.menu,name:rma.rma_orders_menu
@@ -1245,12 +1244,11 @@ msgstr "ID del hilo del registro padre"
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__alias_parent_model_id
msgid ""
-"Parent model holding the alias. The model holding the alias reference is not "
-"necessarily the model given by alias_model_id (example: project "
-"(parent_model) and task (model))"
+"Parent model holding the alias. The model holding the alias reference is not necessarily "
+"the model given by alias_model_id (example: project (parent_model) and task (model))"
msgstr ""
-"Modelo padre que contiene el alias. El modelo que contiene la referencia "
-"alias no es necesariamente el modelo dado por alias_model_id"
+"Modelo padre que contiene el alias. El modelo que contiene la referencia alias no es "
+"necesariamente el modelo dado por alias_model_id"
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.rma_view_search
@@ -1263,15 +1261,13 @@ msgid ""
"Policy to post a message on the document using the mailgateway.\n"
"- everyone: everyone can post\n"
"- partners: only authenticated partners\n"
-"- followers: only followers of the related document or members of following "
-"channels\n"
+"- followers: only followers of the related document or members of following channels\n"
msgstr ""
-"Política para publicar un mensaje en el documento utilizando el servidor de "
-"correo.\n"
+"Política para publicar un mensaje en el documento utilizando el servidor de correo.\n"
"- todo el mundo: todos pueden publicar\n"
"- socios: sólo socios autenticados\n"
-"- seguidores: sólo seguidores del documento relacionado o miembros de los "
-"siguientes canales\n"
+"- seguidores: sólo seguidores del documento relacionado o miembros de los siguientes "
+"canales\n"
#. module: rma
#: model:ir.model.fields,field_description:rma.field_rma__access_url
@@ -1330,12 +1326,8 @@ msgstr "Cantidad a extraer"
#. module: rma
#: code:addons/rma/models/rma.py:0
#, python-format
-msgid ""
-"Quantity to extract cannot be greater than remaining delivery quantity (%s "
-"%s)"
-msgstr ""
-"La cantidad a extraer no puede ser mayor que la cantidad de entrega "
-"restante(%s %s)"
+msgid "Quantity to extract cannot be greater than remaining delivery quantity (%s %s)"
+msgstr "La cantidad a extraer no puede ser mayor que la cantidad de entrega restante(%s %s)"
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_split_wizard__product_uom_qty
@@ -1343,13 +1335,11 @@ msgid "Quantity to extract to a new RMA."
msgstr "Cantidad a extraer en nuevo RMA."
#. module: rma
-#: model:ir.actions.act_window,name:rma.rma_action
-#: model:ir.model,name:rma.model_rma
+#: model:ir.actions.act_window,name:rma.rma_action model:ir.model,name:rma.model_rma
#: model:ir.model.fields,field_description:rma.field_account_move_line__rma_id
#: model:ir.model.fields,field_description:rma.field_rma_split_wizard__rma_id
#: model:ir.model.fields,field_description:rma.field_stock_warehouse__rma
-#: model:ir.module.category,name:rma.rma_module_category
-#: model:ir.ui.menu,name:rma.rma_menu
+#: model:ir.module.category,name:rma.rma_module_category model:ir.ui.menu,name:rma.rma_menu
#: model_terms:ir.ui.view,arch_db:rma.view_partner_form
#: model_terms:ir.ui.view,arch_db:rma.view_picking_form
msgid "RMA"
@@ -1481,8 +1471,7 @@ msgid "RMA Tag"
msgstr "Etiqueta RMA"
#. module: rma
-#: model:ir.actions.act_window,name:rma.action_rma_tag
-#: model:ir.model,name:rma.model_rma_tag
+#: model:ir.actions.act_window,name:rma.action_rma_tag model:ir.model,name:rma.model_rma_tag
#: model:ir.ui.menu,name:rma.rma_configuration_rma_tag_menu
#: model_terms:ir.ui.view,arch_db:rma.rma_tag_view_search
#: model_terms:ir.ui.view,arch_db:rma.view_rma_tag_list
@@ -1532,8 +1521,7 @@ msgstr "RMAs que originaron esta orden"
#. module: rma
#: model:ir.model.fields,help:rma.field_stock_warehouse__rma
msgid "RMA related products can be stored in this warehouse."
-msgstr ""
-"Productos relacionados con el RMA pueden ser guardados en este almacén."
+msgstr "Productos relacionados con el RMA pueden ser guardados en este almacén."
#. module: rma
#: model:ir.model,name:rma.model_rma_operation
@@ -1664,27 +1652,25 @@ msgstr "Reemplazado"
#: code:addons/rma/models/rma.py:0
#, python-format
msgid ""
-"Replacement: Move %s (Picking %s) has been created."
+"Replacement: Move %s "
+"(Picking %s) has been "
+"created."
msgstr ""
-"Reemplazo: El movimiento %s (Orden de entrega %s) ha sido creado."
+"Reemplazo: El movimiento %s"
+"a> (Orden de entrega %s"
+"a>) ha sido creado."
#. module: rma
#: code:addons/rma/models/rma.py:0
#, python-format
msgid ""
-"Replacement:
Product %s
Quantity %f %s
This replacement did not "
-"create a new move, but one of the previously created moves was updated with "
-"this data."
+"Replacement:
Product "
+"%s
Quantity %f %s
This replacement did not create a new move, but one of the "
+"previously created moves was updated with this data."
msgstr ""
-"Reemplazo:
Producto %s
Cantidad %f %s
El reemplazo realizado no creó un "
-"movimiento nuevo, pero uno de los movimientos creados anteriormente fué "
-"actualizado con estos datos."
+"Reemplazo:
Producto "
+"%s
Cantidad %f %s
El reemplazo realizado no creó un movimiento nuevo, pero uno "
+"de los movimientos creados anteriormente fué actualizado con estos datos."
#. module: rma
#: model:ir.ui.menu,name:rma.rma_reporting_menu
@@ -1729,11 +1715,11 @@ msgstr "Devolver al cliente"
#: code:addons/rma/models/rma.py:0
#, python-format
msgid ""
-"Return: %s"
-"a> has been created."
+"Return: %s has been "
+"created."
msgstr ""
-"Devolución: La orden de entrega %s ha sido creada."
+"Devolución: La orden de entrega %s ha sido creada."
#. module: rma
#: model:ir.model.fields.selection,name:rma.selection__rma__state__returned
@@ -1870,12 +1856,10 @@ msgstr "Dividir RMA"
#. module: rma
#: code:addons/rma/models/rma.py:0
#, python-format
-msgid ""
-"Split: %s has been "
-"created."
+msgid "Split: %s has been created."
msgstr ""
-"División: El RMA %s"
-"a> ha sido creado."
+"División: El RMA %s ha sido "
+"creado."
#. module: rma
#: model:ir.model.fields,field_description:rma.field_rma__state
@@ -1884,8 +1868,7 @@ msgid "State"
msgstr "Estado"
#. module: rma
-#: code:addons/rma/controllers/main.py:0
-#: model_terms:ir.ui.view,arch_db:rma.portal_my_rmas
+#: code:addons/rma/controllers/main.py:0 model_terms:ir.ui.view,arch_db:rma.portal_my_rmas
#, python-format
msgid "Status"
msgstr "Estado"
@@ -1957,46 +1940,44 @@ msgstr ""
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__alias_model_id
msgid ""
-"The model (Odoo Document Kind) to which this alias corresponds. Any incoming "
-"email that does not reply to an existing record will cause the creation of a "
-"new record of this model (e.g. a Project Task)"
+"The model (Odoo Document Kind) to which this alias corresponds. Any incoming email that "
+"does not reply to an existing record will cause the creation of a new record of this model "
+"(e.g. a Project Task)"
msgstr ""
-"El modelo (Tipo de documento de Odoo) al que corresponde este seudónimo. "
-"Cualquier correo entrante que no sea respuesta a un registro existente, "
-"causará la creación de un nuevo registro de este modelo"
+"El modelo (Tipo de documento de Odoo) al que corresponde este seudónimo. Cualquier correo "
+"entrante que no sea respuesta a un registro existente, causará la creación de un nuevo "
+"registro de este modelo"
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__alias_name
msgid ""
-"The name of the email alias, e.g. 'jobs' if you want to catch emails for "
-""
+"The name of the email alias, e.g. 'jobs' if you want to catch emails for "
msgstr ""
-"El nombre de este seudónimo de correo electrónico. Por ejemplo, \"trabajos"
-"\", si lo que quiere es obtener los correos para "
+"El nombre de este seudónimo de correo electrónico. Por ejemplo, \"trabajos\", si lo que "
+"quiere es obtener los correos para "
#. module: rma
#: model:ir.model.fields,help:rma.field_rma_team__alias_user_id
msgid ""
-"The owner of records created upon receiving emails on this alias. If this "
-"field is not set the system will attempt to find the right owner based on "
-"the sender (From) address, or will use the Administrator account if no "
-"system user is found for that address."
+"The owner of records created upon receiving emails on this alias. If this field is not set "
+"the system will attempt to find the right owner based on the sender (From) address, or "
+"will use the Administrator account if no system user is found for that address."
msgstr ""
-"El propietario de los registros creados al recibir correos electrónicos en "
-"este seudónimo. Si el campo no está establecido, el sistema tratará de "
-"encontrar el propietario adecuado basado en la dirección del emisor (De), o "
-"usará la cuenta de administrador si no se encuentra un usuario para esa "
-"dirección."
+"El propietario de los registros creados al recibir correos electrónicos en este seudónimo. "
+"Si el campo no está establecido, el sistema tratará de encontrar el propietario adecuado "
+"basado en la dirección del emisor (De), o usará la cuenta de administrador si no se "
+"encuentra un usuario para esa dirección."
#. module: rma
#: code:addons/rma/models/stock_move.py:0
#, python-format
msgid ""
-"The quantity done for the product '%s' must be equal to its initial demand "
-"because the stock move is linked to an RMA (%s)."
+"The quantity done for the product '%s' must be equal to its initial demand because the "
+"stock move is linked to an RMA (%s)."
msgstr ""
-"La cantidad realizada para el producto '%s' debe ser igual a la demanda "
-"inicial porque el movimiento está enlazado a un RMA (%s)."
+"La cantidad realizada para el producto '%s' debe ser igual a la demanda inicial porque el "
+"movimiento está enlazado a un RMA (%s)."
#. module: rma
#: code:addons/rma/models/rma.py:0
@@ -2013,11 +1994,11 @@ msgstr "La etiqueta es visible en la vista de portal"
#: code:addons/rma/models/account_move.py:0
#, python-format
msgid ""
-"There is at least one invoice lines whose quantity is less than the quantity "
-"specified in its linked RMA."
+"There is at least one invoice lines whose quantity is less than the quantity specified in "
+"its linked RMA."
msgstr ""
-"Hay al menos una linea de factura que tiene una cantidad menor que la "
-"cantidad especificada en el RMA asociado."
+"Hay al menos una linea de factura que tiene una cantidad menor que la cantidad "
+"especificada en el RMA asociado."
#. module: rma
#: code:addons/rma/models/rma.py:0
@@ -2159,8 +2140,8 @@ msgstr ""
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.res_config_settings_view_form
msgid ""
-"When customers themselves place an RMA from the portal, send an automatic "
-"notification acknowleging it."
+"When customers themselves place an RMA from the portal, send an automatic notification "
+"acknowleging it."
msgstr ""
#. module: rma
@@ -2177,22 +2158,19 @@ msgstr ""
#. module: rma
#: model_terms:ir.ui.view,arch_db:rma.res_config_settings_view_form
-msgid ""
-"When the RMA products are received, send an automatic information email."
+msgid "When the RMA products are received, send an automatic information email."
msgstr ""
#. module: rma
#: model:ir.model.fields,help:rma.field_res_company__send_rma_receipt_confirmation
#: model:ir.model.fields,help:rma.field_res_config_settings__send_rma_receipt_confirmation
-msgid ""
-"When the RMA receipt is confirmed, send a confirmation email to the customer."
+msgid "When the RMA receipt is confirmed, send a confirmation email to the customer."
msgstr ""
#. module: rma
#: model:ir.model.fields,help:rma.field_res_company__send_rma_confirmation
#: model:ir.model.fields,help:rma.field_res_config_settings__send_rma_confirmation
-msgid ""
-"When the delivery is confirmed, send a confirmation email to the customer."
+msgid "When the delivery is confirmed, send a confirmation email to the customer."
msgstr ""
#. module: rma
@@ -2205,18 +2183,14 @@ msgstr "No puede eliminar RMAs que no estén en estado borrador"
#: code:addons/rma/wizard/stock_picking_return.py:0
#, python-format
msgid ""
-"You must specify the 'Customer' in the 'Stock Picking' from which RMAs will "
-"be created"
+"You must specify the 'Customer' in the 'Stock Picking' from which RMAs will be created"
msgstr ""
-"Debe seleccionar el 'Cliente' en la 'Orden de Entrega' desde la cual los "
-"RMAs serán creados"
+"Debe seleccionar el 'Cliente' en la 'Orden de Entrega' desde la cual los RMAs serán creados"
#. module: rma
#: model:res.groups,comment:rma.rma_group_user_all
-msgid ""
-"the user will have access to all records of everyone in the RMA application."
-msgstr ""
-"El usuario tendrá acceso a todos los registros de RMA de todos lo usuarios."
+msgid "the user will have access to all records of everyone in the RMA application."
+msgstr "El usuario tendrá acceso a todos los registros de RMA de todos lo usuarios."
#. module: rma
#: model:res.groups,comment:rma.rma_group_user_own
@@ -2225,9 +2199,5 @@ msgstr "el usuario tendrá acceso solo a sus propios RMAs."
#. module: rma
#: model:res.groups,comment:rma.rma_group_manager
-msgid ""
-"the user will have an access to the RMA configuration as well as statistic "
-"reports."
-msgstr ""
-"El usuario tendrá acceso a la configuración de RMA y a los informes "
-"estadísticos."
+msgid "the user will have an access to the RMA configuration as well as statistic reports."
+msgstr "El usuario tendrá acceso a la configuración de RMA y a los informes estadísticos."
diff --git a/rma/i18n/rma.pot b/rma/i18n/rma.pot
index 5f5a30e0..9b814b67 100644
--- a/rma/i18n/rma.pot
+++ b/rma/i18n/rma.pot
@@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2022-03-07 16:33+0000\n"
+"PO-Revision-Date: 2022-03-07 16:33+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
diff --git a/rma/models/res_company.py b/rma/models/res_company.py
index 479e7e7c..94d274df 100644
--- a/rma/models/res_company.py
+++ b/rma/models/res_company.py
@@ -25,6 +25,10 @@ class Company(models.Model):
except ValueError:
return False
+ rma_return_grouping = fields.Boolean(
+ string="Group RMA returns by customer address and warehouse",
+ default=True,
+ )
send_rma_confirmation = fields.Boolean(
string="Send RMA Confirmation",
help="When the delivery is confirmed, send a confirmation email "
diff --git a/rma/models/res_config_settings.py b/rma/models/res_config_settings.py
index 7eae1ded..c06d9e59 100644
--- a/rma/models/res_config_settings.py
+++ b/rma/models/res_config_settings.py
@@ -11,6 +11,10 @@ class ResConfigSettings(models.TransientModel):
help="Allow to finish an RMA without returning back a product or refunding",
implied_group="rma.group_rma_manual_finalization",
)
+ rma_return_grouping = fields.Boolean(
+ related="company_id.rma_return_grouping",
+ readonly=False,
+ )
send_rma_confirmation = fields.Boolean(
related="company_id.send_rma_confirmation",
readonly=False,
diff --git a/rma/models/rma.py b/rma/models/rma.py
index bb2db4b6..4b8c4eba 100644
--- a/rma/models/rma.py
+++ b/rma/models/rma.py
@@ -1088,6 +1088,9 @@ class Rma(models.Model):
# Returning business methods
def create_return(self, scheduled_date, qty=None, uom=None):
"""Intended to be invoked by the delivery wizard"""
+ group_returns = self.env.company.rma_return_grouping
+ if "rma_return_grouping" in self.env.context:
+ group_returns = self.env.context.get("rma_return_grouping")
self._ensure_can_be_returned()
self._ensure_qty_to_return(qty, uom)
group_dict = {}
@@ -1100,7 +1103,11 @@ class Rma(models.Model):
)
group_dict.setdefault(key, self.env["rma"])
group_dict[key] |= record
- for rmas in group_dict.values():
+ if group_returns:
+ grouped_rmas = group_dict.values()
+ else:
+ grouped_rmas = rmas_to_return
+ for rmas in grouped_rmas:
origin = ", ".join(rmas.mapped("name"))
rma_out_type = rmas[0].warehouse_id.rma_out_type_id
picking_form = Form(
diff --git a/rma/readme/CONFIGURE.rst b/rma/readme/CONFIGURE.rst
index 94121f64..288531b1 100644
--- a/rma/readme/CONFIGURE.rst
+++ b/rma/readme/CONFIGURE.rst
@@ -11,3 +11,11 @@ If you want to manually finish RMAs, you need to:
#. Go to *Settings > Inventory*.
#. Set *Finish RMAs manually* checkbox on.
+
+By default, returns to customer are grouped by shipping address, warehouse and company.
+If you want to avoid this grouping you can:
+
+#. Go to *Settings > Inventory*.
+#. Set *Group RMA returns by customer address and warehouse* checkbox off.
+
+The users will still be able to group those pickings from the wizard.
diff --git a/rma/static/description/index.html b/rma/static/description/index.html
index c2e50115..7787916a 100644
--- a/rma/static/description/index.html
+++ b/rma/static/description/index.html
@@ -3,7 +3,7 @@
-
+
Return Merchandise Authorization Management