Merge lp:~gs.clearcorp/openerp-costa-rica/7.0_l10n_cr_account_banking_cr_davivienda into lp:openerp-costa-rica

Proposed by Glen Sojo
Status: Merged
Merged at revision: 267
Proposed branch: lp:~gs.clearcorp/openerp-costa-rica/7.0_l10n_cr_account_banking_cr_davivienda
Merge into: lp:openerp-costa-rica
Diff against target: 82 lines (+27/-9)
2 files modified
l10n_cr_account_banking_cr_davivienda/__openerp__.py (+1/-1)
l10n_cr_account_banking_cr_davivienda/davivienda_parser.py (+26/-8)
To merge this branch: bzr merge lp:~gs.clearcorp/openerp-costa-rica/7.0_l10n_cr_account_banking_cr_davivienda
Reviewer Review Type Date Requested Status
ClearCorp drivers Pending
Review via email: mp+201490@code.launchpad.net

Description of the change

[FIX] - Fixed import when comes from debit/credit cards accounts
[IMP] - Added description message for module in __openerp__.py file

To post a comment you must log in.
265. By Ronald Rubi

[MRG] Add security for profit statement, situation balance, statement change of equity and trial balance report.

266. By Ronald Rubi

[MRG] Fix security in reports. Add create permission

267. By Ronald Rubi

[MRG] Fixed import when comes from debit/credit cards accounts. l10n_cr_account_banking_davivienda - Fixed starting and ending balanace calculations for account.bank.statement during import. Fixed davivienda's parser import date when importing bank statements files

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_cr_account_banking_cr_davivienda/__openerp__.py'
2--- l10n_cr_account_banking_cr_davivienda/__openerp__.py 2013-12-04 17:39:51 +0000
3+++ l10n_cr_account_banking_cr_davivienda/__openerp__.py 2014-01-14 16:52:36 +0000
4@@ -33,7 +33,7 @@
5 'init_xml': [],
6 'update_xml': [],
7 'demo_xml': [],
8- 'description': '',
9+ 'description': 'Module intended to import Davivienda\'s statements files',
10 'active': False,
11 'installable': True,
12 }
13
14=== modified file 'l10n_cr_account_banking_cr_davivienda/davivienda_parser.py'
15--- l10n_cr_account_banking_cr_davivienda/davivienda_parser.py 2013-12-09 18:32:13 +0000
16+++ l10n_cr_account_banking_cr_davivienda/davivienda_parser.py 2014-01-14 16:52:36 +0000
17@@ -71,7 +71,12 @@
18 first_line_split = fist_line.split(';')
19
20 account_number_wizard = kwargs['account_number']#from wizard
21- account_number_file = first_line_split[11]#from file.
22+ from_card = False
23+ try:
24+ account_number_file = first_line_split[11]#from account file.
25+ except:
26+ from_card = True
27+ account_number_file = first_line_split[10]#from credit or debit card file
28
29 #if the account_number in the file match with the account
30 #selected in the wizard, return True
31@@ -88,23 +93,27 @@
32 line_dict['currencycode'] = kwargs['local_currency']
33
34 line_dict['statementnr'] = kwargs['date_from_str'] + ' - '+ \
35- kwargs['date_to_str'] + 'Extracto Davivienda ' + \
36+ kwargs['date_to_str'] + ' Extracto Davivienda ' + \
37 line_dict['account_number'] #Interval time of the file.
38
39 startingbalance = endingbalance = 0.0
40
41 #transmission_number (Date when done the import)
42- date_obj= datetime.now()
43+ date_obj = datetime.strptime(kwargs['date_from_str'],"%Y-%m-%d")
44+ #REVISAR
45 line_dict['transref'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
46 #bookingdate
47 line_dict['bookingdate'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
48-
49+ #FIN REVISAR
50 #with the first line compute the initial_balance
51 fist_line = list_split[1]
52 first_line_split = fist_line.split(';')
53- startingbalance = float(first_line_split[5].replace(",","")) + \
54- float(first_line_split[3].replace(",","")) - \
55- float(first_line_split[4].replace(",",""))
56+ #If it comes from credit/debit card account we don't have access to starting
57+ #balance assuming 0.0
58+ if not from_card:
59+ startingbalance = float(first_line_split[5].replace(",","")) + \
60+ float(first_line_split[3].replace(",","")) - \
61+ float(first_line_split[4].replace(",",""))
62 line_dict['startingbalance'] = str(startingbalance)
63
64 #the ending_balance is the balance of the last line.
65@@ -118,7 +127,16 @@
66 if len(last_line) > 0 and last_line != "" and last_line != '\r':
67 break
68 last_line_split = last_line.split(';')
69- endingbalance += float(last_line_split[5].replace(",",""))
70+ if not from_card:
71+ endingbalance += float(last_line_split[5].replace(",",""))
72+ #Calculating ending_balance assuming starting balance as 0.0
73+ else:
74+ for line in list_split[1:]:
75+ if line == '':
76+ break;
77+ line = line.split(';')
78+ endingbalance += -float(line[3].replace(",","")) + float(line[4].replace(",",""))
79+
80 line_dict['endingbalance'] = str(endingbalance)
81
82 line_dict['amount'] = str(startingbalance + endingbalance)

Subscribers

People subscribed via source and target branches

to all changes: