[FIX] Sale : account_invoice_end() corrected/optimized so that it does not create any regression of duplicated pickings for SO

bzr revid: gpa@tinyerp.com-20100511111240-a0ajvroqcazkzc8u
This commit is contained in:
gpa 2010-05-11 16:42:40 +05:30
parent 14dc743c61
commit 06d2f4d107
1 changed files with 5 additions and 9 deletions

View File

@ -510,18 +510,14 @@ class sale_order(osv.osv):
def action_invoice_end(self, cr, uid, ids, context=None):
if context is None:
context = {}
for order in self.browse(cr, uid, ids, context=context):
val = {'invoiced': True}
if order.state == 'invoice_except':
val['state'] = 'progress'
for line in order.order_line:
towrite = []
if line.state == 'exception':
towrite.append(line.id)
if towrite:
self.pool.get('sale.order.line').write(cr, uid, towrite, {'state': 'confirmed'}, context=context)
self.write(cr, uid, [order.id], val)
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'state': 'confirmed'}, context=context)
if order.state == 'invoice_except':
self.write(cr, uid, [order.id], {'state' : 'progress'}, context=context)
return True