From 60015d481a8024374a286dfd1c6025c8c9d7aa0a Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 3 Aug 2013 08:50:54 +0200 Subject: [PATCH] [FIX] mrp repair for quants bzr revid: fp@openerp.com-20130803065054-w2w3s2dafgvvebtm --- addons/mrp_repair/mrp_repair.py | 13 ++++--------- addons/mrp_repair/mrp_repair_view.xml | 3 --- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index f7b082db74b..b2979350a2f 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -25,6 +25,8 @@ from dateutil.relativedelta import relativedelta from openerp.tools.translate import _ import openerp.addons.decimal_precision as dp +# TODO: replace move_id by quant_id everywhere + class mrp_repair(osv.osv): _name = 'mrp.repair' _inherit = 'mail.thread' @@ -119,7 +121,6 @@ class mrp_repair(osv.osv): 'partner_id' : fields.many2one('res.partner', 'Partner', select=True, help='Choose partner for whom the order will be invoiced and delivered.', states={'confirmed':[('readonly',True)]}), 'address_id': fields.many2one('res.partner', 'Delivery Address', domain="[('parent_id','=',partner_id)]", states={'confirmed':[('readonly',True)]}), 'default_address_id': fields.function(_get_default_address, type="many2one", relation="res.partner"), - 'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number', select=True, states={'draft':[('readonly',False)]},domain="[('product_id','=',product_id)]"), 'state': fields.selection([ ('draft','Quotation'), ('cancel','Cancelled'), @@ -203,7 +204,6 @@ class mrp_repair(osv.osv): @return: Dictionary of values. """ return {'value': { - 'prodlot_id': False, 'move_id': False, 'guarantee_limit' :False, 'location_id': False, @@ -219,7 +219,7 @@ class mrp_repair(osv.osv): @return: Dictionary of values. """ data = {} - data['value'] = {'guarantee_limit': False, 'location_id': False, 'prodlot_id': False, 'partner_id': False} + data['value'] = {'guarantee_limit': False, 'location_id': False, 'partner_id': False} if not prod_id: return data if move_id: @@ -229,7 +229,6 @@ class mrp_repair(osv.osv): data['value']['guarantee_limit'] = limit.strftime('%Y-%m-%d') data['value']['location_id'] = move.location_dest_id.id data['value']['location_dest_id'] = move.location_dest_id.id - data['value']['prodlot_id'] = move.prodlot_id.id if move.partner_id: data['value']['partner_id'] = move.partner_id.id else: @@ -285,7 +284,6 @@ class mrp_repair(osv.osv): if not lot: return data - move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', lot)]) if not len(move_ids): return data @@ -329,7 +327,7 @@ class mrp_repair(osv.osv): else: self.write(cr, uid, [o.id], {'state': 'confirmed'}) for line in o.operations: - if line.product_id.track_production and not line.prodlot_id: + if line.product_id.track_production: raise osv.except_osv(_('Warning!'), _("Serial number is required for operation line with product '%s'") % (line.product_id.name)) mrp_line_obj.write(cr, uid, [l.id for l in o.operations], {'state': 'confirmed'}) return True @@ -516,7 +514,6 @@ class mrp_repair(osv.osv): 'location_id': move.location_id.id, 'location_dest_id': move.location_dest_id.id, 'tracking_id': False, - 'prodlot_id': move.prodlot_id and move.prodlot_id.id or False, 'state': 'done', }) repair_line_obj.write(cr, uid, [move.id], {'move_id': move_id, 'state': 'done'}, context=context) @@ -537,7 +534,6 @@ class mrp_repair(osv.osv): 'picking_id': picking, 'product_id': repair.product_id.id, 'product_uom': repair.product_id.uom_id.id, - 'prodlot_id': repair.prodlot_id and repair.prodlot_id.id or False, 'partner_id': repair.address_id and repair.address_id.id or False, 'location_id': repair.location_id.id, 'location_dest_id': repair.location_dest_id.id, @@ -639,7 +635,6 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): 'tax_id': fields.many2many('account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes'), 'product_uom_qty': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), - 'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number',domain="[('product_id','=',product_id)]"), 'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True), 'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True), 'location_dest_id': fields.many2one('stock.location', 'Dest. Location', required=True, select=True), diff --git a/addons/mrp_repair/mrp_repair_view.xml b/addons/mrp_repair/mrp_repair_view.xml index a4526b5b581..7f451ea6933 100644 --- a/addons/mrp_repair/mrp_repair_view.xml +++ b/addons/mrp_repair/mrp_repair_view.xml @@ -49,7 +49,6 @@ - @@ -78,7 +77,6 @@ - @@ -95,7 +93,6 @@ -