[IMP] account: don't write state as draft on lines that are already in draft state (performace improvement)
bzr revid: mat@openerp.com-20130909125751-we5n8e018bwqadvz
This commit is contained in:
parent
1ae3118c54
commit
93e93e8d4e
|
@ -1654,9 +1654,11 @@ class account_move(osv.osv):
|
||||||
else:
|
else:
|
||||||
# We can't validate it (it's unbalanced)
|
# We can't validate it (it's unbalanced)
|
||||||
# Setting the lines as draft
|
# Setting the lines as draft
|
||||||
obj_move_line.write(cr, uid, line_ids, {
|
not_draft_line_ids = list(set(line_ids) - set(line_draft_ids))
|
||||||
'state': 'draft'
|
if not_draft_line_ids:
|
||||||
}, context, check=False)
|
obj_move_line.write(cr, uid, not_draft_line_ids, {
|
||||||
|
'state': 'draft'
|
||||||
|
}, context, check=False)
|
||||||
# Create analytic lines for the valid moves
|
# Create analytic lines for the valid moves
|
||||||
for record in valid_moves:
|
for record in valid_moves:
|
||||||
obj_move_line.create_analytic_lines(cr, uid, [line.id for line in record.line_id], context)
|
obj_move_line.create_analytic_lines(cr, uid, [line.id for line in record.line_id], context)
|
||||||
|
|
Loading…
Reference in New Issue