← Back to team overview

banking-addons-team team mailing list archive

lp:~akretion-team/banking-addons/account_statement_base_import_conversion_dict into lp:banking-addons/bank-statement-reconcile-7.0

 

Florian da Costa has proposed merging lp:~akretion-team/banking-addons/account_statement_base_import_conversion_dict into lp:banking-addons/bank-statement-reconcile-7.0.

Requested reviews:
  Nicolas Bessi - Camptocamp (nbessi-c2c)

For more details, see:
https://code.launchpad.net/~akretion-team/banking-addons/account_statement_base_import_conversion_dict/+merge/198235

The conversion dict is displaced from the file_parser to the generic_parser in order to avoid the error of the validate function when creating a new parser which does not contain the 4 basc fields (ref, amount, date, label).
-- 
https://code.launchpad.net/~akretion-team/banking-addons/account_statement_base_import_conversion_dict/+merge/198235
Your team Banking Addons Core Editors is subscribed to branch lp:banking-addons/bank-statement-reconcile-7.0.
=== modified file 'account_statement_base_import/parser/file_parser.py'
--- account_statement_base_import/parser/file_parser.py	2013-11-06 17:27:53 +0000
+++ account_statement_base_import/parser/file_parser.py	2013-12-09 12:00:53 +0000
@@ -53,14 +53,15 @@
         else:
             raise except_osv(_('User Error'),
                              _('Invalid file type %s. Please use csv or xls') % ftype)
-        self.conversion_dict = {
-            'ref': unicode,
-            'label': unicode,
-            'date': datetime.datetime,
-            'amount': float_or_zero,
-        }
-        if extra_fields:
-            self.conversion_dict.update(extra_fields)
+        self.conversion_dict = conversion_dict
+#        self.conversion_dict = {
+#            'ref': unicode,
+#            'label': unicode,
+#            'date': datetime.datetime,
+#            'amount': float_or_zero,
+#        }
+#        if extra_fields:
+#            self.conversion_dict.update(extra_fields)
         self.keys_to_validate = self.conversion_dict.keys()
         self.fieldnames = header
         self._datemode = 0  # used only for xls documents,

=== modified file 'account_statement_base_import/parser/generic_file_parser.py'
--- account_statement_base_import/parser/generic_file_parser.py	2013-05-03 19:57:26 +0000
+++ account_statement_base_import/parser/generic_file_parser.py	2013-12-09 12:00:53 +0000
@@ -38,7 +38,13 @@
     """
 
     def __init__(self, parse_name, ftype='csv', **kwargs):
-        super(GenericFileParser, self).__init__(parse_name, ftype=ftype, **kwargs)
+        conversion_dict = {
+            'ref': unicode,
+            'label': unicode,
+            'date': datetime.datetime,
+            'amount': float_or_zero,
+        }
+        super(GenericFileParser, self).__init__(parse_name, ftype=ftype,conversion_dict=conversion_dict, **kwargs)
 
     @classmethod
     def parser_for(cls, parser_name):


Follow ups