diff --git a/rma/__manifest__.py b/rma/__manifest__.py index 56dc20b2..3bd4eab8 100644 --- a/rma/__manifest__.py +++ b/rma/__manifest__.py @@ -9,7 +9,7 @@ 'category': 'RMA', 'summary': 'Introduces the return merchandise authorization (RMA) process ' 'in odoo', - 'author': "Eficent", + 'author': "Eficent, Odoo Community Association (OCA)", 'website': 'http://www.github.com/OCA/rma', 'depends': ['stock', 'mail', 'procurement'], 'demo': ['demo/stock_demo.xml', diff --git a/rma/models/rma_order.py b/rma/models/rma_order.py index f23fab1f..97866ebd 100644 --- a/rma/models/rma_order.py +++ b/rma/models/rma_order.py @@ -171,7 +171,6 @@ class RmaOrder(models.Model): res = self.env.ref('rma.view_rma_line_form', False) else: res = self.env.ref('rma.view_rma_line_supplier_form', False) - result['views'] = [(res and res.id or False, 'form')] result['res_id'] = lines.id return result @@ -181,13 +180,14 @@ class RmaOrder(models.Model): action = self.env.ref('rma.action_rma_supplier_lines') result = action.read()[0] lines = self.rma_line_ids - related_lines = [line.id for line in lines.supplier_rma_line_ids] - # choose the view_mode accordingly - if len(related_lines) != 1: - result['domain'] = "[('id', 'in', " + \ - str(related_lines) + ")]" - elif len(related_lines) == 1: - res = self.env.ref('rma.view_rma_line_supplier_form', False) - result['views'] = [(res and res.id or False, 'form')] - result['res_id'] = related_lines[0] + for line_id in lines: + related_lines = [line.id for line in line_id.supplier_rma_line_ids] + # choose the view_mode accordingly + if len(related_lines) != 1: + result['domain'] = "[('id', 'in', " + \ + str(related_lines) + ")]" + elif len(related_lines) == 1: + res = self.env.ref('rma.view_rma_line_supplier_form', False) + result['views'] = [(res and res.id or False, 'form')] + result['res_id'] = related_lines[0] return result diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index ba807d50..5b06044a 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -372,21 +372,21 @@ class RmaOrderLine(models.Model): operation = self.env['rma.operation'].search( [('type', '=', self.type)], limit=1) if not operation: - raise ValidationError("Please define an operation first.") + raise ValidationError(_("Please define an operation first.")) if not operation.in_route_id or not operation.out_route_id: route = self.env['stock.location.route'].search( [('rma_selectable', '=', True)], limit=1) if not route: - raise ValidationError("Please define an RMA route.") + raise ValidationError(_("Please define an RMA route.")) if not operation.in_warehouse_id or not operation.out_warehouse_id: warehouse = self.env['stock.warehouse'].search( [('company_id', '=', self.company_id.id), ('lot_rma_id', '!=', False)], limit=1) if not warehouse: - raise ValidationError( - "Please define a warehouse with a default RMA location.") + raise ValidationError(_( + "Please define a warehouse with a default RMA location.")) data = { 'product_id': sm.product_id.id, diff --git a/rma/tests/test_rma.py b/rma/tests/test_rma.py index 9bca7104..0281349f 100644 --- a/rma/tests/test_rma.py +++ b/rma/tests/test_rma.py @@ -3,6 +3,7 @@ # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from odoo.tests import common +from odoo.exceptions import ValidationError class TestRma(common.TransactionCase): diff --git a/rma/tests/test_rma_dropship.py b/rma/tests/test_rma_dropship.py index 798d9a75..9f942f64 100644 --- a/rma/tests/test_rma_dropship.py +++ b/rma/tests/test_rma_dropship.py @@ -24,8 +24,9 @@ class TestRmaDropship(test_rma.TestRma): }).create({}) res = wizard.make_supplier_rma() supplier_rma = self.rma.browse(res['res_id']) - supplier_rma.action_rma_to_approve() - supplier_rma.action_rma_approve() + for line in supplier_rma.rma_line_ids: + line.action_rma_to_approve() + line.action_rma_approve() wizard = self.rma_make_picking.with_context({ 'active_id': 1, 'active_ids': supplier_rma.rma_line_ids.ids, @@ -89,3 +90,7 @@ class TestRmaDropship(test_rma.TestRma): "Wrong qty to supplier rma") self.assertEquals(line.qty_in_supplier_rma, 2, "Wrong qty in supplier rma") + for line in self.rma_droship_id.rma_line_ids: + line.action_rma_done() + self.assertEquals(line.state, 'done', + "Wrong State") diff --git a/rma/tests/test_supplier_rma.py b/rma/tests/test_supplier_rma.py index 8c83e039..107af6e3 100644 --- a/rma/tests/test_supplier_rma.py +++ b/rma/tests/test_supplier_rma.py @@ -2,7 +2,7 @@ # © 2017 Eficent Business and IT Consulting Services S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) -from odoo.addons.rma.tests import test_rma +from . import test_rma class TestSupplierRma(test_rma.TestRma): diff --git a/rma/views/procurement_view.xml b/rma/views/procurement_view.xml index a79015f6..91f55dd5 100644 --- a/rma/views/procurement_view.xml +++ b/rma/views/procurement_view.xml @@ -2,7 +2,7 @@ - + procurement.order.form procurement.order