From 5cf6f91ed2a7dfc72726ad781bf384367da0d5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Thu, 22 Sep 2022 09:08:27 +0200 Subject: [PATCH] [FIX] rma_sale: Allow to request a rma from portal order page only with portal user permission --- rma_sale/README.rst | 1 + rma_sale/controllers/sale_portal.py | 2 +- rma_sale/readme/CONTRIBUTORS.rst | 1 + rma_sale/static/description/index.html | 3 +- rma_sale/tests/test_rma_sale.py | 49 ++++++++++++++++++++++++-- 5 files changed, 52 insertions(+), 4 deletions(-) diff --git a/rma_sale/README.rst b/rma_sale/README.rst index 07a21163..e201a8ad 100644 --- a/rma_sale/README.rst +++ b/rma_sale/README.rst @@ -99,6 +99,7 @@ Contributors * Ernesto Tejeda * Pedro M. Baeza * David Vidal + * Víctor Martínez * Chafique Delli * Giovanni Serra - Ooops diff --git a/rma_sale/controllers/sale_portal.py b/rma_sale/controllers/sale_portal.py index 50a7d51d..05c07dcb 100644 --- a/rma_sale/controllers/sale_portal.py +++ b/rma_sale/controllers/sale_portal.py @@ -25,7 +25,7 @@ class CustomerPortal(CustomerPortal): except (AccessError, MissingError): return request.redirect("/my") order_obj = request.env["sale.order"] - wizard_obj = request.env["sale.order.rma.wizard"] + wizard_obj = request.env["sale.order.rma.wizard"].sudo() wizard_line_field_types = { f: d["type"] for f, d in wizard_obj.line_ids.fields_get().items() } diff --git a/rma_sale/readme/CONTRIBUTORS.rst b/rma_sale/readme/CONTRIBUTORS.rst index c93f1606..75646b6d 100644 --- a/rma_sale/readme/CONTRIBUTORS.rst +++ b/rma_sale/readme/CONTRIBUTORS.rst @@ -3,6 +3,7 @@ * Ernesto Tejeda * Pedro M. Baeza * David Vidal + * Víctor Martínez * Chafique Delli * Giovanni Serra - Ooops diff --git a/rma_sale/static/description/index.html b/rma_sale/static/description/index.html index 46d15790..dec02076 100644 --- a/rma_sale/static/description/index.html +++ b/rma_sale/static/description/index.html @@ -3,7 +3,7 @@ - + Return Merchandise Authorization Management - Link with Sales