mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] fix keys_to_validate, remove useless unlink, fix dialect
This commit is contained in:
@@ -54,7 +54,7 @@ class FileParser(BankStatementImportParser):
|
||||
self.ftype = ftype
|
||||
else:
|
||||
raise Exception(_('Invalide file type %s. please use csv or xls') % (ftype))
|
||||
self.keys_to_validate = keys_to_validate
|
||||
self.keys_to_validate = keys_to_validate or []
|
||||
self.convertion_dict = convertion_dict
|
||||
self.fieldnames = header
|
||||
self._datemode = 0 # used only for xls documents,
|
||||
@@ -95,7 +95,7 @@ class FileParser(BankStatementImportParser):
|
||||
We skip the validation step if the file header is provided separately
|
||||
(in the field: fieldnames).
|
||||
"""
|
||||
if self.fieldnames is None and self.keys_to_validate:
|
||||
if self.fieldnames is None:
|
||||
parsed_cols = self.result_row_list[0].keys()
|
||||
for col in self.keys_to_validate:
|
||||
if col not in parsed_cols:
|
||||
|
||||
@@ -28,7 +28,8 @@ def UnicodeDictReader(utf8_data, **kwargs):
|
||||
utf8_data.seek(pos)
|
||||
if not kwargs.get('dialect'):
|
||||
dialect = sniffer.sniff(sample_data, delimiters=',;\t')
|
||||
del kwargs['dialect']
|
||||
if 'dialect' in kwargs:
|
||||
del kwargs['dialect']
|
||||
else:
|
||||
dialect = kwargs.pop('dialect')
|
||||
csv_reader = csv.DictReader(utf8_data, dialect=dialect, **kwargs)
|
||||
|
||||
@@ -29,6 +29,8 @@ from openerp.osv import fields, osv
|
||||
from parser import new_bank_statement_parser
|
||||
import sys
|
||||
import traceback
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AccountStatementProfil(Model):
|
||||
@@ -117,6 +119,16 @@ class AccountStatementProfil(Model):
|
||||
}
|
||||
return comm_values
|
||||
|
||||
def prepare_statetement_lines_vals(self, cursor, uid, parser_vals,
|
||||
account_payable, account_receivable, statement_id, context):
|
||||
"""
|
||||
Method to ensure backward compatibility with the old name of the method.
|
||||
"""
|
||||
_logger.warning(_("The method prepare_statetement_lines_vals shouldn't "
|
||||
"be used anymore, use : prepare_statement_lines_vals"))
|
||||
return self.prepare_statement_lines_vals(cursor, uid, parser_vals,
|
||||
account_payable, account_receivable, statement_id, context)
|
||||
|
||||
def prepare_statement_lines_vals(self, cursor, uid, parser_vals,
|
||||
account_payable, account_receivable, statement_id, context):
|
||||
"""
|
||||
@@ -215,8 +227,6 @@ class AccountStatementProfil(Model):
|
||||
len(result_row_list), context)
|
||||
|
||||
except Exception, exc:
|
||||
#??? unlink without commit the cursor, usefull?
|
||||
statement_obj.unlink(cursor, uid, [statement_id])
|
||||
error_type, error_value, trbk = sys.exc_info()
|
||||
st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value)
|
||||
st += ''.join(traceback.format_tb(trbk, 30))
|
||||
|
||||
Reference in New Issue
Block a user