diff --git a/rma/models/rma.py b/rma/models/rma.py index ab95a420..9c3887cd 100644 --- a/rma/models/rma.py +++ b/rma/models/rma.py @@ -503,6 +503,7 @@ class Rma(models.Model): vals["team_id"] = self.env["rma.team"].search([], limit=1).id return super().create(vals) + @api.multi def copy(self, default=None): team = super().copy(default) for follower in self.message_follower_ids: diff --git a/rma/models/rma_team.py b/rma/models/rma_team.py index 018fa882..9a771705 100644 --- a/rma/models/rma_team.py +++ b/rma/models/rma_team.py @@ -1,7 +1,7 @@ # Copyright 2020 Tecnativa - Ernesto Tejeda # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import _, fields, models +from odoo import _, api, fields, models class RmaTeam(models.Model): @@ -37,7 +37,9 @@ class RmaTeam(models.Model): string='Team Members', ) + @api.multi def copy(self, default=None): + self.ensure_one() if default is None: default = {} if not default.get('name'): diff --git a/rma/models/stock_picking.py b/rma/models/stock_picking.py index e341be0b..bddb151d 100644 --- a/rma/models/stock_picking.py +++ b/rma/models/stock_picking.py @@ -1,7 +1,7 @@ # Copyright 2020 Tecnativa - Ernesto Tejeda # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import api, fields, models class StockPicking(models.Model): @@ -16,7 +16,9 @@ class StockPicking(models.Model): for rec in self: rec.rma_count = len(rec.move_lines.mapped('rma_ids')) + @api.multi def copy(self, default=None): + self.ensure_one() if self.env.context.get('set_rma_picking_type'): location_dest_id = default['location_dest_id'] warehouse = self.env['stock.warehouse'].search( diff --git a/rma/views/rma_views.xml b/rma/views/rma_views.xml index 16f646ff..f77660a6 100644 --- a/rma/views/rma_views.xml +++ b/rma/views/rma_views.xml @@ -279,7 +279,7 @@ - + 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/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/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

+ +
-

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;"/>
+
+