From 6535f36fe894893a54d5552ebff2b61a29d1a6be Mon Sep 17 00:00:00 2001 From: lreficent Date: Tue, 19 Sep 2017 15:43:18 +0200 Subject: [PATCH] [9.0] mrp_repair_refurbish: travis and comments. --- mrp_repair_refurbish/models/mrp_repair.py | 18 +++- .../models/product_product.py | 6 +- .../views/mrp_repair_view.xml | 94 +++++++++---------- .../views/product_product_view.xml | 34 +++---- .../views/product_template_view.xml | 58 ++++++------ 5 files changed, 108 insertions(+), 102 deletions(-) diff --git a/mrp_repair_refurbish/models/mrp_repair.py b/mrp_repair_refurbish/models/mrp_repair.py index 06f6abdf1..3797b78e2 100644 --- a/mrp_repair_refurbish/models/mrp_repair.py +++ b/mrp_repair_refurbish/models/mrp_repair.py @@ -7,11 +7,16 @@ from openerp import api, fields, models class mrp_repair(orm.Model): + """To inherit using old api is needed here in order to be able to modify + the onchange method for `product_id`. + NOTE: This should be moved to new api in v10, when the standard is also + migrated. + """ _inherit = 'mrp.repair' def onchange_product_id(self, cr, uid, ids, product_id=None): - res = super(mrp_repair, self).onchange_product_id(cr, uid, ids, - product_id=product_id) + res = super(mrp_repair, self).onchange_product_id( + cr, uid, ids, product_id=product_id) product = self.pool['product.product'].browse(cr, uid, product_id) res['value']['to_refurbish'] = True if \ product.refurbish_product_id else False @@ -66,6 +71,11 @@ class MrpRepair(models.Model): class mrp_repair_line(orm.Model): + """To inherit using old api is needed here in order to be able to modify + the onchange method for `type`. + NOTE: This should be moved to new api in v10, when the standard is also + migrated. + """ _inherit = 'mrp.repair.line' def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit, @@ -74,8 +84,8 @@ class mrp_repair_line(orm.Model): cr, uid, ids, type, guarantee_limit, company_id=company_id, context=context) - if (type == 'add' and 'to_refurbish' in context - and context['to_refurbish']): + if (type == 'add' and 'to_refurbish' in context and + context['to_refurbish']): res['value']['location_dest_id'] = context[ 'refurbish_location_dest_id'] return res diff --git a/mrp_repair_refurbish/models/product_product.py b/mrp_repair_refurbish/models/product_product.py index 3d18e212e..de6462618 100644 --- a/mrp_repair_refurbish/models/product_product.py +++ b/mrp_repair_refurbish/models/product_product.py @@ -9,6 +9,6 @@ from openerp import fields, models class ProductProduct(models.Model): _inherit = 'product.product' - refurbish_product_id = fields.Many2one(comodel_name='product.product', - string='Refurbished Product', - domain="[('type', '=', 'product')]") + refurbish_product_id = fields.Many2one( + comodel_name='product.product', string='Refurbished Product', + domain="[('type', '=', 'product')]") diff --git a/mrp_repair_refurbish/views/mrp_repair_view.xml b/mrp_repair_refurbish/views/mrp_repair_view.xml index b42fde48f..99e209be3 100644 --- a/mrp_repair_refurbish/views/mrp_repair_view.xml +++ b/mrp_repair_refurbish/views/mrp_repair_view.xml @@ -1,56 +1,54 @@ - - + - - mrp.repair.tree - mrp.repair - - - - - + + mrp.repair.tree + mrp.repair + + + + - + + - - mrp.repair.form - mrp.repair - - - - - - - - - - - - - - {'default_product_uom_qty': product_qty, 'to_refurbish': to_refurbish, 'refurbish_location_dest_id': location_dest_id} - + + mrp.repair.form + mrp.repair + + + + + + + + + + + + + + {'default_product_uom_qty': product_qty, 'to_refurbish': to_refurbish, 'refurbish_location_dest_id': location_dest_id} - + + - - mrp.repair.select - mrp.repair - - - - - - + + mrp.repair.select + mrp.repair + + + + + - + + - - \ No newline at end of file + diff --git a/mrp_repair_refurbish/views/product_product_view.xml b/mrp_repair_refurbish/views/product_product_view.xml index 3a0bcb556..29e1eacd0 100644 --- a/mrp_repair_refurbish/views/product_product_view.xml +++ b/mrp_repair_refurbish/views/product_product_view.xml @@ -1,19 +1,19 @@ - - - - product.product.form - product.product - primary - - - - - - - + + + + product.product.form + product.product + primary + + + + + + - - - - \ No newline at end of file + + + + + diff --git a/mrp_repair_refurbish/views/product_template_view.xml b/mrp_repair_refurbish/views/product_template_view.xml index 50677a644..4885ff6a0 100644 --- a/mrp_repair_refurbish/views/product_template_view.xml +++ b/mrp_repair_refurbish/views/product_template_view.xml @@ -1,35 +1,33 @@ - - + - - product.template.product.form - product.template - primary - - - - - - - + + product.template.product.form + product.template + primary + + + + + + + + + + + + product.template.stock.property.form.inherit + product.template + + + + + - + + - - product.template.stock.property.form.inherit - product.template - - - - - - - - - - - \ No newline at end of file +