← Back to team overview

banking-addons-team team mailing list archive

lp:~camptocamp/banking-addons/bank-statement-reconcile-70-imp-statement-import-perf into lp:banking-addons/bank-statement-reconcile-70

 

Nicolas Bessi - Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-70-imp-statement-import-perf into lp:banking-addons/bank-statement-reconcile-70.

Requested reviews:
  Banking Addons Team (banking-addons-team)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-imp-statement-import-perf/+merge/150352

Improve statement import wizard by using mass writing of statement line in order to avoid store field loop computation.
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-imp-statement-import-perf/+merge/150352
Your team Banking Addons Team is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-70-imp-statement-import-perf into lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_statement_base_import/statement.py'
--- account_statement_base_import/statement.py	2013-01-29 09:22:10 +0000
+++ account_statement_base_import/statement.py	2013-02-25 15:36:31 +0000
@@ -26,6 +26,8 @@
 from parser import new_bank_statement_parser
 import sys
 import traceback
+import profile
+import time
 
 
 class AccountStatementProfil(Model):
@@ -171,16 +173,19 @@
         try:
             # Record every line in the bank statement and compute the global commission
             # based on the commission_amount column
+            statement_store = []
             for line in result_row_list:
                 parser_vals = parser.get_st_line_vals(line)
                 values = self.prepare_statetement_lines_vals(
                         cr, uid, parser_vals, account_payable,
                         account_receivable, statement_id, context)
                 # we finally create the line in system
-                statement_line_obj.create(cr, uid, values, context=context)
+                statement_store.append((0, 0, values))
             # Build and create the global commission line for the whole statement
-            comm_vals = self.prepare_global_commission_line_vals(
-                    cr, uid, parser, result_row_list, prof, statement_id, context)
+            statement_obj.write(cr, uid, [statement_id],
+                                {'line_ids': statement_store}, context=context)
+            comm_vals = self.prepare_global_commission_line_vals(cr, uid, parser, result_row_list,
+                                                                 prof, statement_id, context)
             if comm_vals:
                 statement_line_obj.create(cr, uid, comm_vals, context=context)
 


Follow ups