← Back to team overview

clearcorp team mailing list archive

[Merge] lp:~dr.clearcorp/openerp-costa-rica/6.1-fix_bank_import into lp:openerp-costa-rica/6.1

 

Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-costa-rica/6.1-fix_bank_import 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_bank_import/+merge/168554

[FIX] Fix the currencycode key in the dictionary. Add in the bncr and lafise_format.py
[FIX] Fix the file for bncr bank when the file is separate by the '\t' character
-- 
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1-fix_bank_import/+merge/168554
Your team CLEARCORP development team is subscribed to branch lp:openerp-costa-rica/6.1.
=== modified file 'l10n_cr_account_banking_cr_bncr/bncr_format.py'
--- l10n_cr_account_banking_cr_bncr/bncr_format.py	2013-03-14 15:57:05 +0000
+++ l10n_cr_account_banking_cr_bncr/bncr_format.py	2013-06-10 22:13:32 +0000
@@ -77,6 +77,7 @@
     
     def _account_number(self, record):
         self.local_account = record['account_number']
+        self.local_currency = record['currencycode']
 
     def _statement_number(self, record):
         self.id = record['id']

=== modified file 'l10n_cr_account_banking_cr_bncr/bncr_parser.py'
--- l10n_cr_account_banking_cr_bncr/bncr_parser.py	2013-03-14 15:57:05 +0000
+++ l10n_cr_account_banking_cr_bncr/bncr_parser.py	2013-06-10 22:13:32 +0000
@@ -94,14 +94,23 @@
                     break       
         
         last_line_split = last_line.split(';')
-        if last_line_split[3] != '':
-            debit = float(last_line_split[3].replace(",",""))
+        
+        #For another type of format, take the character \t
+        if len(last_line_split) > 1:        
+            final_line_totals =  last_line_split        
+        else:
+            final_line_totals = last_line.split('\t')
+        
+        #######################################################
+        
+        if final_line_totals[3] != '':
+            debit = float(final_line_totals[3].replace(",",""))
         else:
             debit = 0.0
-        if last_line_split[4] != '':
-            credit = float(last_line_split[4].replace(",",""))
+        if final_line_totals[4] != '':
+            credit = float(final_line_totals[4].replace(",",""))
         else:
-            credit = 0.0
+            credit = 0.0        
         
         startingbalance = float(kwargs['ending_balance']) + debit - credit 
         line_dict['startingbalance'] =  str(startingbalance)
@@ -152,28 +161,34 @@
         sub_list = list_split [start:end] #The end line is amount totals of credit and debit
         for sub in sub_list:
             line = sub.split(';')
+            if len(line) > 1:
+                final_line = line
+            #For another type of format, take the character \t
+            else:
+                final_line = sub.split('\t')
+                
             #effective_date
-            date_str = line[1].replace("/","-")
+            date_str = final_line[1].replace("/","-")
             date= datetime.strptime(date_str, "%Y-%m-%d")               
             mapping['effective_date'] = date #fecha_contable.                        
             #execution_date
             mapping['execution_date'] = date #fecha_movimiento
                                    
             mapping['transfer_type'] = 'NTRF'
-            mapping['reference'] = line[2] #NumDocumento
-            mapping['message'] = line[2]+' '+line[5] #NumDocumento + Description         
-            mapping['name'] = line[2]+' '+line[5] #NumDocumento + Description       
-            mapping['id'] = line[2]+' '+line[5] #NumDocumento + Description     
+            mapping['reference'] = final_line[2] #NumDocumento
+            mapping['message'] = final_line[2]+' '+final_line[5] #NumDocumento + Description         
+            mapping['name'] = final_line[2]+' '+final_line[5] #NumDocumento + Description       
+            mapping['id'] = final_line[2]+' '+final_line[5] #NumDocumento + Description     
             
             #the field in position 3 is debit, the position 4 is credit
-            if line[4] != '':
-                credit = float(line[4].replace(",",""))
+            if final_line[4] != '':
+                credit = float(final_line[4].replace(",",""))
                 mapping['transferred_amount'] = credit    
                 mapping['creditmarker'] = 'C'
             
-            elif line[3] != '':
+            elif final_line[3] != '':
                 #In this case, the debit is negative.
-                debit = float(line[3].replace(",",""))
+                debit = float(final_line[3].replace(",",""))
                 mapping['transferred_amount'] =  -1 * debit
            
             lines.append(copy(mapping))

=== modified file 'l10n_cr_account_banking_cr_lafise/lafise_format.py'
--- l10n_cr_account_banking_cr_lafise/lafise_format.py	2013-03-14 15:57:05 +0000
+++ l10n_cr_account_banking_cr_lafise/lafise_format.py	2013-06-10 22:13:32 +0000
@@ -79,6 +79,7 @@
     
     def _account_number(self, record):
         self.local_account = record['account_number']
+        self.local_currency = record['currencycode']
 
     def _statement_number(self, record):
         self.id = record['id']


Follow ups