mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] no loop when computing sequence
This commit is contained in:
@@ -28,13 +28,12 @@ from openerp.tools.translate import _
|
||||
def fixed_write(self, cr, uid, ids, vals, context=None):
|
||||
""" Fix performance desing of original function
|
||||
Ideally we should use a real postgres sequence or serial fields.
|
||||
Will do it when I have time."""
|
||||
I will do it when I have time."""
|
||||
res = super(stat_mod.account_bank_statement, self).write(cr, uid, ids,
|
||||
vals, context=context)
|
||||
for s_id in ids:
|
||||
cr.execute("UPDATE account_bank_statement_line"
|
||||
" SET sequence = account_bank_statement_line.id + 1"
|
||||
" where statement_id = %s", (s_id,))
|
||||
cr.execute("UPDATE account_bank_statement_line"
|
||||
" SET sequence = account_bank_statement_line.id + 1"
|
||||
" where statement_id in %s", (tuple(ids),))
|
||||
return res
|
||||
stat_mod.account_bank_statement.write = fixed_write
|
||||
|
||||
|
||||
Reference in New Issue
Block a user