mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX] poor satement write function performance
This commit is contained in:
@@ -18,11 +18,27 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
import openerp.addons.account.account_bank_statement as stat_mod
|
||||||
from openerp.osv.orm import Model
|
from openerp.osv.orm import Model
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
|
|
||||||
|
# Monkey patch to fix bad write implementation...
|
||||||
|
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."""
|
||||||
|
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,))
|
||||||
|
return res
|
||||||
|
stat_mod.account_bank_statement.write = fixed_write
|
||||||
|
|
||||||
|
|
||||||
class AccountStatementProfil(Model):
|
class AccountStatementProfil(Model):
|
||||||
"""
|
"""
|
||||||
A Profile will contain all infos related to the type of
|
A Profile will contain all infos related to the type of
|
||||||
|
|||||||
Reference in New Issue
Block a user