Merge lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-login-and-regexp into lp:banking-addons/bank-statement-reconcile-70

Proposed by Nicolas Bessi - Camptocamp
Status: Merged
Merged at revision: 91
Proposed branch: lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-login-and-regexp
Merge into: lp:banking-addons/bank-statement-reconcile-70
Diff against target: 51 lines (+11/-6)
1 file modified
account_statement_base_completion/statement.py (+11/-6)
To merge this branch: bzr merge lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-login-and-regexp
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Holger Brunn (Therp) code review, no test Approve
Guewen Baconnier @ Camptocamp code review, no test Approve
Review via email: mp+161578@code.launchpad.net

Description of the change

Refine partner label lookup error message
Restore error message in log
Fix partner label lookup regexp

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review, no test)
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-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_completion/statement.py'
2--- account_statement_base_completion/statement.py 2013-04-25 11:48:24 +0000
3+++ account_statement_base_completion/statement.py 2013-04-30 11:13:36 +0000
4@@ -45,6 +45,9 @@
5 def __str__(self):
6 return repr(self.value)
7
8+ def __repr__(self):
9+ return repr(self.value)
10+
11
12 class AccountStatementProfil(orm.Model):
13 """
14@@ -295,7 +298,7 @@
15 line_ids = context.get('line_ids', [])
16 for partner in partner_obj.browse(cr, uid, partner_ids, context=context):
17 vals = '|'.join(re.escape(x.strip()) for x in partner.bank_statement_label.split(';'))
18- or_regex = ".*%s*." % vals
19+ or_regex = ".*%s.*" % vals
20 sql = ("SELECT id from account_bank_statement_line"
21 " WHERE id in %s"
22 " AND name ~* %s")
23@@ -303,12 +306,14 @@
24 pairs = cr.fetchall()
25 for pair in pairs:
26 context['label_memoizer'][pair[0]].append(partner)
27+
28 if st_line['id'] in context['label_memoizer']:
29 found_partner = context['label_memoizer'][st_line['id']]
30 if len(found_partner) > 1:
31- raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by '
32- 'more than one partner while looking on partner label') %
33- (st_line['name'], st_line['ref']))
34+ msg = (_('Line named "%s" (Ref:%s) was matched by '
35+ 'more than one partner while looking on partner label: %s') %
36+ (st_line['name'], st_line['ref'], ','.join([x.name for x in found_partner])))
37+ raise ErrorTooManyPartner(msg)
38 res['partner_id'] = found_partner[0].id
39 st_vals = st_obj.get_values_for_line(cr,
40 uid,
41@@ -451,8 +456,8 @@
42 log = log if log else ""
43
44 completion_date = datetime.datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
45- message = (_("%s Bank Statement ID %s has %s lines completed by %s \n%s\n") %
46- (completion_date, stat_id, number_imported, user_name, log))
47+ message = (_("%s Bank Statement ID %s has %s lines completed by %s \n%s\n%s\n") %
48+ (completion_date, stat_id, number_imported, user_name, error_msg, log))
49 self.write(cr, uid, [stat_id], {'completion_logs': message}, context=context)
50
51 body = (_('Statement ID %s auto-completed for %s lines completed') %

Subscribers

People subscribed via source and target branches