← Back to team overview

banking-addons-team team mailing list archive

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

 

Nicolas Bessi - Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-login-and-regexp 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-fix-login-and-regexp/+merge/161578

Refine partner label lookup error message
Restore error message in log
Fix partner label lookup regexp
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-fix-login-and-regexp/+merge/161578
Your team Banking Addons Team is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-70-fix-login-and-regexp into lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_statement_base_completion/statement.py'
--- account_statement_base_completion/statement.py	2013-04-25 11:48:24 +0000
+++ account_statement_base_completion/statement.py	2013-04-30 11:13:36 +0000
@@ -45,6 +45,9 @@
     def __str__(self):
         return repr(self.value)
 
+    def __repr__(self):
+        return repr(self.value)
+
 
 class AccountStatementProfil(orm.Model):
     """
@@ -295,7 +298,7 @@
             line_ids = context.get('line_ids', [])
             for partner in partner_obj.browse(cr, uid, partner_ids, context=context):
                 vals = '|'.join(re.escape(x.strip()) for x in partner.bank_statement_label.split(';'))
-                or_regex = ".*%s*." % vals
+                or_regex = ".*%s.*" % vals
                 sql = ("SELECT id from account_bank_statement_line"
                        " WHERE id in %s"
                        " AND name ~* %s")
@@ -303,12 +306,14 @@
                 pairs = cr.fetchall()
                 for pair in pairs:
                     context['label_memoizer'][pair[0]].append(partner)
+
         if st_line['id'] in context['label_memoizer']:
             found_partner = context['label_memoizer'][st_line['id']]
             if len(found_partner) > 1:
-                raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by '
-                                            'more than one partner while looking on partner label') %
-                                          (st_line['name'], st_line['ref']))
+                msg = (_('Line named "%s" (Ref:%s) was matched by '
+                         'more than one partner while looking on partner label: %s') %
+                       (st_line['name'], st_line['ref'], ','.join([x.name for x in found_partner])))
+                raise ErrorTooManyPartner(msg)
             res['partner_id'] = found_partner[0].id
             st_vals = st_obj.get_values_for_line(cr,
                                                  uid,
@@ -451,8 +456,8 @@
         log = log if log else ""
 
         completion_date = datetime.datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
-        message = (_("%s Bank Statement ID %s has %s lines completed by %s \n%s\n") %
-                   (completion_date, stat_id, number_imported, user_name, log))
+        message = (_("%s Bank Statement ID %s has %s lines completed by %s \n%s\n%s\n") %
+                   (completion_date, stat_id, number_imported, user_name, error_msg, log))
         self.write(cr, uid, [stat_id], {'completion_logs': message}, context=context)
 
         body = (_('Statement ID %s auto-completed for %s lines completed') %


Follow ups