[IMP] rma_sale: portal improvents

- Now it's possible to open several RMAs in a sale order from the portal
- A new comment button has been added to allow the portal user to enter
relevant information like serial numbers o issue description.
- If the requested operation isn't set no RMA will be opened
- The RMA product qty is now a numeric control with limits according to
the qty available to return

[FIX] rma,rma_sale: fix linter errors

[UPD] Update rma_sale.pot

rma_sale 12.0.1.4.0

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: rma-12.0/rma-12.0-rma_sale
Translate-URL: https://translation.odoo-community.org/projects/rma-12-0/rma-12-0-rma_sale/
This commit is contained in:
david
2020-08-28 16:54:59 +02:00
committed by Ernesto Tejeda
parent 2495758bd1
commit 303bd68070
11 changed files with 267 additions and 85 deletions

View File

@@ -64,6 +64,15 @@ The customer can also create RMAs from a sales order portal page:
#. Click on the 'Request RMAs' button and RMAs will be created linked to
the sales order.
Known issues / Roadmap
======================
* When you try to request an RMA from a Sales Order in the portal,
a popup appears and the inputs for the quantity doesn't allow
decimal numbers. It would be good to have a component that allows
that and at the same time keeps the constraint of not allowing a
number greater than the order line product quantity.
Bug Tracker
===========

View File

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

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import http, _
from odoo.exceptions import AccessError, MissingError
@@ -23,7 +23,10 @@ class CustomerPortal(CustomerPortal):
for name, value in post.items():
row, field_name = name.split('-', 1)
mapped_vals.setdefault(row, {}).update({field_name: value})
line_vals = [(0, 0, vals) for vals in mapped_vals.values()]
# If no operation is filled, no RMA will be created
line_vals = [
(0, 0, vals) for vals in mapped_vals.values()
if vals.get("operation_id")]
# Create wizard an generate rmas
order = order_obj.browse(order_id).sudo()
location_id = order.warehouse_id.rma_loc_id.id
@@ -31,7 +34,7 @@ class CustomerPortal(CustomerPortal):
'line_ids': line_vals,
'location_id': location_id
})
rma = wizard.sudo().create_rma(from_portal=True)
rma = wizard.sudo().create_rma()
for rec in rma:
rec.origin += _(' (Portal)')
# Add the user as follower of the created RMAs so they can

View File

@@ -18,19 +18,19 @@ msgstr ""
"X-Generator: Weblate 3.10\n"
#. module: rma_sale
#: code:addons/rma_sale/controllers/sale_portal.py:36
#: code:addons/rma_sale/controllers/sale_portal.py:39
#, python-format
msgid " (Portal)"
msgstr ""
#. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:45
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:42
#, python-format
msgid " has been created."
msgstr " ha sido creado."
#. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:47
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:44
#, python-format
msgid " have been created."
msgstr " han sido creados."
@@ -61,22 +61,6 @@ msgid ""
"<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"<span>\n"
" If an RMA has already been created for a "
"product in this sales order, it will not\n"
" be possible to create another one from the "
"web portal.\n"
" </span>"
msgstr ""
"<span>\n"
" Si ya se ha creado un RMA para un producto "
"de esta orden de venta, no será\n"
" posible crear otro desde el portal web.\n"
" </span>"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid "<span>RMA</span>"
@@ -141,6 +125,13 @@ msgstr "Categoría"
msgid "Close"
msgstr "Cerrar"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"Comment anything relevant to the return, like serial numbers, a description "
"of the issue, etc"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid ""
@@ -185,6 +176,11 @@ msgstr "Entrega"
msgid "Delivery order"
msgstr "Orden de entrega"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__description
msgid "Description"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__display_name
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__display_name
@@ -197,6 +193,11 @@ msgstr "Nombre mostrado"
msgid "ID"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "If no requested operation is set, the RMA won't be correctly fulfilled"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard____last_update
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard____last_update
@@ -307,27 +308,76 @@ msgstr "Asistente de Orden de Venta - RMA"
msgid "Sales Order Line"
msgstr "Línea de pedido de venta"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "Select the product quantity and the requested operation"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de existencias"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "The limit will decrease when the units in other RMAs are confirmed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__uom_id
msgid "Unit of Measure"
msgstr "Unidad de medida"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"Use the comment button to add relevant information regarding the RMA, like "
"returned serial numbers or a description of the issue"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"
msgstr "Asistente"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"You can only return as much product units as you received for this order"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "You can send a message in every RMA sent"
msgstr ""
#. module: rma_sale
#: code:addons/rma_sale/models/sale.py:34
#, python-format
msgid "You may only create RMAs from a confirmed or done sale order."
msgstr "Solo puedes crear RMAs desde una orden de venta confirmada o hecha."
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"You're about to perform an RMA request. Our team will process it an will "
"reach you once it's validated. Keep in mind that:"
msgstr ""
#~ msgid ""
#~ "<span>\n"
#~ " If an RMA has already been created for a "
#~ "product in this sales order, it will not\n"
#~ " be possible to create another one from "
#~ "the web portal.\n"
#~ " </span>"
#~ msgstr ""
#~ "<span>\n"
#~ " Si ya se ha creado un RMA para un "
#~ "producto de esta orden de venta, no será\n"
#~ " posible crear otro desde el portal web.\n"
#~ " </span>"
#~ msgid "Domain Move"
#~ msgstr "Dominio de movimientos"

View File

@@ -17,19 +17,19 @@ msgstr ""
"X-Generator: Weblate 3.10\n"
#. module: rma_sale
#: code:addons/rma_sale/controllers/sale_portal.py:36
#: code:addons/rma_sale/controllers/sale_portal.py:39
#, python-format
msgid " (Portal)"
msgstr " (Portal)"
#. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:45
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:42
#, python-format
msgid " has been created."
msgstr " foi criado(a)."
#. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:47
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:44
#, python-format
msgid " have been created."
msgstr " foi criado(a)."
@@ -61,23 +61,6 @@ msgid ""
msgstr ""
"<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"<span>\n"
" If an RMA has already been created for a "
"product in this sales order, it will not\n"
" be possible to create another one from the "
"web portal.\n"
" </span>"
msgstr ""
"<span>\n"
" Se um RMA já houver sido criado para um "
"produto no pedido de venda,\n"
" não será possível criar outro através do "
"portal web.\n"
" </span>"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid "<span>RMA</span>"
@@ -140,6 +123,13 @@ msgstr "Categoria"
msgid "Close"
msgstr "Encerrar"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"Comment anything relevant to the return, like serial numbers, a description "
"of the issue, etc"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid ""
@@ -183,6 +173,11 @@ msgstr "Entrega"
msgid "Delivery order"
msgstr "Ordem de Entrega"
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__description
msgid "Description"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__display_name
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__display_name
@@ -195,6 +190,11 @@ msgstr "Exibir Nome"
msgid "ID"
msgstr "ID"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "If no requested operation is set, the RMA won't be correctly fulfilled"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard____last_update
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard____last_update
@@ -305,21 +305,49 @@ msgstr "Assistente do Pedido de Venda RMA"
msgid "Sales Order Line"
msgstr "Linha do Pedido de Venda"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "Select the product quantity and the requested operation"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "The limit will decrease when the units in other RMAs are confirmed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__uom_id
msgid "Unit of Measure"
msgstr "Unidade de Medida"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"Use the comment button to add relevant information regarding the RMA, like "
"returned serial numbers or a description of the issue"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"
msgstr "Assistente"
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"You can only return as much product units as you received for this order"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "You can send a message in every RMA sent"
msgstr ""
#. module: rma_sale
#: code:addons/rma_sale/models/sale.py:34
#, python-format
@@ -327,3 +355,25 @@ msgid "You may only create RMAs from a confirmed or done sale order."
msgstr ""
"Você só pode criar RMAs a partir de um pedido de venda confirmado ou "
"concluído."
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid ""
"You're about to perform an RMA request. Our team will process it an will "
"reach you once it's validated. Keep in mind that:"
msgstr ""
#~ msgid ""
#~ "<span>\n"
#~ " If an RMA has already been created for a "
#~ "product in this sales order, it will not\n"
#~ " be possible to create another one from "
#~ "the web portal.\n"
#~ " </span>"
#~ msgstr ""
#~ "<span>\n"
#~ " Se um RMA já houver sido criado para um "
#~ "produto no pedido de venda,\n"
#~ " não será possível criar outro através do "
#~ "portal web.\n"
#~ " </span>"

View File

@@ -14,19 +14,19 @@ msgstr ""
"Plural-Forms: \n"
#. module: rma_sale
#: code:addons/rma_sale/controllers/sale_portal.py:36
#: code:addons/rma_sale/controllers/sale_portal.py:39
#, python-format
msgid " (Portal)"
msgstr ""
#. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:45
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:42
#, python-format
msgid " has been created."
msgstr ""
#. module: rma_sale
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:47
#: code:addons/rma_sale/wizard/sale_order_rma_wizard.py:44
#, python-format
msgid " have been created."
msgstr ""
@@ -56,14 +56,6 @@ msgstr ""
msgid "<span class=\"fa fa-reply\" role=\"img\" aria-label=\"RMA\" title=\"RMA\"/>"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "<span>\n"
" If an RMA has already been created for a product in this sales order, it will not\n"
" be possible to create another one from the web portal.\n"
" </span>"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content
msgid "<span>RMA</span>"
@@ -126,6 +118,11 @@ msgstr ""
msgid "Close"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "Comment anything relevant to the return, like serial numbers, a description of the issue, etc"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,help:rma_sale.field_sale_order_line_rma_wizard__uom_category_id
msgid "Conversion between Units of Measure can only occur if they belong to the same category. The conversion will be made based on the ratios."
@@ -165,6 +162,11 @@ msgstr ""
msgid "Delivery order"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__description
msgid "Description"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__display_name
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard__display_name
@@ -177,6 +179,11 @@ msgstr ""
msgid "ID"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "If no requested operation is set, the RMA won't be correctly fulfilled"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard____last_update
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_rma_wizard____last_update
@@ -287,24 +294,54 @@ msgstr ""
msgid "Sales Order Line"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "Select the product quantity and the requested operation"
msgstr ""
#. module: rma_sale
#: model:ir.model,name:rma_sale.model_stock_move
msgid "Stock Move"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "The limit will decrease when the units in other RMAs are confirmed"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__uom_id
msgid "Unit of Measure"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "Use the comment button to add relevant information regarding the RMA, like returned serial numbers or a description of the issue"
msgstr ""
#. module: rma_sale
#: model:ir.model.fields,field_description:rma_sale.field_sale_order_line_rma_wizard__wizard_id
msgid "Wizard"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "You can only return as much product units as you received for this order"
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "You can send a message in every RMA sent"
msgstr ""
#. module: rma_sale
#: code:addons/rma_sale/models/sale.py:34
#, python-format
msgid "You may only create RMAs from a confirmed or done sale order."
msgstr ""
#. module: rma_sale
#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template
msgid "You're about to perform an RMA request. Our team will process it an will reach you once it's validated. Keep in mind that:"
msgstr ""

View File

@@ -74,15 +74,6 @@ class SaleOrder(models.Model):
data += line.prepare_sale_rma_data()
return data
def get_portal_delivery_rma_data(self):
self.ensure_one()
data = []
rma_product = self.rma_ids.mapped('product_id')
for line in self.order_line.filtered(
lambda r: r.product_id not in rma_product):
data += line.prepare_sale_rma_data()
return data
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

View File

@@ -0,0 +1,5 @@
* When you try to request an RMA from a Sales Order in the portal,
a popup appears and the inputs for the quantity doesn't allow
decimal numbers. It would be good to have a component that allows
that and at the same time keeps the constraint of not allowing a
number greater than the order line product quantity.

View File

@@ -376,11 +376,12 @@ order web portal page.</p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
@@ -414,8 +415,18 @@ the quantity per product and delivery order line.</li>
the sales order.</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>When you try to request an RMA from a Sales Order in the portal,
a popup appears and the inputs for the quantity doesnt allow
decimal numbers. It would be good to have a component that allows
that and at the same time keeps the constraint of not allowing a
number greater than the order line product quantity.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/rma/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
@@ -423,15 +434,15 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Ernesto Tejeda</li>
@@ -442,7 +453,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose

View File

@@ -17,13 +17,20 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close">&amp;times;</button>
</header>
<main class="modal-body" id="modal-body-request-rma">
<div class="text-muted mb-2 mb-sm-1">
<div class="alert alert-info mb-2 mb-sm-1" role="alert">
<span>
If an RMA has already been created for a product in this sales order, it will not
be possible to create another one from the web portal.
You're about to perform an RMA request. Our team will process it an will reach you once it's validated. Keep in mind that:
<ul>
<li>Select the product quantity and the requested operation</li>
<li>Use the comment button to add relevant information regarding the RMA, like returned serial numbers or a description of the issue</li>
<li>If no requested operation is set, the RMA won't be correctly fulfilled</li>
<li>You can only return as much product units as you received for this order</li>
<li>The limit will decrease when the units in other RMAs are confirmed</li>
<li>You can send a message in every RMA sent</li>
</ul>
</span>
</div>
<t t-set="data_list" t-value="sale_order.get_portal_delivery_rma_data()"/>
<t t-set="data_list" t-value="sale_order.get_delivery_rma_data()"/>
<t t-set="operations" t-value="sale_order.env['rma.operation'].search([])"/>
<table class="table table-sm" id="request-rma-table">
<thead class="bg-100">
@@ -32,6 +39,7 @@
<th class="text-right">Quantity</th>
<th class="text-left">Delivery</th>
<th class="text-left">Requested operation</th>
<th name="portal_rma_button_desc" />
</tr>
</thead>
<tbody class="request-rma-tbody">
@@ -46,12 +54,14 @@
</td>
<td class="text-right">
<div id="delivery-rma-qty">
<input type="text"
<input type="number"
t-attf-name="#{data_index}-quantity"
class="o_input text-right"
placeholder="Quantity"
t-att-value="data['quantity']"
style="max-width: 100px;"/>
placeholder="0"
min="0"
t-att-max="data['quantity']"
t-att-value="0"
style="max-width: 60px;"/>
<span t-esc="data['uom'].name" groups="uom.group_uom"/>
<input type="hidden"
t-attf-name="#{data_index}-uom_id"
@@ -75,6 +85,23 @@
</t>
</select>
</td>
<td>
<button
class="btn btn-primary fa fa-comments"
type="button" data-toggle="collapse"
t-attf-data-target="#comment-#{data_index}"
aria-expanded="false"
t-attf-aria-controls="comment-#{data_index}" />
</td>
</tr>
<tr class="collapse" t-attf-id="comment-#{data_index}">
<td colspan="5">
<textarea
class="form-control o_website_form_input"
t-attf-name="#{data_index}-description"
placeholder="Comment anything relevant to the return, like serial numbers, a description of the issue, etc"
/>
</td>
</tr>
</t>
</t>

View File

@@ -32,9 +32,6 @@ class SaleOrderRmaWizard(models.TransientModel):
def create_rma(self, from_portal=None):
self.ensure_one()
lines = self.line_ids.filtered(lambda r: r.quantity > 0.0)
if from_portal:
rma_product = self.order_id.rma_ids.mapped('product_id')
lines = lines.filtered(lambda r: r.product_id not in rma_product)
val_list = [line._prepare_rma_values() for line in lines]
rma = self.env['rma'].create(val_list)
# post messages
@@ -125,6 +122,7 @@ class SaleOrderLineRmaWizard(models.TransientModel):
comodel_name='rma.operation',
string='Requested operation',
)
description = fields.Text()
@api.onchange('product_id')
def onchange_product_id(self):
@@ -166,4 +164,5 @@ class SaleOrderLineRmaWizard(models.TransientModel):
'product_uom_qty': self.quantity,
'product_uom': self.uom_id.id,
'operation_id': self.operation_id.id,
'description': self.description,
}