From 4eb408bcea2362df0a2c9986b11ce8f69ee51c3c Mon Sep 17 00:00:00 2001 From: david Date: Fri, 6 Nov 2020 16:56:02 +0100 Subject: [PATCH] [IMP] rma, rma_sale: shipping address Allow to set the desired shipping address where the goods must be returned after the RMA is processed. --- rma_sale/controllers/sale_portal.py | 7 +++- rma_sale/views/sale_portal_template.xml | 42 +++++++++++++++++++ rma_sale/wizard/sale_order_rma_wizard.py | 14 +++++++ .../wizard/sale_order_rma_wizard_views.xml | 5 +++ 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/rma_sale/controllers/sale_portal.py b/rma_sale/controllers/sale_portal.py index 7ea70a3a..b587abcc 100644 --- a/rma_sale/controllers/sale_portal.py +++ b/rma_sale/controllers/sale_portal.py @@ -27,6 +27,7 @@ class CustomerPortal(CustomerPortal): wizard_obj = request.env["sale.order.rma.wizard"] # Set wizard line vals mapped_vals = {} + partner_shipping_id = post.pop("partner_shipping_id", False) for name, value in post.items(): row, field_name = name.split("-", 1) mapped_vals.setdefault(row, {}).update({field_name: value}) @@ -38,7 +39,11 @@ class CustomerPortal(CustomerPortal): order = order_obj.browse(order_id).sudo() location_id = order.warehouse_id.rma_loc_id.id wizard = wizard_obj.with_context(active_id=order_id).create( - {"line_ids": line_vals, "location_id": location_id} + { + "line_ids": line_vals, + "location_id": location_id, + "partner_shipping_id": partner_shipping_id, + } ) rma = wizard.sudo().create_rma(from_portal=True) for rec in rma: diff --git a/rma_sale/views/sale_portal_template.xml b/rma_sale/views/sale_portal_template.xml index 8260b9c7..78de3dc4 100644 --- a/rma_sale/views/sale_portal_template.xml +++ b/rma_sale/views/sale_portal_template.xml @@ -67,6 +67,48 @@ + + +
+
+ +
+
+ +