summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2010-10-05 10:00:13 +0200
committerXavier Morel <xmo@openerp.com>2010-10-05 10:00:13 +0200
commita392e830d7a4621b7d4eec6941bcba6c41de70d9 (patch)
tree3aeba59e179092da59d21aff12bf1fa2478add45
parentf291106692e566de1e318e0807ae3e7128265d3c (diff)
[IMP] mrp_repair: reverse boolean test to reduce nesting
bzr revid: xmo@openerp.com-20101005080013-7ssjz1tnlqe0cqdz
-rw-r--r--addons/mrp_repair/mrp_repair.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py
index 010cb725c5c..6fe86fd3f2b 100644
--- a/addons/mrp_repair/mrp_repair.py
+++ b/addons/mrp_repair/mrp_repair.py
@@ -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
}
}