clearcorp team mailing list archive
-
clearcorp team
-
Mailing list archive
-
Message #00577
[Merge] lp:~dr.clearcorp/openerp-costa-rica/6.1-parser_BCR into lp:openerp-costa-rica
Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-costa-rica/6.1-parser_BCR into lp:openerp-costa-rica.
Requested reviews:
CLEARCORP drivers (clearcorp-drivers)
For more details, see:
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1-parser_BCR/+merge/144560
[FIX] Fix manage dates in parser. Fix bug with year 2013.
--
https://code.launchpad.net/~dr.clearcorp/openerp-costa-rica/6.1-parser_BCR/+merge/144560
Your team CLEARCORP development team is subscribed to branch lp:openerp-costa-rica.
=== modified file 'l10n_cr_account_banking_cr_bcr/bcr_parser.py'
--- l10n_cr_account_banking_cr_bcr/bcr_parser.py 2012-12-13 04:46:03 +0000
+++ l10n_cr_account_banking_cr_bcr/bcr_parser.py 2013-01-23 18:59:33 +0000
@@ -195,20 +195,17 @@
sub_list = list_split [start:end]
for sub in sub_list:
- #03-05-12
- day = sub[0:2]
- month = sub[3:5]
- date_n = datetime.now()
- try:
- date = datetime(int(date_n.year), int(month), int (day))
- except Exception:
- day = sub[1]
- month = sub[4]
- date_n = datetime.now()
- date = datetime(int(date_n.year), int(month), int (day))
-
- mapping['execution_date'] = date
- mapping['effective_date'] = date
+ #fecha_contable
+ date_str = ''
+ date_str = self.extract_date_regular_expresion_line(sub,0)
+ date= datetime.strptime(date_str, "%d-%m-%y")
+ mapping['effective_date'] = date #fecha_contable.
+
+ #fecha_movimiento
+ date_str = self.extract_date_regular_expresion_line(sub,1)
+ date = datetime.strptime(date_str, "%d-%m-%y")
+ mapping['execution_date'] = date #fecha_movimiento
+
mapping['local_currency'] = currencycode
mapping['transfer_type'] = 'NTRF'
mapping['reference'] = parser.extract_number(sub[18:26])
@@ -305,6 +302,20 @@
cad = cad + character
return cad
+ #con el parametro pos se dice cual de las dos fechas se debe traer
+ #result trae una lista con dos elementos, el pos nos dice cual escoger
+ def extract_date_regular_expresion_line(self, date, pos):
+ cad = ''
+ result = []
+ date_string = ''
+ #re.findall('[0-9]{1,2}-[0-9]{1,2}-[0-9]{4}',str)[0]+' '+re.findall('[0-9]{2}:[0-9]{2}:[0-9]{2}',str)[0]
+ result = re.findall('([0-9]{2}-[0-9]{2}-[0-9]{2})[\s]*',date)
+ date_str = result[pos]
+
+ for character in date_str:
+ cad = cad + character
+ return cad
+
def extract_hour_regular_expresion(self, date):
cad = ''
result = []
Follow ups