diff --git a/rma_repair/README.rst b/rma_repair/README.rst index 4e6b8a2c..31a2c1cd 100644 --- a/rma_repair/README.rst +++ b/rma_repair/README.rst @@ -10,7 +10,7 @@ This module allows you to create repairs from one or more RMA lines. Installation ============ -This module depends on ``mrp_repair_refurbish`` which is available at +This module depends on ``repair_refurbish`` which is available at `OCA/manufacture `_. Usage @@ -40,6 +40,7 @@ Contributors * Jordi Ballester Alomar * Aaron Henriquez * Lois Rilo +* Akim Juillerat Maintainer ---------- diff --git a/rma_repair/__manifest__.py b/rma_repair/__manifest__.py index b731b6ff..4d6b0ba7 100644 --- a/rma_repair/__manifest__.py +++ b/rma_repair/__manifest__.py @@ -3,19 +3,22 @@ { "name": "RMA Repair", - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "license": "LGPL-3", "category": "RMA", "summary": "Links RMA with Repairs.", "author": "Eficent, Odoo Community Association (OCA)", "website": "http://www.github.com/OCA/rma", - "depends": ["rma_account", "mrp_repair_refurbish"], + "depends": [ + "rma_account", + "repair_refurbish" + ], "data": ["views/rma_order_view.xml", "views/rma_operation_view.xml", - "views/mrp_repair_view.xml", + "views/repair_view.xml", "wizards/rma_order_line_make_repair_view.xml", "views/rma_order_line_view.xml", - "data/mrp_repair_sequence.xml", + "data/repair_sequence.xml", ], "installable": True, "auto_install": True, diff --git a/rma_repair/data/mrp_repair_sequence.xml b/rma_repair/data/repair_sequence.xml similarity index 65% rename from rma_repair/data/mrp_repair_sequence.xml rename to rma_repair/data/repair_sequence.xml index 740e534f..23f61a16 100644 --- a/rma_repair/data/mrp_repair_sequence.xml +++ b/rma_repair/data/repair_sequence.xml @@ -1,7 +1,7 @@ - + RO diff --git a/rma_repair/models/__init__.py b/rma_repair/models/__init__.py index e3a6298a..71df692a 100644 --- a/rma_repair/models/__init__.py +++ b/rma_repair/models/__init__.py @@ -1,6 +1,6 @@ # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) -from . import mrp_repair +from . import repair from . import rma_order_line from . import rma_order from . import rma_operation diff --git a/rma_repair/models/mrp_repair.py b/rma_repair/models/repair.py similarity index 72% rename from rma_repair/models/mrp_repair.py rename to rma_repair/models/repair.py index c2afce69..c512d9dc 100644 --- a/rma_repair/models/mrp_repair.py +++ b/rma_repair/models/repair.py @@ -4,12 +4,12 @@ from odoo import fields, models -class MrpRepair(models.Model): - _inherit = "mrp.repair" +class RepairOrder(models.Model): + _inherit = "repair.order" rma_line_id = fields.Many2one( comodel_name='rma.order.line', string='RMA', ondelete='restrict', ) under_warranty = fields.Boolean( - related='rma_line_id.under_warranty', + related='rma_line_id.under_warranty', readonly=False, ) diff --git a/rma_repair/models/rma_order.py b/rma_repair/models/rma_order.py index 294718cf..962937ca 100644 --- a/rma_repair/models/rma_order.py +++ b/rma_repair/models/rma_order.py @@ -11,14 +11,14 @@ class RmaOrder(models.Model): def _compute_repair_count(self): for rma in self: repairs = rma.mapped('rma_line_ids.repair_ids') - rma.rma_count = len(repairs) + rma.repair_count = len(repairs) repair_count = fields.Integer( - compute=_compute_repair_count, string='# of Repairs') + compute='_compute_repair_count', string='# of Repairs') @api.multi def action_view_repair_order(self): - action = self.env.ref('mrp_repair.action_repair_order_tree') + action = self.env.ref('repair.action_repair_order_tree') result = action.read()[0] repair_ids = self.mapped('rma_line_ids.repair_ids').ids result['domain'] = [('id', 'in', repair_ids)] diff --git a/rma_repair/models/rma_order_line.py b/rma_repair/models/rma_order_line.py index 2484fbfd..cd0d676f 100644 --- a/rma_repair/models/rma_order_line.py +++ b/rma_repair/models/rma_order_line.py @@ -29,41 +29,41 @@ class RmaOrderLine(models.Model): for line in self: line.qty_repaired = line._get_rma_repaired_qty() - @api.multi + @api.depends('repair_ids') def _compute_repair_count(self): for line in self: line.repair_count = len(line.repair_ids) repair_ids = fields.One2many( - comodel_name='mrp.repair', inverse_name='rma_line_id', + comodel_name='repair.order', inverse_name='rma_line_id', string='Repair Orders', readonly=True, states={'draft': [('readonly', False)]}, copy=False) qty_to_repair = fields.Float( string='Qty To Repair', copy=False, digits=dp.get_precision('Product Unit of Measure'), - readonly=True, compute=_compute_qty_to_repair, + readonly=True, compute='_compute_qty_to_repair', store=True) qty_repaired = fields.Float( string='Qty Repaired', copy=False, digits=dp.get_precision('Product Unit of Measure'), - readonly=True, compute=_compute_qty_repaired, + readonly=True, compute='_compute_qty_repaired', store=True, help="Quantity repaired or being repaired.") repair_type = fields.Selection(selection=[ ('no', 'Not required'), ('ordered', 'Based on Ordered Quantities'), ('received', 'Based on Received Quantities')], string="Repair Policy", default='no', required=True) repair_count = fields.Integer( - compute=_compute_repair_count, string='# of Repairs') + compute='_compute_repair_count', string='# of Repairs') @api.multi def action_view_repair_order(self): - action = self.env.ref('mrp_repair.action_repair_order_tree') + action = self.env.ref('repair.action_repair_order_tree') result = action.read()[0] repair_ids = self.repair_ids.ids if len(repair_ids) != 1: result['domain'] = [('id', 'in', repair_ids)] elif len(repair_ids) == 1: - res = self.env.ref('mrp_repair.view_repair_order_form', False) + res = self.env.ref('repair.view_repair_order_form', False) result['views'] = [(res and res.id or False, 'form')] result['res_id'] = repair_ids[0] return result diff --git a/rma_repair/views/mrp_repair_view.xml b/rma_repair/views/repair_view.xml similarity index 66% rename from rma_repair/views/mrp_repair_view.xml rename to rma_repair/views/repair_view.xml index dff6e2dd..8a37e7e2 100644 --- a/rma_repair/views/mrp_repair_view.xml +++ b/rma_repair/views/repair_view.xml @@ -2,9 +2,9 @@ - mrp.repair.form rma_repair - mrp.repair - + repair.order.form rma_repair + repair.order + diff --git a/rma_repair/wizards/rma_order_line_make_repair.py b/rma_repair/wizards/rma_order_line_make_repair.py index e7ac8fc6..92875963 100644 --- a/rma_repair/wizards/rma_order_line_make_repair.py +++ b/rma_repair/wizards/rma_order_line_make_repair.py @@ -57,7 +57,7 @@ class RmaLineMakeRepair(models.TransientModel): @api.multi def make_repair_order(self): res = [] - repair_obj = self.env['mrp.repair'] + repair_obj = self.env['repair.order'] for item in self.item_ids: rma_line = item.line_id data = item._prepare_repair_order(rma_line) @@ -68,7 +68,7 @@ class RmaLineMakeRepair(models.TransientModel): 'name': _('Repairs'), 'view_type': 'form', 'view_mode': 'tree,form', - 'res_model': 'mrp.repair', + 'res_model': 'repair.order', 'view_id': False, 'context': False, 'type': 'ir.actions.act_window' @@ -102,7 +102,7 @@ class RmaLineMakeRepairItem(models.TransientModel): ) rma_id = fields.Many2one( comodel_name='rma.order', related='line_id.rma_id', - string='RMA Order', readonly=True, + string='RMA Order', ) product_id = fields.Many2one( comodel_name='product.product', string='Product', readonly=True, @@ -111,7 +111,7 @@ class RmaLineMakeRepairItem(models.TransientModel): string='Quantity to repair', digits=dp.get_precision('Product UoS'), ) product_uom_id = fields.Many2one( - comodel_name='product.uom', string='UoM', readonly=True, + comodel_name='uom.uom', string='UoM', readonly=True, ) out_route_id = fields.Many2one( comodel_name='stock.location.route', string='Outbound Route', diff --git a/rma_repair/wizards/rma_order_line_make_repair_view.xml b/rma_repair/wizards/rma_order_line_make_repair_view.xml index b55c21a5..529f4e15 100644 --- a/rma_repair/wizards/rma_order_line_make_repair_view.xml +++ b/rma_repair/wizards/rma_order_line_make_repair_view.xml @@ -17,12 +17,12 @@ - + - - + +