[IMP] rma, rma_sale: shipping address

Allow to set the desired shipping address where the goods must be
returned after the RMA is processed.
This commit is contained in:
david
2020-11-06 16:56:02 +01:00
committed by Pedro M. Baeza
parent de75501cc5
commit 773a443e80
10 changed files with 173 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "Return Merchandise Authorization Management - Link with Sales",
"summary": "Sale Order - Return Merchandise Authorization (RMA)",
"version": "13.0.1.1.0",
"version": "13.0.1.2.0",
"development_status": "Production/Stable",
"category": "RMA",
"website": "https://github.com/OCA/rma",

View File

@@ -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:

View File

@@ -55,6 +55,11 @@ msgstr "<i class=\"fa fa-reply\"/> Solicitar RMAs"
msgid "<i class=\"fa fa-times\"/> Cancel"
msgstr "<i class=\"fa fa-times\"/> Cancelar"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "<i class=\"fa fa-truck\"/> Choose a delivery address"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid ""
@@ -133,6 +138,11 @@ msgstr ""
"Comente cualquier asunto relevante relacionado con la devolución, como "
"números de serie, descripción del problema, etc"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__commercial_partner_id
msgid "Commercial entity"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid ""
@@ -290,6 +300,7 @@ msgid "Requested operation"
msgstr "Operación solicitada"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_rma__sale_line_id
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__sale_line_id
msgid "Sale Line"
msgstr ""
@@ -324,6 +335,11 @@ msgstr "Línea de pedido de venta"
msgid "Select the product quantity and the requested operation"
msgstr "Selecciones la cantidad de producto y la operación solicitada"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Shipping Address"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
@@ -350,6 +366,11 @@ msgstr ""
"relacionada con el RMA, como números de serie devueltos o una descripción "
"del problema"
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Will be used to return the goods when the RMA is completed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"

View File

@@ -54,6 +54,11 @@ msgstr ""
msgid "<i class=\"fa fa-times\"/> Cancel"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "<i class=\"fa fa-truck\"/> Choose a delivery address"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid ""
@@ -131,6 +136,11 @@ msgstr ""
"Relevante opmerking voor de retour zending zoals; serie nummers, "
"probleemomschrijving, etc"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__commercial_partner_id
msgid "Commercial entity"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid ""
@@ -285,6 +295,7 @@ msgid "Requested operation"
msgstr "Verzochte handeling"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_rma__sale_line_id
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__sale_line_id
msgid "Sale Line"
msgstr ""
@@ -319,6 +330,11 @@ msgstr "verkoopregel"
msgid "Select the product quantity and the requested operation"
msgstr "Selecteer het productaantal en de gewenste handeling"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Shipping Address"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
@@ -344,6 +360,11 @@ msgstr ""
"Gebruik de onderstaande opmerkingen knop om relevante informatie over de RMA "
"in te vullen, zoals serienummer of een omschrijving van het probleem"
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Will be used to return the goods when the RMA is completed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"

View File

@@ -54,6 +54,11 @@ msgstr "<i class=\"fa fa-reply\"/> Requerer RMAs"
msgid "<i class=\"fa fa-times\"/> Cancel"
msgstr "<i class=\"fa fa-times\"/> Cancelar"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "<i class=\"fa fa-truck\"/> Choose a delivery address"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid ""
@@ -130,6 +135,11 @@ msgid ""
"of the issue, etc"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__commercial_partner_id
msgid "Commercial entity"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid ""
@@ -285,6 +295,7 @@ msgid "Requested operation"
msgstr "Operação Requisitada"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_rma__sale_line_id
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__sale_line_id
msgid "Sale Line"
msgstr ""
@@ -319,6 +330,11 @@ msgstr "Linha do Pedido de Venda"
msgid "Select the product quantity and the requested operation"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Shipping Address"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
@@ -341,6 +357,11 @@ msgid ""
"returned serial numbers or a description of the issue"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Will be used to return the goods when the RMA is completed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"

View File

@@ -51,6 +51,11 @@ msgstr ""
msgid "<i class=\"fa fa-times\"/> Cancel"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "<i class=\"fa fa-truck\"/> Choose a delivery address"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid "<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>"
@@ -125,6 +130,11 @@ msgid ""
"of the issue, etc"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__commercial_partner_id
msgid "Commercial entity"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid ""
@@ -278,6 +288,7 @@ msgid "Requested operation"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_rma__sale_line_id
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__sale_line_id
msgid "Sale Line"
msgstr ""
@@ -312,6 +323,11 @@ msgstr ""
msgid "Select the product quantity and the requested operation"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Shipping Address"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
@@ -334,6 +350,11 @@ msgid ""
"returned serial numbers or a description of the issue"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Will be used to return the goods when the RMA is completed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"

View File

@@ -55,6 +55,11 @@ msgstr "<i class=\"fa fa-reply\"/> Cerere retur"
msgid "<i class=\"fa fa-times\"/> Cancel"
msgstr "<i class=\"fa fa-times\"/> Anulat"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "<i class=\"fa fa-truck\"/> Choose a delivery address"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid ""
@@ -134,6 +139,11 @@ msgstr ""
"Menționează orice este relevant pentru returnare, cum ar fi numerele de "
"serie, o descriere a problemei etc."
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__commercial_partner_id
msgid "Commercial entity"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid ""
@@ -291,6 +301,7 @@ msgid "Requested operation"
msgstr "Operație solicitată"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_rma__sale_line_id
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__sale_line_id
msgid "Sale Line"
msgstr ""
@@ -325,6 +336,11 @@ msgstr "Linie comandă vânzare"
msgid "Select the product quantity and the requested operation"
msgstr "Selectați cantitatea produsului și operațiunea solicitată"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Shipping Address"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
@@ -350,6 +366,11 @@ msgstr ""
"privire la retur, cum ar fi numerele de serie returnate sau o descriere a "
"problemei"
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_rma_wizard__partner_shipping_id
msgid "Will be used to return the goods when the RMA is completed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"

View File

@@ -67,6 +67,48 @@
</ul>
</span>
</div>
<t
t-set="delivery_addresses"
t-value="sale_order.partner_id.commercial_partner_id.mapped('child_ids').filtered(lambda x: x.type in ['contact', 'delivery'])"
/>
<button
class="btn btn-primary btn-block mb8"
type="button"
data-toggle="collapse"
data-target="#delivery_address_picker"
aria-expanded="false"
><i
class="fa fa-truck"
/> Choose a delivery address</button>
<div
class="col-lg-12 collapse mt8"
id="delivery_address_picker"
>
<div data-toggle="buttons" class="row">
<label
t-attf-class="card mr4 btn btn-light"
t-foreach="delivery_addresses"
t-as="address"
>
<input
class="d-none"
type="radio"
name="partner_shipping_id"
t-att-value="address.id"
>
<strong>
<i
t-attf-class="text-secondary fa #{address.type == 'delivery' and 'fa-truck' or 'fa-user'}"
/>
<t t-esc="address.name" />
</strong>
<pre><h6
t-esc="address.contact_address"
/></pre>
</input>
</label>
</div>
</div>
<t
t-set="data_list"
t-value="sale_order.get_delivery_rma_data()"

View File

@@ -27,6 +27,16 @@ class SaleOrderRmaWizard(models.TransientModel):
domain=_domain_location_id,
default=lambda r: r.order_id.warehouse_id.rma_loc_id.id,
)
commercial_partner_id = fields.Many2one(
comodel_name="res.partner",
related="order_id.partner_id.commercial_partner_id",
string="Commercial entity",
)
partner_shipping_id = fields.Many2one(
comodel_name="res.partner",
string="Shipping Address",
help="Will be used to return the goods when the RMA is completed",
)
def create_rma(self, from_portal=None):
self.ensure_one()
@@ -147,9 +157,13 @@ class SaleOrderLineRmaWizard(models.TransientModel):
def _prepare_rma_values(self):
self.ensure_one()
partner_shipping = (
self.wizard_id.partner_shipping_id or self.order_id.partner_shipping_id
)
return {
"partner_id": self.order_id.partner_id.id,
"partner_invoice_id": self.order_id.partner_invoice_id.id,
"partner_shipping_id": partner_shipping.id,
"origin": self.order_id.name,
"company_id": self.order_id.company_id.id,
"location_id": self.wizard_id.location_id.id,

View File

@@ -31,6 +31,11 @@
</field>
</group>
<group>
<field name="commercial_partner_id" invisible="1" />
<field
name="partner_shipping_id"
domain="[('id', 'child_of', commercial_partner_id)]"
/>
<field
name="location_id"
options="{'no_create': True, 'no_open': True}"