← Back to team overview

clearcorp team mailing list archive

lp:~dr.clearcorp/openerp-costa-rica/6.1_fix_bug_import_davivienda into lp:openerp-costa-rica/6.1

 

Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-costa-rica/6.1_fix_bug_import_davivienda into lp:openerp-costa-rica/6.1.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1_fix_bug_import_davivienda/+merge/153621

[FIX] Fix parser for Davivienda Bank. Fix error of variable name and special characters. 
-- 
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1_fix_bug_import_davivienda/+merge/153621
Your team CLEARCORP development team is subscribed to branch lp:openerp-costa-rica/6.1.
=== modified file 'l10n_cr_account_banking_cr_davivienda/davivienda_format.py'
--- l10n_cr_account_banking_cr_davivienda/davivienda_format.py	2013-03-14 15:57:05 +0000
+++ l10n_cr_account_banking_cr_davivienda/davivienda_format.py	2013-03-15 20:43:21 +0000
@@ -104,7 +104,7 @@
     
     def _execution_date_transferred_amount (self, record):        
         self.execution_date = record['bookingdate']       
-        self.transferred_amount = float(record['ammount'])
+        self.transferred_amount = float(record['amount'])
 
     def transaction_info(self, record):
         '''
@@ -161,7 +161,7 @@
         #pass to encoding with the correct type of file.
         data = base64.decodestring(statements_file)
         
-        #parse the data for the header of the stament.
+        #parse the data for the header of the stament.amount
         records = parser.parse_stamenent_record(data, **kwargs)        
         
         stmnt._transmission_number(records)

=== modified file 'l10n_cr_account_banking_cr_davivienda/davivienda_parser.py'
--- l10n_cr_account_banking_cr_davivienda/davivienda_parser.py	2013-03-14 15:57:05 +0000
+++ l10n_cr_account_banking_cr_davivienda/davivienda_parser.py	2013-03-15 20:43:21 +0000
@@ -57,7 +57,7 @@
             'currencycode': '', #currencycode
             'endingbalance': 0.0, #_closing_balance
             'bookingdate': '', #moving_date
-            'ammount': 0.0,
+            'amount': 0.0,
             'id': '',
         }
         
@@ -104,13 +104,13 @@
                 while True:
                     last_position -= 1
                     last_line = list_split[last_position]
-                    if last_line is not "":
+                    if len(last_line) > 0 and last_line != "" and last_line != '\r':
                         break       
             last_line_split = last_line.split(';')
             endingbalance += float(last_line_split[5].replace(",",""))      
             line_dict['endingbalance'] =  str(endingbalance)
             
-            line_dict['ammount'] = startingbalance + endingbalance
+            line_dict['amount'] = str(startingbalance + endingbalance)
             line_dict['id'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + ' Extracto Davivienda ' + line_dict['account_number']
             
             return line_dict
@@ -153,7 +153,7 @@
                 if last_line is not "":
                     break
                     
-        sub_list = list_split [start:end+1]
+        sub_list = list_split [start:end]
         for sub in sub_list:
             line = sub.split(';')
             #effective_date
@@ -181,7 +181,17 @@
            
             lines.append(copy(mapping))
                             
-        return lines    
+        return lines   
+    
+    #clear special characters in a row. 
+    def clean_special_characters(self, text_celd):
+        special_characters = {'\r':''}
+         
+        for i, j in special_characters.iteritems():
+            text = text_celd.replace(i, j)    
+            
+        #remove all the blank space.
+        return re.sub(r'\s', '', text) 
     
     """
     ** Kwargs parameter is used for a dynamic list of parameters. 
@@ -204,7 +214,7 @@
         matchdict = self.statement_record(rec, **kwargs);
 
         # Remove members set to None
-        matchdict = dict( [( k, v ) for k, v in matchdict.iteritems() if v] )
+        #matchdict = dict( [( k, v ) for k, v in matchdict.iteritems() if v] )
 
         matchkeys = set( matchdict.keys() )
         needstrip = set( [ 'transref', 'account_number', 'statementnr', 'currencycode', 'endingbalance', 'bookingdate'] )
@@ -218,7 +228,7 @@
             matchdict[field] = float( matchdict[field].replace( ',', '.' ) )
 
         # Convert date fields
-        needdate = set( ["bookingdate"] )
+        needdate = set( ["bookingdate", "effective_date", "execution_date"] )
                 
         for field in matchkeys & needdate:            
             datestring = matchdict[field]


Follow ups