From 5dbb8555357f9c4757d37d688d177aa3e2dfd01d Mon Sep 17 00:00:00 2001 From: david Date: Fri, 28 Aug 2020 16:54:59 +0200 Subject: [PATCH] [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/ --- rma_sale/README.rst | 9 +++ rma_sale/__manifest__.py | 2 +- rma_sale/controllers/sale_portal.py | 11 +-- rma_sale/i18n/es.po | 88 ++++++++++++++++++----- rma_sale/i18n/pt_BR.po | 90 ++++++++++++++++++------ rma_sale/i18n/rma_sale.pot | 59 +++++++++++++--- rma_sale/models/sale.py | 9 --- rma_sale/readme/ROADMAP.rst | 5 ++ rma_sale/static/description/index.html | 31 +++++--- rma_sale/views/sale_portal_template.xml | 43 ++++++++--- rma_sale/wizard/sale_order_rma_wizard.py | 5 +- 11 files changed, 267 insertions(+), 85 deletions(-) create mode 100644 rma_sale/readme/ROADMAP.rst diff --git a/rma_sale/README.rst b/rma_sale/README.rst index 1e67d920..992936bb 100644 --- a/rma_sale/README.rst +++ b/rma_sale/README.rst @@ -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 =========== diff --git a/rma_sale/__manifest__.py b/rma_sale/__manifest__.py index 43cb01d9..e3d3da72 100644 --- a/rma_sale/__manifest__.py +++ b/rma_sale/__manifest__.py @@ -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", diff --git a/rma_sale/controllers/sale_portal.py b/rma_sale/controllers/sale_portal.py index f7b32330..95c0460a 100644 --- a/rma_sale/controllers/sale_portal.py +++ b/rma_sale/controllers/sale_portal.py @@ -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 diff --git a/rma_sale/i18n/es.po b/rma_sale/i18n/es.po index 2cbe7902..1ca149b2 100644 --- a/rma_sale/i18n/es.po +++ b/rma_sale/i18n/es.po @@ -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 "" "" msgstr "" -#. module: rma_sale -#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template -msgid "" -"\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" -" " -msgstr "" -"\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" -" " - #. module: rma_sale #: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content msgid "RMA" @@ -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 "" +#~ "\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" +#~ " " +#~ msgstr "" +#~ "\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" +#~ " " + #~ msgid "Domain Move" #~ msgstr "Dominio de movimientos" diff --git a/rma_sale/i18n/pt_BR.po b/rma_sale/i18n/pt_BR.po index 3ee3696f..948a49bd 100644 --- a/rma_sale/i18n/pt_BR.po +++ b/rma_sale/i18n/pt_BR.po @@ -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 "" "" -#. module: rma_sale -#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template -msgid "" -"\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" -" " -msgstr "" -"\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" -" " - #. module: rma_sale #: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content msgid "RMA" @@ -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 "" +#~ "\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" +#~ " " +#~ msgstr "" +#~ "\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" +#~ " " diff --git a/rma_sale/i18n/rma_sale.pot b/rma_sale/i18n/rma_sale.pot index 609f6afe..66212562 100644 --- a/rma_sale/i18n/rma_sale.pot +++ b/rma_sale/i18n/rma_sale.pot @@ -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 "" msgstr "" -#. module: rma_sale -#: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_template -msgid "\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" -" " -msgstr "" - #. module: rma_sale #: model_terms:ir.ui.view,arch_db:rma_sale.sale_order_portal_content msgid "RMA" @@ -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 "" + diff --git a/rma_sale/models/sale.py b/rma_sale/models/sale.py index a9a9208d..a82f82e7 100644 --- a/rma_sale/models/sale.py +++ b/rma_sale/models/sale.py @@ -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" diff --git a/rma_sale/readme/ROADMAP.rst b/rma_sale/readme/ROADMAP.rst new file mode 100644 index 00000000..8d5d0f20 --- /dev/null +++ b/rma_sale/readme/ROADMAP.rst @@ -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. diff --git a/rma_sale/static/description/index.html b/rma_sale/static/description/index.html index aaaca20d..1f416779 100644 --- a/rma_sale/static/description/index.html +++ b/rma_sale/static/description/index.html @@ -376,11 +376,12 @@ order web portal page.

+
+

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

+

Bug Tracker

Bugs are tracked on GitHub Issues. 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

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Tecnativa
-

Contributors

+

Contributors

  • Tecnativa:
    • Ernesto Tejeda
    • @@ -442,7 +453,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose diff --git a/rma_sale/views/sale_portal_template.xml b/rma_sale/views/sale_portal_template.xml index fad64c85..c361b63f 100644 --- a/rma_sale/views/sale_portal_template.xml +++ b/rma_sale/views/sale_portal_template.xml @@ -17,13 +17,20 @@

-
+ - + @@ -32,6 +39,7 @@ + @@ -46,12 +54,14 @@ + + + +
Quantity Delivery Requested operation
- + placeholder="0" + min="0" + t-att-max="data['quantity']" + t-att-value="0" + style="max-width: 60px;"/>
+
+