[IMP] mrp_repair: reverse boolean test to reduce nesting

bzr revid: xmo@openerp.com-20101005080013-7ssjz1tnlqe0cqdz
This commit is contained in:
Xavier Morel 2010-10-05 10:00:13 +02:00
parent f291106692
commit a392e830d7
1 changed files with 13 additions and 11 deletions

View File

@ -684,22 +684,24 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
}
}
produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
if type == 'add':
stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
to_invoice = False
if guarantee_limit and datetime.now() > datetime.strptime(guarantee_limit, '%Y-%m-%d'):
to_invoice=True
if type != 'add':
return {'value': {
'to_invoice': to_invoice,
'location_id': stock_id,
'location_dest_id': produc_id
}
}
return {'value': {
'to_invoice': False,
'location_id': produc_id,
'location_dest_id': False
}
}
stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
to_invoice = False
if guarantee_limit and datetime.now() > datetime.strptime(guarantee_limit, '%Y-%m-%d'):
to_invoice=True
return {'value': {
'to_invoice': to_invoice,
'location_id': stock_id,
'location_dest_id': produc_id
}
}