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

Proposed by Nicolas Bessi - Camptocamp
Status: Merged
Merged at revision: 87
Proposed branch: lp:~camptocamp/banking-addons/bank-statement-reconcile-70-imp-statement-import-perf
Merge into: lp:banking-addons/bank-statement-reconcile-70
Diff against target: 25 lines (+6/-3)
1 file modified
account_statement_base_import/statement.py (+6/-3)
To merge this branch: bzr merge lp:~camptocamp/banking-addons/bank-statement-reconcile-70-imp-statement-import-perf
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review, no test Approve
Yannick Vaucher @ Camptocamp code, no test Needs Fixing
Review via email: mp+150352@code.launchpad.net

Description of the change

Improve statement import wizard by using mass writing of statement line in order to avoid store field loop computation.

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

l8-9 import of time and profile seems unecessary please delete those.

Otherwise it's fine.

review: Needs Fixing (code, no test)
85. By Nicolas Bessi - Camptocamp

[FIX] forgotten code profiling import

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

You are right. I forgot the profiling import.
Fix committed.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_statement_base_import/statement.py'
2--- account_statement_base_import/statement.py 2013-01-29 09:22:10 +0000
3+++ account_statement_base_import/statement.py 2013-02-26 08:46:20 +0000
4@@ -171,16 +171,19 @@
5 try:
6 # Record every line in the bank statement and compute the global commission
7 # based on the commission_amount column
8+ statement_store = []
9 for line in result_row_list:
10 parser_vals = parser.get_st_line_vals(line)
11 values = self.prepare_statetement_lines_vals(
12 cr, uid, parser_vals, account_payable,
13 account_receivable, statement_id, context)
14 # we finally create the line in system
15- statement_line_obj.create(cr, uid, values, context=context)
16+ statement_store.append((0, 0, values))
17 # Build and create the global commission line for the whole statement
18- comm_vals = self.prepare_global_commission_line_vals(
19- cr, uid, parser, result_row_list, prof, statement_id, context)
20+ statement_obj.write(cr, uid, [statement_id],
21+ {'line_ids': statement_store}, context=context)
22+ comm_vals = self.prepare_global_commission_line_vals(cr, uid, parser, result_row_list,
23+ prof, statement_id, context)
24 if comm_vals:
25 statement_line_obj.create(cr, uid, comm_vals, context=context)
26

Subscribers

People subscribed via source and target branches