diff --git a/rma/__manifest__.py b/rma/__manifest__.py index 662d5b15..d10f0387 100644 --- a/rma/__manifest__.py +++ b/rma/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'RMA (Return Merchandise Authorization)', - 'version': '11.0.2.0.0', + 'version': '12.0.2.0.0', 'license': 'LGPL-3', 'category': 'RMA', 'summary': 'Introduces the return merchandise authorization (RMA) process ' diff --git a/rma/data/stock_data.xml b/rma/data/stock_data.xml index b9f100bd..cf1b7edd 100755 --- a/rma/data/stock_data.xml +++ b/rma/data/stock_data.xml @@ -141,9 +141,9 @@ - + Customer → RMA - move + pull @@ -152,9 +152,9 @@ - + RMA → Customer - move + pull @@ -163,9 +163,9 @@ - + RMA → Supplier - move + pull @@ -174,9 +174,9 @@ - + Supplier → RMA - move + pull @@ -185,9 +185,9 @@ - + Customer → Supplier - move + pull make_to_stock @@ -196,9 +196,9 @@ ref="rma.picking_type_rma_dropship_return"/> - + Supplier → Customer - move + pull make_to_stock diff --git a/rma/demo/stock_demo.xml b/rma/demo/stock_demo.xml index e3b4c2e8..1c37eefb 100755 --- a/rma/demo/stock_demo.xml +++ b/rma/demo/stock_demo.xml @@ -61,7 +61,7 @@ - + RMA Customer 10 @@ -71,7 +71,7 @@ - + RMA Supplier 10 @@ -81,7 +81,7 @@ - + RMA Dropship 10 @@ -92,9 +92,9 @@ - + Customer → Supplier - move + pull @@ -104,9 +104,9 @@ ref="rma.picking_type_rma_dropship_return"/> - + Supplier → Customer - move + pull @@ -117,8 +117,8 @@ - - + + diff --git a/rma/models/procurement.py b/rma/models/procurement.py index 36140e55..cdea89d5 100644 --- a/rma/models/procurement.py +++ b/rma/models/procurement.py @@ -5,7 +5,7 @@ from odoo import fields, models class ProcurementRule(models.Model): - _inherit = 'procurement.rule' + _inherit = 'stock.rule' rma_line_id = fields.Many2one( comodel_name='rma.order.line', string='RMA line', diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index 03f7e3ba..1a263fb9 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -70,7 +70,7 @@ class RmaOrderLine(models.Model): @api.multi def _get_rma_move_qty(self, states, direction='in'): for rec in self: - product_obj = self.env['product.uom'] + product_obj = self.env['uom.uom'] qty = 0.0 if direction == 'in': op = ops['='] @@ -238,7 +238,7 @@ class RmaOrderLine(models.Model): readonly=True, states={'draft': [('readonly', False)]}, ) uom_id = fields.Many2one( - comodel_name='product.uom', string='Unit of Measure', + comodel_name='uom.uom', string='Unit of Measure', required=True, readonly=True, states={'draft': [('readonly', False)]}, ) diff --git a/rma/models/stock_warehouse.py b/rma/models/stock_warehouse.py index 77465ab8..b5d92432 100644 --- a/rma/models/stock_warehouse.py +++ b/rma/models/stock_warehouse.py @@ -33,16 +33,16 @@ class StockWarehouse(models.Model): "for this warehouse.", ) rma_customer_in_pull_id = fields.Many2one( - comodel_name='procurement.rule', string="RMA Customer In Rule", + comodel_name='stock.rule', string="RMA Customer In Rule", ) rma_customer_out_pull_id = fields.Many2one( - comodel_name='procurement.rule', string="RMA Customer Out Rule", + comodel_name='stock.rule', string="RMA Customer Out Rule", ) rma_supplier_in_pull_id = fields.Many2one( - comodel_name='procurement.rule', string="RMA Supplier In Rule", + comodel_name='stock.rule', string="RMA Supplier In Rule", ) rma_supplier_out_pull_id = fields.Many2one( - comodel_name='procurement.rule', string="RMA Supplier Out Rule", + comodel_name='stock.rule', string="RMA Supplier Out Rule", ) @api.multi @@ -176,8 +176,10 @@ class StockWarehouse(models.Model): customer_loc, supplier_loc = self._get_partner_locations() # TODO: company_id? rma_rules['rma_customer_in'] = { - 'name': self._format_rulename(self, customer_loc, self.lot_rma_id), - 'action': 'move', + 'name': self._format_rulename(self, + customer_loc, + self.lot_rma_id.name), + 'action': 'pull', 'warehouse_id': self.id, 'location_src_id': customer_loc.id, 'location_id': self.lot_rma_id.id, @@ -187,8 +189,10 @@ class StockWarehouse(models.Model): 'active': True, } rma_rules['rma_customer_out'] = { - 'name': self._format_rulename(self, self.lot_rma_id, customer_loc), - 'action': 'move', + 'name': self._format_rulename(self, + self.lot_rma_id, + customer_loc.name), + 'action': 'pull', 'warehouse_id': self.id, 'location_src_id': self.lot_rma_id.id, 'location_id': customer_loc.id, @@ -198,8 +202,10 @@ class StockWarehouse(models.Model): 'active': True, } rma_rules['rma_supplier_in'] = { - 'name': self._format_rulename(self, supplier_loc, self.lot_rma_id), - 'action': 'move', + 'name': self._format_rulename(self, + supplier_loc, + self.lot_rma_id.name), + 'action': 'pull', 'warehouse_id': self.id, 'location_src_id': supplier_loc.id, 'location_id': self.lot_rma_id.id, @@ -209,8 +215,10 @@ class StockWarehouse(models.Model): 'active': True, } rma_rules['rma_supplier_out'] = { - 'name': self._format_rulename(self, self.lot_rma_id, supplier_loc), - 'action': 'move', + 'name': self._format_rulename(self, + self.lot_rma_id, + supplier_loc.name), + 'action': 'pull', 'warehouse_id': self.id, 'location_src_id': self.lot_rma_id.id, 'location_id': supplier_loc.id, @@ -222,7 +230,7 @@ class StockWarehouse(models.Model): return rma_rules def _create_or_update_rma_pull(self): - rule_obj = self.env['procurement.rule'] + rule_obj = self.env['stock.rule'] for wh in self: rules_dict = wh.get_rma_rules_dict() if wh.rma_customer_in_pull_id: diff --git a/rma/report/rma_report_templates.xml b/rma/report/rma_report_templates.xml index 698d60f5..2973c2d5 100644 --- a/rma/report/rma_report_templates.xml +++ b/rma/report/rma_report_templates.xml @@ -72,7 +72,7 @@ - + diff --git a/rma/tests/test_rma.py b/rma/tests/test_rma.py index eea469d0..a28f5c03 100644 --- a/rma/tests/test_rma.py +++ b/rma/tests/test_rma.py @@ -1,8 +1,8 @@ # © 2017 Eficent Business and IT Consulting Services S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) -from openerp.tests import common -from openerp.exceptions import ValidationError +from odoo.tests import common +from odoo.exceptions import ValidationError class TestRma(common.SavepointCase): @@ -27,9 +27,9 @@ class TestRma(common.SavepointCase): 'rma.rma_operation_ds_replace') cls.product_id = cls.env.ref('product.product_product_4') cls.product_1 = cls.env.ref('product.product_product_25') - cls.product_2 = cls.env.ref('product.product_product_17') + cls.product_2 = cls.env.ref('product.product_product_22') cls.product_3 = cls.env.ref('product.product_product_20') - cls.uom_unit = cls.env.ref('product.product_uom_unit') + cls.uom_unit = cls.env.ref('uom.product_uom_unit') # assign an operation cls.product_1.write( {'rma_customer_operation_id': cls.rma_cust_replace_op_id.id, @@ -48,7 +48,7 @@ class TestRma(common.SavepointCase): 'stock.stock_location_customers') cls.supplier_location = cls.env.ref( 'stock.stock_location_suppliers') - cls.product_uom_id = cls.env.ref('product.product_uom_unit') + cls.product_uom_id = cls.env.ref('uom.product_uom_unit') # Customer RMA: products2move = [(cls.product_1, 3), (cls.product_2, 5), (cls.product_3, 2)] diff --git a/rma/views/rma_order_line_view.xml b/rma/views/rma_order_line_view.xml index 09237814..de39fd12 100755 --- a/rma/views/rma_order_line_view.xml +++ b/rma/views/rma_order_line_view.xml @@ -15,7 +15,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -286,7 +286,7 @@ - + @@ -388,14 +388,14 @@ - + - - + + - + - + @@ -180,7 +180,7 @@ - + diff --git a/rma/wizards/rma_add_stock_move_view.xml b/rma/wizards/rma_add_stock_move_view.xml index df0b7e65..b599f0b6 100755 --- a/rma/wizards/rma_add_stock_move_view.xml +++ b/rma/wizards/rma_add_stock_move_view.xml @@ -17,7 +17,7 @@ - + diff --git a/rma/wizards/rma_make_picking.py b/rma/wizards/rma_make_picking.py index 54fae91d..792a9b23 100644 --- a/rma/wizards/rma_make_picking.py +++ b/rma/wizards/rma_make_picking.py @@ -254,5 +254,5 @@ class RmaMakePickingItem(models.TransientModel): qty_to_deliver = fields.Float( string='Quantity To Deliver', digits=dp.get_precision('Product Unit of Measure')) - uom_id = fields.Many2one('product.uom', string='Unit of Measure', + uom_id = fields.Many2one('uom.uom', string='Unit of Measure', readonly=True) diff --git a/rma/wizards/rma_make_picking_view.xml b/rma/wizards/rma_make_picking_view.xml index 61bd41de..0419847c 100755 --- a/rma/wizards/rma_make_picking_view.xml +++ b/rma/wizards/rma_make_picking_view.xml @@ -12,7 +12,7 @@ - + @@ -40,7 +40,7 @@ - + diff --git a/rma/wizards/rma_order_line_make_supplier_rma.py b/rma/wizards/rma_order_line_make_supplier_rma.py index 8a33ca7b..50b79267 100644 --- a/rma/wizards/rma_order_line_make_supplier_rma.py +++ b/rma/wizards/rma_order_line_make_supplier_rma.py @@ -189,7 +189,7 @@ class RmaLineMakeRmaOrderItem(models.TransientModel): product_id = fields.Many2one('product.product', related='line_id.product_id', readony=True) name = fields.Char(related='line_id.name', readonly=True) - uom_id = fields.Many2one('product.uom', string='UoM', readonly=True) + uom_id = fields.Many2one('uom.uom', string='UoM', readonly=True) product_qty = fields.Float(string='Quantity', digits=dp.get_precision('Product UoS')) operation_id = fields.Many2one( diff --git a/rma/wizards/rma_order_line_make_supplier_rma_view.xml b/rma/wizards/rma_order_line_make_supplier_rma_view.xml index 0dff174e..4670bbc2 100755 --- a/rma/wizards/rma_order_line_make_supplier_rma_view.xml +++ b/rma/wizards/rma_order_line_make_supplier_rma_view.xml @@ -32,7 +32,7 @@ + groups="uom.group_uom"/>