Merge lp:openerp-costa-rica/6.1 into lp:openerp-costa-rica

Proposed by moazar
Status: Rejected
Rejected by: Ronald Rubi
Proposed branch: lp:openerp-costa-rica/6.1
Merge into: lp:openerp-costa-rica
Diff against target: 7585 lines (+4962/-1778) (has conflicts)
76 files modified
TODO-7.0/l10n_cr_account_banking_cr_bac/__openerp__.py (+1/-1)
TODO-7.0/l10n_cr_account_banking_cr_bac/bac_mt940.py (+106/-84)
TODO-7.0/l10n_cr_account_banking_cr_bcr/__openerp__.py (+1/-1)
TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_format.py (+15/-5)
TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_parser.py (+126/-70)
TODO-7.0/l10n_cr_account_financial_report_webkit/__openerp__.py (+0/-2)
TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/de.po (+2/-2)
TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/es_CR.po (+23/-3)
TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/fr.po (+2/-2)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/__init__.py (+0/-2)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako (+0/-407)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako (+166/-150)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako (+0/-480)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_open_invoices.py (+0/-80)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partner_balance.py (+2/-2)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py (+0/-183)
TODO-7.0/l10n_cr_account_financial_report_webkit/report/report.xml (+1/-33)
TODO-7.0/l10n_cr_account_financial_report_webkit/report_menus.xml (+0/-9)
TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/__init__.py (+0/-3)
TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_open_invoices_wizard_view.xml (+0/-31)
TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_partners_ledger_wizard_view.xml (+0/-30)
TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/open_invoices_wizard.py (+0/-52)
TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/partners_ledger_wizard.py (+0/-43)
TODO-7.0/l10n_cr_account_financial_statements/i18n/es_CR.po (+8/-0)
TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.mako (+1/-1)
TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.py (+7/-6)
TODO-7.0/l10n_cr_account_financial_statements/report/situation_balance_report.py (+11/-10)
TODO-7.0/l10n_cr_account_financial_statements/report_menus.xml (+3/-3)
TODO-7.0/l10n_cr_base/i18n/es.po (+2/-2)
l10n_cr_account_banking_cr_bncr/__init__.py (+24/-0)
l10n_cr_account_banking_cr_bncr/__openerp__.py (+37/-0)
l10n_cr_account_banking_cr_bncr/bncr_format.py (+189/-0)
l10n_cr_account_banking_cr_bncr/bncr_parser.py (+274/-0)
l10n_cr_account_banking_cr_davivienda/__openerp__.py (+1/-1)
l10n_cr_account_banking_cr_davivienda/davivienda_format.py (+16/-6)
l10n_cr_account_banking_cr_davivienda/davivienda_parser.py (+76/-62)
l10n_cr_account_banking_cr_lafise/__init__.py (+24/-0)
l10n_cr_account_banking_cr_lafise/__openerp__.py (+37/-0)
l10n_cr_account_banking_cr_lafise/lafise_format.py (+205/-0)
l10n_cr_account_banking_cr_lafise/lafise_parser.py (+339/-0)
l10n_cr_account_banking_reports/report/conciliation_bank.py.OTHER (+420/-0)
l10n_cr_account_banking_reports/wizard/conciliation_bank_wizard.xml.OTHER (+73/-0)
l10n_cr_account_financial_report_open_invoices/__init__.py (+26/-0)
l10n_cr_account_financial_report_open_invoices/__openerp__.py (+43/-0)
l10n_cr_account_financial_report_open_invoices/i18n/es_CR.po (+225/-0)
l10n_cr_account_financial_report_open_invoices/report/__init__.py (+22/-0)
l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako (+407/-0)
l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.py (+80/-0)
l10n_cr_account_financial_report_open_invoices/report/report.xml (+19/-0)
l10n_cr_account_financial_report_open_invoices/report_menus.xml (+8/-0)
l10n_cr_account_financial_report_open_invoices/wizard/__init__.py (+22/-0)
l10n_cr_account_financial_report_open_invoices/wizard/l10n_cr_account_report_open_invoices_wizard.py (+52/-0)
l10n_cr_account_financial_report_open_invoices/wizard/l10n_cr_account_report_open_invoices_wizard_view.xml (+31/-0)
l10n_cr_account_financial_report_partner_ledger/__init__.py (+26/-0)
l10n_cr_account_financial_report_partner_ledger/__openerp__.py (+42/-0)
l10n_cr_account_financial_report_partner_ledger/i18n/es_CR.po (+266/-0)
l10n_cr_account_financial_report_partner_ledger/report/__init__.py (+22/-0)
l10n_cr_account_financial_report_partner_ledger/report/l10n_cr_account_report_partners_ledger.mako (+480/-0)
l10n_cr_account_financial_report_partner_ledger/report/l10n_cr_account_report_partners_ledger.py (+183/-0)
l10n_cr_account_financial_report_partner_ledger/report/report.xml (+14/-0)
l10n_cr_account_financial_report_partner_ledger/report_menus.xml (+9/-0)
l10n_cr_account_financial_report_partner_ledger/wizard/__init__.py (+23/-0)
l10n_cr_account_financial_report_partner_ledger/wizard/l10n_cr_partners_ledger_wizard.py (+43/-0)
l10n_cr_account_financial_report_partner_ledger/wizard/l10n_cr_partners_ledger_wizard_view.xml (+39/-0)
l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_view.xml (+30/-1)
l10n_cr_exchange_rates/__init__.py (+24/-0)
l10n_cr_exchange_rates/__openerp__.py (+51/-0)
l10n_cr_exchange_rates/i18n/es_CR.po (+183/-0)
l10n_cr_exchange_rates/l10n_cr_exchange_rates.py (+186/-0)
l10n_cr_exchange_rates/l10n_cr_exchange_rates_view.xml (+61/-0)
l10n_cr_exchange_rates/wizard/__init__.py (+23/-0)
l10n_cr_exchange_rates/wizard/l10n_cr_exchange_rates_wizard.py (+62/-0)
l10n_cr_exchange_rates/wizard/l10n_cr_exchange_rates_wizard.xml (+40/-0)
l10n_cr_hr_payroll/l10n_cr_hr_payroll.py (+12/-0)
l10n_cr_hr_payroll/report/payroll_report.py (+9/-7)
l10n_cr_hr_payroll/report/payroll_report_for_month.py (+7/-4)
Path conflict: TODO-7.0/l10n_cr_accounting_report_library / <deleted>
Conflict adding files to l10n_cr_account_banking_reports.  Created directory.
Conflict because l10n_cr_account_banking_reports is not versioned, but has versioned children.  Versioned directory.
Conflict adding files to l10n_cr_account_banking_reports/report.  Created directory.
Conflict because l10n_cr_account_banking_reports/report is not versioned, but has versioned children.  Versioned directory.
Contents conflict in l10n_cr_account_banking_reports/report/conciliation_bank.py
Conflict adding files to l10n_cr_account_banking_reports/wizard.  Created directory.
Conflict because l10n_cr_account_banking_reports/wizard is not versioned, but has versioned children.  Versioned directory.
Contents conflict in l10n_cr_account_banking_reports/wizard/conciliation_bank_wizard.xml
Text conflict in l10n_cr_account_voucher_check_bcr/l10n_cr_account_voucher_check_bcr_view.xml
Text conflict in l10n_cr_hr_payroll/l10n_cr_hr_payroll.py
To merge this branch: bzr merge lp:openerp-costa-rica/6.1
Reviewer Review Type Date Requested Status
ClearCorp drivers Pending
Review via email: mp+180982@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ronald Rubi (rr.clearcorp) wrote :

We can not accept this merge proposal. If you like to collaborate with the project, please send an email to <email address hidden>

Unmerged revisions

283. By Launchpad Translations on behalf of clearcorp-drivers

Launchpad automatic translations update.

282. By Launchpad Translations on behalf of clearcorp-drivers

Launchpad automatic translations update.

281. By Ronald Rubi

[MRG] Fix adjustment, unreconcile accounts, l10n_cr_exchange_rates

280. By Launchpad Translations on behalf of clearcorp-drivers

Launchpad automatic translations update.

279. By Ronald Rubi

[MRG] Improve adjustment move in l10n_cr_exchange_rates

278. By Launchpad Translations on behalf of clearcorp-drivers

Launchpad automatic translations update.

277. By Ronald Rubi

[IMP] Fix BCRParser. Add three methods with the three versions of the file.

276. By Launchpad Translations on behalf of clearcorp-drivers

Launchpad automatic translations update.

275. By Ronald Rubi

[MRG] Fix (one more time) columns for debit and credit. Extract the amounts for each columns

274. By Ronald Rubi

[MRG] Fix errors with columns debit and credit. Conversion to float

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'TODO-7.0/l10n_cr_account_banking_cr_bac/__openerp__.py'
2--- TODO-7.0/l10n_cr_account_banking_cr_bac/__openerp__.py 2012-07-12 00:37:04 +0000
3+++ TODO-7.0/l10n_cr_account_banking_cr_bac/__openerp__.py 2013-08-20 07:28:14 +0000
4@@ -27,7 +27,7 @@
5 'author': 'CLEARCORP S.A.',
6 'website': 'http://www.clearcorp.co.cr',
7 'category': 'Account Banking',
8- 'depends': ['account_banking'],
9+ 'depends': ['account_banking','account_parser_type',],
10 'init_xml': [],
11 'update_xml': [
12 ],
13
14=== modified file 'TODO-7.0/l10n_cr_account_banking_cr_bac/bac_mt940.py'
15--- TODO-7.0/l10n_cr_account_banking_cr_bac/bac_mt940.py 2013-02-22 22:35:48 +0000
16+++ TODO-7.0/l10n_cr_account_banking_cr_bac/bac_mt940.py 2013-08-20 07:28:14 +0000
17@@ -22,12 +22,13 @@
18 #
19
20 from account_banking.parsers import models
21-from tools.translate import _
22 from mt940_parser import BACParser
23 import re
24-import osv
25+from osv import osv, fields
26 import logging
27 import datetime
28+from tools.translate import _
29+import base64
30
31 bt = models.mem_bank_transaction
32 logger = logging.getLogger('bac_mt940')
33@@ -155,8 +156,8 @@
34 This format is available through
35 the BAC web interface.
36 ''')
37-
38- def parse(self, cr, data,**kwargs):
39+
40+ def parse(self, cr, statements_file,**kwargs):
41 '''
42 ** Kwargs parameter is used for a dynamic list of parameters.
43 The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
44@@ -171,91 +172,112 @@
45 list_record = []
46 inversion_colocada = 0
47
48+ """
49+ **kwargs have all the parameters that have the wizard and
50+ has all the parameters passed from the wizard before calling
51+ the method that parses the file.
52+ """
53+ #pass to encoding with the correct type of file.
54+ data = base64.decodestring(statements_file)
55+
56 # Split into statements
57 statements = [st for st in re.split('[\r\n]*(?=:20:)', data)]
58 # Split by records
59 statement_list = [re.split('[\r\n ]*(?=:\d\d[\w]?:)', st) for st in statements]
60-
61- for statement_lines in statement_list:
62- stmnt = statement()
63-
64- """EXTRACCION DE DATOS """
65- for record in statement_lines:
66- records = parser.parse_record(record)
67-
68- if records is not None:
69- ############START PAGO CAPITAL INVERSION
70- if records['recordid'] == '60F':
71- start_balance = float(records['startingbalance'])
72- if records['recordid'] == '61':
73- amount = float(records['amount'])
74- if records['recordid'] == '86' and records['infoline1'] == 'PAGO CAPITAL INVERSION':
75- start_amount = amount
76- start_balance += amount #con la suma ya realizada.
77- ############END PAGO CAPITAL INVERSION
78-
79- ############START INVERSION COLOCADA
80- if records['recordid'] == '86':
81- cad = records['infoline1']
82- if cad.find('INVERSION COLOCADA') > 0:
83- inversion_colocada = amount
84-
85- if records['recordid'] == '62F':
86- ending_balance = (inversion_colocada + float(records['endingbalance']))
87-
88- if records is not None:
89- """ACTUALIZACION DE DATOS """
90- for record in statement_lines:
91- if record is not None:
92- records = parser.parse_record(record)
93+
94+ '''
95+ In the first position of the statement_list is the account number.
96+ If the account number that pass in the **kwargs dictionary.
97+ '''
98+ account_number_wizard = kwargs['account_number']
99+ #statement_list is a list, extract the first position
100+ accnum = statement_list[1][1]
101+
102+ #find the number in the account string.
103+ if accnum.find(account_number_wizard) > -1:
104+ for statement_lines in statement_list:
105+ stmnt = statement()
106
107- if (records['recordid'] == '60F'):
108- dic = {'startingbalance':start_balance}
109- records.update(dic)
110+ """EXTRACCION DE DATOS """
111+ for record in statement_lines:
112+ records = parser.parse_record(record,**kwargs)
113+
114+ if records is not None:
115+ ############START PAGO CAPITAL INVERSION
116+ if records['recordid'] == '60F':
117+ start_balance = float(records['startingbalance'])
118+ if records['recordid'] == '61':
119+ amount = float(records['amount'])
120+ if records['recordid'] == '86' and records['infoline1'] == 'PAGO CAPITAL INVERSION':
121+ start_amount = amount
122+ start_balance += amount #con la suma ya realizada.
123+ ############END PAGO CAPITAL INVERSION
124
125- if (records['recordid'] == '62F'):
126- dic = {'endingbalance': ending_balance}
127- records.update(dic)
128-
129- if (records['recordid'] == '64'):
130- dic = {'endingbalance': ending_balance}
131- records.update(dic)
132-
133- #SI LA LINEA NO ES INVERSION COLOCADA O PAGO CAPITAL INVERSION, SE AGREGA A LA LISTA
134- #PAGO_CAPITAL
135- if (records['recordid'] == '86'):
136+ ############START INVERSION COLOCADA
137+ if records['recordid'] == '86':
138 cad = records['infoline1']
139-
140- if (cad != "PAGO CAPITAL INVERSION") and (cad.find("INVERSION COLOCADA") < 0):
141- list_record.append(records)
142-
143- if (records['recordid'] == '61'):
144- try:
145- if float(records['amount']) != start_amount and float(records['amount']) != inversion_colocada:
146- list_record.append(records)
147- except:
148- list_record.append(records)
149- #####################################################################
150-
151- if (records['recordid'] != '61' and records['recordid'] != '86' ):
152- list_record.append(records)
153-
154- [stmnt.import_record(r) for r in list_record if r is not None]
155-
156- if stmnt.is_valid():
157- result.append(stmnt)
158- list_record = []
159- inversion_colocada = 0
160- start_balance = 0
161- else:
162- logger.info("Invalid Statement:")
163- logger.info(records[0])
164- logger.info(records[1])
165- logger.info(records[2])
166- logger.info(records[3])
167- logger.info(records[4])
168- list_record = []
169-
170- return result
171-
172+ if cad.find('INVERSION COLOCADA') > 0:
173+ inversion_colocada = amount
174+
175+ if records['recordid'] == '62F':
176+ ending_balance = (inversion_colocada + float(records['endingbalance']))
177+
178+ if records is not None:
179+ """ACTUALIZACION DE DATOS """
180+ for record in statement_lines:
181+ if record is not None:
182+ records = parser.parse_record(record)
183+
184+ if (records['recordid'] == '60F'):
185+ dic = {'startingbalance':start_balance}
186+ records.update(dic)
187+
188+ if (records['recordid'] == '62F'):
189+ dic = {'endingbalance': ending_balance}
190+ records.update(dic)
191+
192+ if (records['recordid'] == '64'):
193+ dic = {'endingbalance': ending_balance}
194+ records.update(dic)
195+
196+ #SI LA LINEA NO ES INVERSION COLOCADA O PAGO CAPITAL INVERSION, SE AGREGA A LA LISTA
197+ #PAGO_CAPITAL
198+ if (records['recordid'] == '86'):
199+ cad = records['infoline1']
200+
201+ if (cad != "PAGO CAPITAL INVERSION") and (cad.find("INVERSION COLOCADA") < 0):
202+ list_record.append(records)
203+
204+ if (records['recordid'] == '61'):
205+ try:
206+ if float(records['amount']) != start_amount and float(records['amount']) != inversion_colocada:
207+ list_record.append(records)
208+ except:
209+ list_record.append(records)
210+ #####################################################################
211+
212+ if (records['recordid'] != '61' and records['recordid'] != '86' ):
213+ list_record.append(records)
214+
215+ [stmnt.import_record(r) for r in list_record if r is not None]
216+
217+ if stmnt.is_valid():
218+ result.append(stmnt)
219+ list_record = []
220+ inversion_colocada = 0
221+ start_balance = 0
222+ else:
223+ logger.info("Invalid Statement:")
224+ logger.info(records[0])
225+ logger.info(records[1])
226+ logger.info(records[2])
227+ logger.info(records[3])
228+ logger.info(records[4])
229+ list_record = []
230+ return result
231+
232+ else:
233+ raise osv.except_osv(_('Error'),
234+ _('Error en la importación! La cuenta especificada en el archivo no coincide con la seleccionada en el asistente de importacion'))
235+
236 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
237
238=== modified file 'TODO-7.0/l10n_cr_account_banking_cr_bcr/__init__.py' (properties changed: +x to -x)
239=== modified file 'TODO-7.0/l10n_cr_account_banking_cr_bcr/__openerp__.py' (properties changed: +x to -x)
240--- TODO-7.0/l10n_cr_account_banking_cr_bcr/__openerp__.py 2012-07-06 05:08:02 +0000
241+++ TODO-7.0/l10n_cr_account_banking_cr_bcr/__openerp__.py 2013-08-20 07:28:14 +0000
242@@ -27,7 +27,7 @@
243 'author': 'CLEARCORP S.A.',
244 'website': 'http://www.clearcorp.co.cr',
245 'category': 'Account Banking',
246- 'depends': ['account_banking'],
247+ 'depends': ['account_banking','account_parser_type'],
248 'init_xml': [],
249 'update_xml': [],
250 'demo_xml': [],
251
252=== modified file 'TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_format.py' (properties changed: +x to -x)
253--- TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_format.py 2013-02-22 22:35:48 +0000
254+++ TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_format.py 2013-08-20 07:28:14 +0000
255@@ -24,10 +24,11 @@
256 from tools.translate import _
257 from bcr_parser import BCRParser
258 import re
259-import osv
260+from osv import osv, fields
261 import logging
262 import pprint
263 from datetime import datetime
264+import base64
265
266 bt = models.mem_bank_transaction
267 logger = logging.getLogger( 'bcr_mt940' )
268@@ -138,8 +139,8 @@
269 This format is available through
270 the BCR web interface.
271 ''')
272-
273- def parse(self, cr, data, **kwargs):
274+
275+ def parse(self, cr, statements_file, **kwargs):
276
277 '''
278 ** Kwargs parameter is used for a dynamic list of parameters.
279@@ -155,7 +156,16 @@
280 parser = BCRParser()
281 stmnt = statement()
282
283- records = parser.parse_stamenent_record(data)
284+ """
285+ **kwargs have all the parameters that have the wizard and
286+ has all the parameters passed from the wizard before calling
287+ the method that parses the file.
288+ """
289+
290+ #pass to encoding with the correct type of file.
291+ data = base64.decodestring(statements_file)
292+
293+ records = parser.parse_stamenent_record(data,**kwargs)
294
295 stmnt._transmission_number(records)
296 stmnt._account_number(records)
297@@ -168,7 +178,7 @@
298
299 if stmnt.is_valid():
300 result.append(stmnt)
301-
302+
303 return result
304
305 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
306
307=== modified file 'TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_parser.py'
308--- TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_parser.py 2013-02-22 22:35:48 +0000
309+++ TODO-7.0/l10n_cr_account_banking_cr_bcr/bcr_parser.py 2013-08-20 07:28:14 +0000
310@@ -27,6 +27,8 @@
311 from dateutil import parser
312 from pprint import PrettyPrinter
313 from copy import copy
314+from tools.translate import _
315+from osv import osv, fields
316
317 class BCRParser( object ):
318 """
319@@ -72,75 +74,90 @@
320
321 cad = ''
322 list_split = rec.split('\r\n')
323-
324- for l in list_split:
325-
326- # _transmission_number -> FIRST REVISION
327- if (l.find('Movimiento realizado el periodo', 0, len('Movimiento realizado el periodo')) > -1):
328- line_dict['statementnr'] = self.extract_number(l)
329- # _transmission_number -> SECOND REVISION
330- elif (l.find('MOVIMIENTO REALIZADO', 0, len('MOVIMIENTO REALIZADO')) > -1):
331- line_dict['statementnr'] = self.extract_number(l)
332-
333- #_account_number -> FIRST REVISION
334- if l.find('Movimiento de Cuenta Corriente', 0, len('Movimiento de Cuenta Corriente')) > -1:
335- line_dict['account_number'] = self.extract_number(l)
336- if (l.find('D',0,len(l)) > -1):
337- line_dict['currencycode'] = 'USD'
338- else:
339- line_dict['currencycode'] = 'CRC'
340- #_account_number -> SECOND REVISION
341- elif (l.find('MOVIMIENTO DE LA CUENTA CORRIENTE No.', 0, len('MOVIMIENTO DE LA CUENTA CORRIENTE No.')) > -1):
342- account_str = self.extract_number(l)
343- #001-0246447-0
344- account_1 = account_str[2:3] #1
345- account_2 = account_str[4:] #246447-0
346- account_complete = account_1+self.extract_number(account_2)#12464470
347- line_dict['account_number'] = self.extract_number(account_complete)
348- if (l.find('DOLARES',0,len(l)) > -1):
349- line_dict['currencycode'] = 'USD'
350- else:
351- line_dict['currencycode'] = 'CRC'
352-
353- #FECHA Y HORA -> FIRST REVISION
354- if (l.find('Solicitado el', 0, len('Solicitado el')) > -1):
355- date = hour = cad = ''
356- date = self.extract_date_regular_expresion(l)
357- if len(date) > 0:
358- hour = self.extract_hour_regular_expresion(l)
359- cad = date + ' ' + hour
360- line_dict['transref'] = cad
361- line_dict['bookingdate'] = cad
362- #FECHA Y HORA -> SECOND REVISION
363- elif (l.find('SOLICITADO EL', 0, len('SOLICITADO EL')) > -1):
364- date = hour = cad = ''
365- date = self.extract_date_regular_expresion(l)
366- if len(date) > 0:
367- hour = self.extract_hour_regular_expresion(l)
368- cad = date + ' ' + hour
369- line_dict['transref'] = cad
370- line_dict['bookingdate'] = cad
371-
372- #_opening_balance -> FIRST REVISION
373- if l.find('Saldo Inicial', 0, len('Saldo Inicial')) > -1:
374- line_dict['startingbalance'] = self.extract_float(l)
375- #_opening_balance -> SECOND REVISION
376- elif l.find('INICIAL', 0, len('INICIAL')) > -1:
377- line_dict['startingbalance'] = self.extract_float(l)
378-
379- #_closing_balance -> FIRST REVISION
380- if l.find('FINAL', 0, len('FINAL')) > -1:
381- line_dict['endingbalance'] = self.extract_float(l)
382- #_closing_balance -> SECOND REVISION
383- elif l.find('Saldo Final', 0, len('Saldo Final')) > -1:
384- line_dict['endingbalance'] = self.extract_float(l)
385-
386- line_dict['ammount'] = float( line_dict['startingbalance'] ) + float( line_dict['endingbalance'] )
387- line_dict['id'] = line_dict['bookingdate'] + ' - ' + line_dict['account_number']
388- self.line_dict = line_dict
389-
390- return line_dict
391-
392+ account_number_wizard = kwargs['account_number']
393+
394+ #If return True, the account are the same.
395+ if self.match_account(list_split, account_number_wizard):
396+ for l in list_split:
397+ #_account_number -> FIRST REVISION
398+ if l.find('Movimiento de Cuenta Corriente', 0, len('Movimiento de Cuenta Corriente')) > -1:
399+ line_dict['account_number'] = self.extract_number(l)
400+
401+ if (l.find('D',0,len(l)) > -1):
402+ line_dict['currencycode'] = 'USD'
403+ else:
404+ line_dict['currencycode'] = 'CRC'
405+
406+ #_account_number -> SECOND REVISION
407+ elif (l.find('MOVIMIENTO DE LA CUENTA CORRIENTE No.', 0, len('MOVIMIENTO DE LA CUENTA CORRIENTE No.')) > -1):
408+ account_str = self.extract_number(l)
409+ #001-0246447-0
410+ account_1 = account_str[2:3] #1
411+ account_2 = account_str[4:] #246447-0
412+ account_complete = account_1+self.extract_number(account_2)#12464470
413+ line_dict['account_number'] = self.extract_number(account_complete)
414+ if (l.find('DOLARES',0,len(l)) > -1):
415+ line_dict['currencycode'] = 'USD'
416+ else:
417+ line_dict['currencycode'] = 'CRC'
418+
419+ # _transmission_number -> FIRST REVISION
420+ if (l.find('Movimiento realizado el periodo', 0, len('Movimiento realizado el periodo')) > -1):
421+ line_dict['statementnr'] = self.extract_number(l)
422+ date_1 = self.extract_date_regular_expresion_line_format_2(l,0)
423+ date_2 = self.extract_date_regular_expresion_line_format_2(l,1)
424+
425+ # _transmission_number -> SECOND REVISION
426+ elif (l.find('MOVIMIENTO REALIZADO', 0, len('MOVIMIENTO REALIZADO')) > -1):
427+ line_dict['statementnr'] = self.extract_number(l)
428+ date_1 = self.extract_date_regular_expresion_line_format_2(l,0)
429+ date_2 = self.extract_date_regular_expresion_line_format_2(l,1)
430+
431+ #date and hour -> FIRST REVISION
432+ if (l.find('Solicitado el', 0, len('Solicitado el')) > -1):
433+ date = hour = cad = ''
434+ date = self.extract_date_regular_expresion(l)
435+ if len(date) > 0:
436+ hour = self.extract_hour_regular_expresion(l)
437+ cad = date + ' ' + hour
438+ line_dict['transref'] = cad
439+ line_dict['bookingdate'] = cad
440+
441+ #date and hour -> SECOND REVISION
442+ elif (l.find('SOLICITADO EL', 0, len('SOLICITADO EL')) > -1):
443+ date = hour = cad = ''
444+ date = self.extract_date_regular_expresion(l)
445+ if len(date) > 0:
446+ hour = self.extract_hour_regular_expresion(l)
447+ cad = date + ' ' + hour
448+ line_dict['transref'] = cad
449+ line_dict['bookingdate'] = cad
450+
451+ #_opening_balance -> FIRST REVISION
452+ if l.find('Saldo Inicial', 0, len('Saldo Inicial')) > -1:
453+ line_dict['startingbalance'] = self.extract_float(l)
454+ #_opening_balance -> SECOND REVISION
455+ elif l.find('INICIAL', 0, len('INICIAL')) > -1:
456+ line_dict['startingbalance'] = self.extract_float(l)
457+
458+ #_closing_balance -> FIRST REVISION
459+ if l.find('FINAL', 0, len('FINAL')) > -1:
460+ line_dict['endingbalance'] = self.extract_float(l)
461+
462+ #_closing_balance -> SECOND REVISION
463+ elif l.find('Saldo Final', 0, len('Saldo Final')) > -1:
464+ line_dict['endingbalance'] = self.extract_float(l)
465+
466+ line_dict['ammount'] = float( line_dict['startingbalance'] ) + float( line_dict['endingbalance'] )
467+ line_dict['id'] = date_1 + ' - ' + date_2 + ' Extracto BCR ' + line_dict['account_number']
468+ self.line_dict = line_dict
469+
470+ return line_dict
471+
472+ else:
473+ raise osv.except_osv(_('Error'),
474+ _('Error en la importación! La cuenta especificada en el archivo no coincide con la seleccionada en el asistente de importacion'))
475+
476 def statement_lines ( self, rec ):
477 parser = BCRParser()
478 mapping = {
479@@ -315,6 +332,19 @@
480 cad = cad + character
481 return cad
482
483+ #with the pos parameter is said which of the two dates must be brought
484+ #result brings a list of two elements, the post tells us to choose
485+ def extract_date_regular_expresion_line_format_2(self, date, pos):
486+ cad = ''
487+ result = []
488+ date_string = ''
489+ result = re.findall('([0-9]{2}-[0-9]{2}-[0-9]{4})[\s]*',date)
490+ date_str = result[pos]
491+
492+ for character in date_str:
493+ cad = cad + character
494+ return cad
495+
496 def extract_hour_regular_expresion(self, date):
497 cad = ''
498 result = []
499@@ -349,10 +379,36 @@
500 output.append( self.parse_stamenent_record( rec ) )
501
502 return output
503+
504+ #check if the account_number in the file match with the selected in the wizard.
505+ def match_account(self, list_split, account_number_wizard):
506+ accnumber = ''
507+ for l in list_split:
508+ #_account_number -> FIRST REVISION
509+ if l.find('Movimiento de Cuenta Corriente', 0, len('Movimiento de Cuenta Corriente')) > -1:
510+ accnumber = self.extract_number(l)
511+ break
512+
513+ #_account_number -> SECOND REVISION
514+ elif (l.find('MOVIMIENTO DE LA CUENTA CORRIENTE No.', 0, len('MOVIMIENTO DE LA CUENTA CORRIENTE No.')) > -1):
515+ account_str = self.extract_number(l)
516+ #001-0246447-0
517+ account_1 = account_str[2:3] #1
518+ account_2 = account_str[4:] #246447-0
519+ account_complete = account_1+self.extract_number(account_2)#12464470
520+ accnumber = self.extract_number(account_complete)
521+ break
522+
523+ #If return True, the account_number in the wizard and the account in the file are the same.
524+ if accnumber.find(account_number_wizard) > -1:
525+ return True
526+ else:
527+ return False
528+
529
530 def parse_file( filename ):
531 bacfile = open( filename, "r" )
532- p = BCRParser().parse( bacfile.readlines() )
533+ p = BCRParser().parse(bacfile.readlines())
534
535 def main():
536 """The main function, currently just calls a dummy filename
537
538=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/__openerp__.py'
539--- TODO-7.0/l10n_cr_account_financial_report_webkit/__openerp__.py 2013-02-01 14:30:02 +0000
540+++ TODO-7.0/l10n_cr_account_financial_report_webkit/__openerp__.py 2013-08-20 07:28:14 +0000
541@@ -36,8 +36,6 @@
542 'data/financial_webkit_header.xml',
543 'report/report.xml',
544 'wizard/account_bank_balances_wizard_view.xml',
545- 'wizard/l10n_cr_partners_ledger_wizard_view.xml',
546- 'wizard/l10n_cr_open_invoices_wizard_view.xml',
547 'report_menus.xml',
548 'account_view.xml',
549 ],
550
551=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/de.po'
552--- TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/de.po 2013-03-05 05:26:24 +0000
553+++ TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/de.po 2013-08-20 07:28:14 +0000
554@@ -13,8 +13,8 @@
555 "MIME-Version: 1.0\n"
556 "Content-Type: text/plain; charset=UTF-8\n"
557 "Content-Transfer-Encoding: 8bit\n"
558-"X-Launchpad-Export-Date: 2013-03-05 05:26+0000\n"
559-"X-Generator: Launchpad (build 16514)\n"
560+"X-Launchpad-Export-Date: 2013-08-06 05:01+0000\n"
561+"X-Generator: Launchpad (build 16718)\n"
562
563 #. module: account_financial_report_webkit
564 #: field:account.common.balance.report,account_ids:0
565
566=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/es_CR.po'
567--- TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/es_CR.po 2012-11-01 17:12:59 +0000
568+++ TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/es_CR.po 2013-08-20 07:28:14 +0000
569@@ -76,7 +76,7 @@
570 msgstr "Cuenta"
571
572 #. module: l10n_cr_account_financial_report_webkit
573-#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:55
574+#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:63
575 msgid "Due Date"
576 msgstr "Fecha de Vencimiento"
577
578@@ -169,6 +169,11 @@
579 msgstr "Filtrar por"
580
581 #. module: l10n_cr_account_financial_report_webkit
582+#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:63
583+msgid "Date maturity"
584+msgstr "Fecha de Vencimiento"
585+
586+#. module: l10n_cr_account_financial_report_webkit
587 #: report:addons/l10n_cr_account_financial_report_webkit/report/account_bank_balances.mako:60
588 #: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_financial_report.mako:23
589 #: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako:34
590@@ -289,6 +294,11 @@
591 msgstr "Sólo Apertura"
592
593 #. module: l10n_cr_account_financial_report_webkit
594+#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:45
595+msgid "RECEIVABLE"
596+msgstr "POR COBRAR"
597+
598+#. module: l10n_cr_account_financial_report_webkit
599 #: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako:60
600 #: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako:70
601 msgid "Custom Filter"
602@@ -549,6 +559,11 @@
603 msgstr "Este informe le permite imprimir o generar un pdf del saldo de cuentas de banco que le permite comprobar rápidamente el balance de cada una de sus cuentas en un único informe"
604
605 #. module: l10n_cr_account_financial_report_webkit
606+#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:64
607+msgid "Number"
608+msgstr "Número"
609+
610+#. module: l10n_cr_account_financial_report_webkit
611 #: view:account.balances:0
612 msgid "Accounts Filters"
613 msgstr "Filtros de Cuentas"
614@@ -562,6 +577,11 @@
615 msgstr "Filtro por Fechas"
616
617 #. module: l10n_cr_account_financial_report_webkit
618+#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:43
619+msgid "PAYABLE"
620+msgstr "POR PAGAR"
621+
622+#. module: l10n_cr_account_financial_report_webkit
623 #: selection:account.balances,filter:0
624 #: selection:conciliation.bank.webkit,filter:0
625 msgid "No Filters"
626@@ -654,8 +674,8 @@
627 msgstr "Reporte de Conciliación de Bancos"
628
629 #. module: l10n_cr_account_financial_report_webkit
630-#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:149
631-msgid "Nota: "
632+#: report:addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako:169
633+msgid "Note: "
634 msgstr "Nota: "
635
636 #. module: l10n_cr_account_financial_report_webkit
637
638=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/fr.po'
639--- TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/fr.po 2013-03-05 05:26:24 +0000
640+++ TODO-7.0/l10n_cr_account_financial_report_webkit/i18n/fr.po 2013-08-20 07:28:14 +0000
641@@ -14,8 +14,8 @@
642 "MIME-Version: 1.0\n"
643 "Content-Type: text/plain; charset=UTF-8\n"
644 "Content-Transfer-Encoding: 8bit\n"
645-"X-Launchpad-Export-Date: 2013-03-05 05:26+0000\n"
646-"X-Generator: Launchpad (build 16514)\n"
647+"X-Launchpad-Export-Date: 2013-08-06 05:01+0000\n"
648+"X-Generator: Launchpad (build 16718)\n"
649
650 #. module: account_financial_report_webkit
651 #: field:account.common.balance.report,account_ids:0
652
653=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/__init__.py'
654--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/__init__.py 2012-11-04 16:56:05 +0000
655+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/__init__.py 2013-08-20 07:28:14 +0000
656@@ -1,5 +1,3 @@
657-import l10n_cr_partners_ledger
658-import l10n_cr_open_invoices
659 import l10n_cr_partner_balance
660 import account_bank_balances
661 import l10n_cr_account_financial_report
662
663=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako'
664--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako 2012-11-01 17:21:31 +0000
665+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako 1970-01-01 00:00:00 +0000
666@@ -1,407 +0,0 @@
667-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
668-<html xmlns="http://www.w3.org/1999/xhtml">
669- <head>
670- <style type="text/css">
671- .overflow_ellipsis {
672- text-overflow: ellipsis;
673- overflow: hidden;
674- white-space: nowrap;
675- }
676-
677- ${css}
678- </style>
679- </head>
680- <body>
681- <%!
682- def amount(text):
683- return text.replace('-', '&#8209;') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
684- %>
685-
686- <%setLang(user.context_lang)%>
687-
688- <%
689- initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
690- %>
691-
692- <div class="act_as_table data_table">
693- <div class="act_as_row labels">
694- <div class="act_as_cell">${_('Chart of Account')}</div>
695- <div class="act_as_cell">${_('Fiscal Year')}</div>
696- <div class="act_as_cell">
697- %if filter_form(data) == 'filter_date':
698- ${_('Dates Filter')}
699- %else:
700- ${_('Periods Filter')}
701- %endif
702- </div>
703- <div class="act_as_cell">${_('Accounts Filter')}</div>
704- <div class="act_as_cell">${_('Target Moves')}</div>
705- <div class="act_as_cell">${_('Initial Balance')}</div>
706- </div>
707- <div class="act_as_row">
708- <div class="act_as_cell">${ chart_account.name }</div>
709- <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
710- <div class="act_as_cell">
711- ${_('From:')}
712- %if filter_form(data) == 'filter_date':
713- ${formatLang(start_date, date=True) if start_date else u'' }
714- %else:
715- ${start_period.name if start_period else u''}
716- %endif
717- ${_('To:')}
718- %if filter_form(data) == 'filter_date':
719- ${ formatLang(stop_date, date=True) if stop_date else u'' }
720- %else:
721- ${stop_period.name if stop_period else u'' }
722- %endif
723- </div>
724- <div class="act_as_cell">
725- %if partner_ids:
726- ${_('Custom Filter')}
727- %else:
728- ${ display_partner_account(data) }
729- %endif
730- </div>
731- <div class="act_as_cell">${ display_target_move(data) }</div>
732- <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
733- </div>
734- </div>
735- <%
736- account_by_curr = get_accounts_by_curr(cr, uid, objects)
737- %>
738- %for currency in account_by_curr:
739- %if currency[0] != 'CRC':
740- <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${currency[0]}</div>
741- %else:
742- <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${company.currency_id.name}</div>
743- %endif
744- %for account in currency[1]:
745- %if account.ledger_lines or account.init_balance:
746- <%
747- if not account.partners_order:
748- continue
749- account_total_invoice = 0.0
750- account_total_payment = 0.0
751- account_total_debit = 0.0
752- account_total_credit = 0.0
753- account_total_manual_move = 0.0
754- account_balance_cumul = 0.0
755- account_balance_cumul_curr = 0.0
756- %>
757-
758- <div class="account_title bg" style="width: 1080px; margin-top: 15px; font-size: 12px;">${account.code} - ${account.name} - ${account.report_currency_id.name or account.company_id.currency_id.name}</div>
759-
760- %for partner_name, p_id, p_ref, p_name in account.partners_order:
761- <%
762- total_invoice = 0.0
763- total_payment = 0.0
764- total_debit = 0.0
765- total_credit = 0.0
766- total_manual_move = 0.0
767- cumul_balance = 0.0
768- cumul_balance_curr = 0.0
769-
770- part_cumul_balance = 0.0
771- part_cumul_balance_curr = 0.0
772- %>
773- <div class="act_as_table list_table" style="margin-top: 5px;">
774- <div class="act_as_caption account_title">
775- ${ get_partner_name(cr, uid, partner_name, p_id, p_ref, p_name) or _('No Partner')}
776- </div>
777- <div class="act_as_thead">
778- <div class="act_as_row labels">
779- ## date
780- <div class="act_as_cell first_column" style="width: 50px;">${_('Date')}</div>
781- ## due date
782- <div class="act_as_cell" style="width: 55px;">${_('Due Date')}</div>
783- ## period
784- <div class="act_as_cell" style="width: 70px;">${_('Period')}</div>
785- ## move
786- <div class="act_as_cell" style="width: 70px;">${_('Entry')}</div>
787- ## journal
788- <div class="act_as_cell" style="width: 70px;">${_('Journal')}</div>
789- ## partner
790- <!--div class="act_as_cell" style="width: 60px;">${_('Partner')}</div-->
791- ## label
792- <div class="act_as_cell" style="width: 215px;">${_('Label')}</div>
793- ## reconcile
794- <div class="act_as_cell" style="width: 70px;">${_('Rec.')}</div>
795- ## Invoices
796- <div class="act_as_cell amount" style="width: 100px;">${_('Invoice')}</div>
797- ## credit
798- <div class="act_as_cell amount" style="width: 100px;">${_('Payments')}</div>
799- ## debit
800- <div class="act_as_cell amount" style="width: 100px;">${_('Credit')}</div>
801- ## Payments
802- <div class="act_as_cell amount" style="width: 100px;">${_('Debit')}</div>
803- ## Manual Move
804- <div class="act_as_cell amount" style="width: 115px;">${_('Manual Move')}</div>
805- ## balance cumulated
806- <div class="act_as_cell amount" style="width: 115px;">${_('Cumul. Bal.')}</div>
807- %if amount_currency(data):
808- ## currency balance
809- <div class="act_as_cell amount sep_left" style="width: 80px;">${_('Curr. Balance')}</div>
810- ## curency code
811- <div class="act_as_cell amount" style="width: 30px; text-align: right;">${_('Curr.')}</div>
812- %endif
813- </div>
814- </div>
815- <div class="act_as_tbody">
816- <!--<%
817- #total_debit = account.init_balance.get(p_id, {}).get('debit') or 0.0
818- #total_credit = account.init_balance.get(p_id, {}).get('credit') or 0.0
819- total_cumul_balance = 0.0
820- %>-->
821- %if initial_balance_mode and (total_debit or total_credit):
822- <%
823- #part_cumul_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
824- #part_cumul_balance_curr = account.init_balance.get(p_id, {}).get('init_balance_currency') or 0.0
825- #balance_forward_currency = account.init_balance.get(p_id, {}).get('currency_name') or ''
826-
827- #cumul_balance += part_cumul_balance
828- #cumul_balance_curr += part_cumul_balance_curr
829- %>
830- %endif
831-
832-
833- %for line in account.ledger_lines.get(p_id, []):
834- <%open = is_open(cr, uid, line)%>
835- %if open:
836- <%
837- label_elements = [line.get('lname') or '']
838- if line.get('invoice_number'):
839- label_elements.append("(%s)" % (line['invoice_number'],))
840- label = ' '.join(label_elements)
841-
842- invoice_amount = 0.0
843- payment_amount = 0.0
844- credit_amount = 0.0
845- debit_amount = 0.0
846- MM_amount = 0.0
847-
848- amount = get_amount(cr, uid, line, currency[0])
849- %>
850- <div class="act_as_row lines">
851- ## date
852- <div class="act_as_cell first_column">${formatLang(line.get('ldate') or '', date=True)}</div>
853- ## date
854- <div class="act_as_cell">${formatLang(line.get('date_maturity') or '', date=True)}</div>
855- ## period
856- <div class="act_as_cell">${line.get('period_code') or ''}</div>
857- ## move
858- <div class="act_as_cell">${line.get('move_name') or ''}</div>
859- ## journal
860- <div class="act_as_cell">${line.get('jcode') or ''}</div>
861- ## partner
862- <!--div class="act_as_cell overflow_ellipsis">${line.get('partner_name') or ''}</div-->
863- ## label
864- <div class="act_as_cell">${label}</div>
865- ## reconcile
866- <div class="act_as_cell">${line.get('rec_name') or ''}</div>
867- ## Invoice
868- <div class="act_as_cell amount">
869- %if amount[0] == 'invoice':
870- <%
871- invoice_amount = amount[1]
872- total_invoice += invoice_amount
873- %>
874- ${ formatLang(invoice_amount or 0.0) }
875- %else:
876- ${'0.0'}
877- %endif
878- %if amount[2] != None and amount[0] == 'invoice':
879- ${' ('}${ formatLang(amount[2]) }${')'}
880- %endif
881- </div>
882- ## Payment
883- <div class="act_as_cell amount">
884- %if amount[0] == 'payment':
885- <%
886- payment_amount = amount[1]
887- total_payment += payment_amount
888- %>
889- ${ formatLang(payment_amount or 0.0) }
890- %else:
891- ${'0.0'}
892- %endif
893- %if amount[2] != None and amount[0] == 'payment':
894- ${' ('}${ formatLang(amount[2]) }${')'}
895- %endif
896- </div>
897- ## Credit
898- <div class="act_as_cell amount">
899- %if amount[0] == 'credit':
900- <%
901- credit_amount = amount[1]
902- total_credit += credit_amount
903- %>
904- ${ formatLang(credit_amount or 0.0) }
905- %else:
906- ${'0.0'}
907- %endif
908- %if amount[2] != None and amount[0] == 'credit':
909- ${' ('}${ formatLang(amount[2]) }${')'}
910- %endif
911- </div>
912- ## Debit
913- <div class="act_as_cell amount">
914- %if amount[0] == 'debit':
915- <%
916- debit_amount = amount[1]
917- total_debit += debit_amount
918- %>
919- ${ formatLang(debit_amount or 0.0) }
920- %else:
921- ${'0.0'}
922- %endif
923- %if amount[2] != None and amount[0] == 'debit':
924- ${' ('}${ formatLang(amount[2]) }${')'}
925- %endif
926- </div>
927- ## Manual move
928- <div class="act_as_cell amount">
929- %if amount[0] == 'manual':
930- <%
931- MM_amount = amount[1]
932- total_manual_move += MM_amount
933- %>
934- ${ formatLang(MM_amount or 0.0) }
935- %else:
936- ${'0.0'}
937- %endif
938- %if amount[2] != None and amount[0] == 'manual':
939- ${' ('}${ formatLang(amount[2]) }${')'}
940- %endif
941- </div>
942- ## balance cumulated
943- <% cumul_balance = (invoice_amount+payment_amount+credit_amount+debit_amount+MM_amount) or 0.0 %>
944- <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(cumul_balance) }</div>
945- %if amount_currency(data):
946- ## currency balance
947- <div class="act_as_cell sep_left amount">${formatLang(line.get('amount_currency') or 0.0) }</div>
948- ## curency code
949- <div class="act_as_cell" style="text-align: right; ">${line.get('currency_code') or ''}</div>
950- %endif
951- </div>
952- <%
953- total_cumul_balance = total_invoice + total_payment + total_debit + total_credit + total_manual_move
954- %>
955- %endif
956- %endfor
957- <div class="act_as_row lines labels">
958- ## date
959- <div class="act_as_cell first_column"></div>
960- ## period
961- <div class="act_as_cell"></div>
962- ## move
963- <div class="act_as_cell"></div>
964- ## journal
965- <div class="act_as_cell"></div>
966- ## partner
967- <div class="act_as_cell"></div>
968- ## label
969- <div class="act_as_cell">${_('Saldo')}</div>
970- ## reconcile
971- <!--div class="act_as_cell"></div-->
972- %if currency[0] != 'CRC':
973- <% currency_symbol = get_currency_symbol(cr, uid, currency[0]) %>
974- ## invoice
975- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_invoice) }</div>
976- ## payment
977- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_payment) }</div>
978- ## credit
979- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_credit) }</div>
980- ## debit
981- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_debit) }</div>
982- ## manual move
983- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_manual_move) }</div>
984- ## balance cumulated
985- <div class="act_as_cell amount" style="padding-right: 1px;">${currency_symbol} ${formatLang(total_cumul_balance) }</div>
986- %else:
987- ## invoice
988- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_invoice) }</div>
989- ## payment
990- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_payment) }</div>
991- ## credit
992- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_credit) }</div>
993- ## debit
994- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_debit) }</div>
995- ## manual move
996- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_manual_move) }</div>
997- ## balance cumulated
998- <div class="act_as_cell amount" style="padding-right: 1px;">${company.currency_id.symbol} ${formatLang(total_cumul_balance) }</div>
999- %endif
1000- %if amount_currency(data):
1001- ## currency balance
1002- %if account.report_currency_id:
1003- <!--div class="act_as_cell amount sep_left">${formatLang(cumul_balance_curr) | amount }</div-->
1004- %else:
1005- <div class="act_as_cell sep_left amount">${ u'-' }</div>
1006- %endif
1007- ## currency code
1008- <div class="act_as_cell" style="text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
1009- %endif
1010- </div>
1011- </div>
1012- </div>
1013- <%
1014- account_total_invoice += total_invoice
1015- account_total_payment += total_payment
1016- account_total_debit += total_debit
1017- account_total_credit += total_credit
1018- account_total_manual_move += total_manual_move
1019- account_balance_cumul += total_cumul_balance
1020- account_balance_cumul_curr += account_balance_cumul
1021- %>
1022- %endfor
1023-
1024- <div class="act_as_table list_table" style="margin-top:5px;">
1025- <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
1026- <div class="act_as_cell first_column" style="width: 300px;">${account.code} - ${account.name}</div>
1027- ## label
1028- <div class="act_as_cell" style="width: 302px;">${_("Saldo")}</div>
1029- %if currency[0] != 'CRC':
1030- ## invoice
1031- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_invoice) }</div>
1032- ## payment
1033- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_payment) }</div>
1034- ## credit
1035- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_credit) }</div>
1036- ## debit
1037- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_debit) }</div>
1038- ## manual move
1039- <div class="act_as_cell amount" style="width: 115px;">${currency_symbol} ${ formatLang(account_total_manual_move) }</div>
1040- ## balance cumulated
1041- <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${currency_symbol} ${ formatLang(account_balance_cumul) }</div>
1042- %else:
1043- ## invoice
1044- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_invoice) }</div>
1045- ## payment
1046- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_payment) }</div>
1047- ## credit
1048- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_credit) }</div>
1049- ## debit
1050- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_debit) }</div>
1051- ## manual move
1052- <div class="act_as_cell amount" style="width: 115px;">${company.currency_id.symbol} ${ formatLang(account_total_manual_move) }</div>
1053- ## balance cumulated
1054- <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${company.currency_id.symbol} ${ formatLang(account_balance_cumul) }</div>
1055- %endif
1056- %if amount_currency(data):
1057- ## currency balance
1058- %if account.report_currency_id:
1059- <!--div class="act_as_cell amount sep_left" style="width: 80px;">${ formatLang(account_balance_cumul_curr) | amount }</div-->
1060- %else:
1061- <div class="act_as_cell amount sep_left" style="width: 80px;">${ u'-' }</div>
1062- %endif
1063- ## curency code
1064- <div class="act_as_cell amount" style="width: 30px; text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
1065- %endif
1066- </div>
1067- </div>
1068- </div>
1069- %endif
1070- %endfor
1071- %endfor
1072- </body>
1073-</html>
1074
1075=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako'
1076--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako 2012-07-04 20:52:00 +0000
1077+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako 2013-08-20 07:28:14 +0000
1078@@ -1,162 +1,178 @@
1079 <html>
1080 <head>
1081- <style type="text/css">
1082- ${css}
1083-
1084- .list_table .act_as_row {
1085- margin-top: 10px;
1086- margin-bottom: 10px;
1087- font-size:10px;
1088- }
1089-
1090- .account_line {
1091- font-weight: bold;
1092- font-size: 15px;
1093- background-color:#F0F0F0;
1094- }
1095-
1096- .account_line .act_as_cell {
1097- height: 30px;
1098- vertical-align: bottom;
1099- }
1100-
1101- </style>
1102+ <style type="text/css">
1103+ ${css}
1104+
1105+ .list_table .act_as_row {
1106+ margin-top: 10px;
1107+ margin-bottom: 10px;
1108+ font-size:10px;
1109+ }
1110+
1111+ .account_line {
1112+ font-weight: bold;
1113+ font-size: 15px;
1114+ background-color:#F0F0F0;
1115+ }
1116+
1117+ .account_line .act_as_cell {
1118+ height: 30px;
1119+ vertical-align: bottom;
1120+ }
1121+
1122+ </style>
1123 </head>
1124 <body class = "data">
1125- %for partner in objects :
1126- <%
1127- part_by_curr = get_partners_by_curr(cr, uid, partner)
1128- %>
1129- <%setLang(user.context_lang)%>
1130- <%
1131- total_balance = 0.0
1132- %>
1133- <div style="font-size: 20px; font-weight: bold; text-align: center;"> ${company.partner_id.name | entity} - ${company.currency_id.name | entity}</div>
1134- <div style="font-size: 25px; font-weight: bold; text-align: center;"> Estado de Cuenta</div>
1135- <div style="font-size: 20px; font-weight: bold; text-align: center;"> ${partner.name}</div>
1136- </br></br>
1137- %for currency in part_by_curr:
1138- <%
1139- total_debit_curr = 0.0
1140- total_credit_curr = 0.0
1141- total_balance_curr = 0.0
1142- balance_curr = 0.0
1143- %>
1144- %if currency[0] != None:
1145- <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 1080px;">${_('Partner Balance in ')} ${currency[0]}</div>
1146- %else:
1147- <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 1080px;">${_('Partner Balance in ')} ${company.currency_id.name}</div>
1148- %endif
1149- <div class="act_as_table list_table">
1150- <div class="act_as_thead">
1151- <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
1152- <div class="act_as_cell first_column" style="vertical-align: middle">${_('Date')}</div>
1153- <div class="act_as_cell" style="width: 250px; vertical-align: middle">${_('Detail')}</div>
1154- <div class="act_as_cell">${_('Due Date')}</div>
1155- <div class="act_as_cell amount">${_('Credit')}</div>
1156- <div class="act_as_cell amount">${_('Debit')}</div>
1157- </div>
1158- </div>
1159-
1160- <div class="act_as_tbody">
1161- %for move_line in sorted(currency[1], key=lambda currency: currency.date):
1162- <div class="act_as_row lines">
1163- ## Fecha
1164- <div class="act_as_cell first_column">${move_line.date or '0'}</div>
1165- ## Detalle
1166- <div class="act_as_cell">${move_line.name or '-'}</div>
1167- ## Fecha de Vencimiento
1168- <div class="act_as_cell">${move_line.date_maturity or '-'}</div>
1169- %if currency[0] != None:
1170- %if move_line.amount_currency > 0:
1171- ## Cobros
1172- <div class="act_as_cell amount">${formatLang(move_line.amount_currency) or '0'}</div>
1173- ## Pagos
1174- <div class="act_as_cell amount">${'0.00'}</div>
1175- <%total_debit_curr += move_line.amount_currency%>
1176- %else:
1177- ## Cobros
1178- <div class="act_as_cell amount">${'0.00'}</div>
1179- ## Pagos
1180- <div class="act_as_cell amount">${formatLang(move_line.amount_currency*-1) or '0'}</div>
1181- <%total_credit_curr += move_line.amount_currency*-1%>
1182- %endif
1183- %else:
1184- ## Pagos
1185- <div class="act_as_cell amount">${formatLang(move_line.debit) or '0'}</div>
1186- ## Cobros
1187- <div class="act_as_cell amount">${formatLang(move_line.credit) or '0'}</div>
1188- <%
1189- ## Totales por Moneda
1190- total_debit_curr += move_line.debit
1191- total_credit_curr += move_line.credit
1192- %>
1193- %endif
1194- </div>
1195- %endfor
1196- </div>
1197- <%
1198- ## Totales
1199- total_balance_curr = total_debit_curr - total_credit_curr
1200- if currency[0] != None:
1201- balance_curr = currency_convert(cr, uid, move_line.currency_id.id, company.currency_id.id, total_balance_curr)
1202- else:
1203- balance_curr = total_balance_curr
1204- endif
1205-
1206- total_balance += balance_curr
1207- %>
1208- <div class="act_as_tfoot">
1209- <div class="act_as_row labels" style="font-weight: bold; font-size: 11px;" >
1210- <div class="act_as_cell first_column" style="vertical-align: middle">${_('Balance')}</div>
1211- %if currency[0] != None:
1212- <div class="act_as_cell" style="width: 250px; vertical-align: middle">${move_line.currency_id.symbol} ${formatLang(total_balance_curr)}</div>
1213- <div class="act_as_cell">${_('')}</div>
1214- <div class="act_as_cell amount">${move_line.currency_id.symbol} ${formatLang(total_debit_curr)}</div>
1215- <div class="act_as_cell amount">${move_line.currency_id.symbol} ${formatLang(total_credit_curr)}</div>
1216- %else:
1217- <div class="act_as_cell" style="width: 250px; vertical-align: middle">${company.currency_id.symbol} ${formatLang(total_balance_curr)}</div>
1218- <div class="act_as_cell">${_('')}</div>
1219- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_debit_curr)}</div>
1220- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_credit_curr)}</div>
1221- %endif
1222-
1223- </div>
1224- </div>
1225- </div>
1226-
1227- %endfor
1228-
1229- %if part_by_curr != []:
1230- <div class="act_as_table list_table " style="margin-top: 20px;">
1231- <div class="act_as_tfoot">
1232- <div class="act_as_row labels" style="font-weight: bold; font-size: 11px;">
1233- <div class="act_as_cell first_column" style="width: 205px; font-size: 12px; text-align: left">${_('TOTAL BALANCE in ')} ${company.currency_id.name}</div>
1234- <div class="act_as_cell" style="text-align: left">${company.currency_id.symbol} ${formatLang(total_balance)}</div>
1235- </div>
1236- </div>
1237- </div>
1238- <div>
1239+ %for partner in objects :
1240+ <%
1241+ account_types = ['payable','receivable']
1242+
1243+ setLang(user.context_lang)
1244+ %>
1245+ </br></br>
1246+ <div style="font-size: 20px; font-weight: bold; text-align: center;"> ${company.partner_id.name | entity} - ${company.currency_id.name | entity}</div>
1247+ <div style="font-size: 25px; font-weight: bold; text-align: center;"> Estado de Cuenta</div>
1248+ <div style="font-size: 20px; font-weight: bold; text-align: center;"> ${partner.name}</div>
1249+ %for account_type in account_types :
1250 <%
1251- today = get_time_today()
1252+ part_by_curr = get_partners_by_curr(cr, uid, partner, account_type)
1253+ total_balance = 0.0
1254+ %>
1255+ </br></br>
1256+ %if account_type == 'payable':
1257+ <div style="font-size: 20px; font-weight: bold;"> ${_('PAYABLE')}</div>
1258+ %elif account_type == 'receivable':
1259+ <div style="font-size: 20px; font-weight: bold;"> ${_('RECEIVABLE')}</div>
1260+ %endif
1261+ %for currency in part_by_curr:
1262+ <%
1263+ total_debit_curr = 0.0
1264+ total_credit_curr = 0.0
1265+ total_balance_curr = 0.0
1266+ balance_curr = 0.0
1267+ %>
1268+ %if currency[0] != None:
1269+ <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 1080px;">${_('Partner Balance in ')} ${currency[0]}</div>
1270+ %else:
1271+ <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 1080px;">${_('Partner Balance in ')} ${company.currency_id.name}</div>
1272+ %endif
1273+ <div class="act_as_table list_table">
1274+ <div class="act_as_thead">
1275+ <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
1276+ <div class="act_as_cell first_column" style="vertical-align: middle">${_('Date')}</div>
1277+ <div class="act_as_cell">${_('Date maturity')}</div>
1278+ <div class="act_as_cell">${_('Number')}</div>
1279+ <div class="act_as_cell" style="width: 250px; vertical-align: middle">${_('Detail')}</div>
1280+ <div class="act_as_cell amount">${_('Credit')}</div>
1281+ <div class="act_as_cell amount">${_('Debit')}</div>
1282+ </div>
1283+ </div>
1284+
1285+ <div class="act_as_tbody">
1286+ %for move_line in sorted(currency[1], key=lambda currency: currency.date):
1287+ <div class="act_as_row lines">
1288+ ## Date
1289+ <div class="act_as_cell first_column">${move_line.date or '0'}</div>
1290+ ## Due date
1291+ <div class="act_as_cell">${move_line.date_maturity or '-'}</div>
1292+ ## Name Move
1293+ <div class="act_as_cell">${move_line.move_id.name or '-'}</div>
1294+ ## Detail
1295+ <div class="act_as_cell" style="width: 250px; vertical-align: middle">${move_line.name or '-'}</div>
1296+ %if currency[0] != None:
1297+ %if move_line.amount_currency > 0:
1298+ ## Receivables
1299+ <div class="act_as_cell amount">${formatLang(move_line.amount_currency) or '0'}</div>
1300+ ## Payments
1301+ <div class="act_as_cell amount">${'0.00'}</div>
1302+ <%total_debit_curr += move_line.amount_currency%>
1303+ %else:
1304+ ## Receivables
1305+ <div class="act_as_cell amount">${'0.00'}</div>
1306+ ## Payments
1307+ <div class="act_as_cell amount">${formatLang(move_line.amount_currency*-1) or '0'}</div>
1308+ <%total_credit_curr += move_line.amount_currency*-1%>
1309+ %endif
1310+ %else:
1311+ ## Payments
1312+ <div class="act_as_cell amount">${formatLang(move_line.debit) or '0'}</div>
1313+ ## Receivables
1314+ <div class="act_as_cell amount">${formatLang(move_line.credit) or '0'}</div>
1315+ <%
1316+ ## Totales por Moneda
1317+ total_debit_curr += move_line.debit
1318+ total_credit_curr += move_line.credit
1319+ %>
1320+ %endif
1321+ </div>
1322+ %endfor
1323+ </div>
1324+ <%
1325+ ## Totales
1326+ total_balance_curr = total_debit_curr - total_credit_curr
1327 if currency[0] != None:
1328- conversion_rate = get_conversion_rate(cr, uid, move_line.currency_id, company.currency_id)
1329+ balance_curr = currency_convert(cr, uid, move_line.currency_id.id, company.currency_id.id, total_balance_curr)
1330 else:
1331- from_currency = get_currency(cr, uid, 2)
1332- conversion_rate = get_conversion_rate(cr, uid, from_currency, company.currency_id)
1333+ balance_curr = total_balance_curr
1334 endif
1335- %>
1336- <div style="font-family: Helvetica, Arial; font-size: 13px; font-weight: bold; margin-top: 20px;"> ${_('Nota: ')} </div>
1337- <div style="font-family: Helvetica, Arial; font-size: 12px;"> ${_('In the event of any foreign currencies the Total Balance was calculated according to the exchange rate of the day ')} ${formatLang( today, date=True)} (${company.currency_id.symbol} ${conversion_rate})</div>
1338- </div>
1339- %else:
1340- <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('There is no open invoices')}</div>
1341- %endif
1342+
1343+ total_balance += balance_curr
1344+ %>
1345+ <div class="act_as_tfoot">
1346+ <div class="act_as_row labels" style="font-weight: bold; font-size: 11px;" >
1347+ <div class="act_as_cell first_column" style="vertical-align: middle">${_('Balance')}</div>
1348+ %if currency[0] != None:
1349+ <div class="act_as_cell" style="width: 250px; vertical-align: middle">${move_line.currency_id.symbol} ${formatLang(total_balance_curr)}</div>
1350+ <div class="act_as_cell">${_('')}</div>
1351+ <div class="act_as_cell">${_('')}</div>
1352+ <div class="act_as_cell amount">${move_line.currency_id.symbol} ${formatLang(total_debit_curr)}</div>
1353+ <div class="act_as_cell amount">${move_line.currency_id.symbol} ${formatLang(total_credit_curr)}</div>
1354+ %else:
1355+ <div class="act_as_cell" style="width: 250px; vertical-align: middle">${company.currency_id.symbol} ${formatLang(total_balance_curr)}</div>
1356+ <div class="act_as_cell">${_('')}</div>
1357+ <div class="act_as_cell">${_('')}</div>
1358+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_debit_curr)}</div>
1359+ <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_credit_curr)}</div>
1360+ %endif
1361+
1362+ </div>
1363+ </div>
1364+ </div>
1365+
1366+ %endfor
1367+
1368+ %if part_by_curr != []:
1369+ <div class="act_as_table list_table " style="margin-top: 20px;">
1370+ <div class="act_as_tfoot">
1371+ <div class="act_as_row labels" style="font-weight: bold; font-size: 11px;">
1372+ <div class="act_as_cell first_column" style="width: 205px; font-size: 12px; text-align: left">${_('TOTAL BALANCE in ')} ${company.currency_id.name}</div>
1373+ <div class="act_as_cell" style="text-align: left">${company.currency_id.symbol} ${formatLang(total_balance)}</div>
1374+ </div>
1375+ </div>
1376+ </div>
1377+ <div>
1378+ <%
1379+ today = get_time_today()
1380+ if currency[0] != None:
1381+ conversion_rate = get_conversion_rate(cr, uid, move_line.currency_id, company.currency_id)
1382+ else:
1383+ from_currency = get_currency(cr, uid, 2)
1384+ conversion_rate = get_conversion_rate(cr, uid, from_currency, company.currency_id)
1385+ endif
1386+ %>
1387+ </div>
1388+ %else:
1389+ <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('There is no open invoices')}</div>
1390+ %endif
1391
1392- <p style="page-break-after:always"></p>
1393-
1394- %endfor
1395-
1396+ %endfor
1397
1398+ </br></br>
1399+ <div style="font-family: Helvetica, Arial; font-size: 13px; font-weight: bold; margin-top: 20px;"> ${_('Note: ')} </div>
1400+ <div style="font-family: Helvetica, Arial; font-size: 12px;"> ${_('In the event of any foreign currencies the Total Balance was calculated according to the exchange rate of the day ')} ${formatLang( today, date=True)} (${company.currency_id.symbol} ${conversion_rate})</div>
1401+ <p style="page-break-after:always"></p>
1402+
1403+ %endfor
1404+
1405 </body>
1406 </html>
1407
1408=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako'
1409--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako 2012-08-07 20:21:11 +0000
1410+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako 1970-01-01 00:00:00 +0000
1411@@ -1,480 +0,0 @@
1412-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1413-<html xmlns="http://www.w3.org/1999/xhtml">
1414-<head>
1415- <style type="text/css">
1416- .overflow_ellipsis {
1417- text-overflow: ellipsis;
1418- overflow: hidden;
1419- white-space: nowrap;
1420- }
1421- ${css}
1422- </style>
1423-</head>
1424-<body>
1425- <%!
1426- def amount(text):
1427- return text.replace('-', '&#8209;') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
1428- %>
1429- <%
1430- setLang(user.context_lang)
1431-
1432- initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
1433- filter_type = ''
1434- filter_data = []
1435- %>
1436-
1437- <div class="act_as_table data_table">
1438- <div class="act_as_row labels">
1439- <div class="act_as_cell">${_('Chart of Account')}</div>
1440- <div class="act_as_cell">${_('Fiscal Year')}</div>
1441- <div class="act_as_cell">
1442- %if filter_form(data) == 'filter_date':
1443- ${_('Dates Filter')}
1444- %else:
1445- ${_('Periods Filter')}
1446- %endif
1447- </div>
1448- <div class="act_as_cell">${_('Accounts Filter')}</div>
1449- <div class="act_as_cell">${_('Target Moves')}</div>
1450- <div class="act_as_cell">${_('Initial Balance')}</div>
1451- </div>
1452- <div class="act_as_row">
1453- <div class="act_as_cell">${ chart_account.name }</div>
1454- <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
1455- <div class="act_as_cell">
1456- ${_('From:')}
1457- %if filter_form(data) == 'filter_date':
1458- ${formatLang(start_date, date=True) if start_date else u'' }
1459- <%
1460- filter_data.append(start_date)
1461- filter_type = 'filter_date'
1462- %>
1463- %else:
1464- ${start_period.name if start_period else u''}
1465- <%
1466- filter_data.append(start_period)
1467- filter_type = 'filter_period'
1468- %>
1469- %endif
1470- ${_('To:')}
1471- %if filter_form(data) == 'filter_date':
1472- ${ formatLang(stop_date, date=True) if stop_date else u'' }
1473- <% filter_data.append(stop_date) %>
1474- %else:
1475- ${stop_period.name if stop_period else u'' }
1476- <% filter_data.append(stop_period) %>
1477- %endif
1478- </div>
1479- <div class="act_as_cell">
1480- %if partner_ids:
1481- ${_('Custom Filter')}
1482- %else:
1483- ${ display_partner_account(data) }
1484- %endif
1485- </div>
1486- <div class="act_as_cell">${ display_target_move(data) }</div>
1487- <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
1488- </div>
1489- </div>
1490- <%
1491- account_by_curr = get_accounts_by_curr(cr, uid, objects)
1492- %>
1493- %for currency in account_by_curr:
1494- %if currency[0] != 'CRC':
1495- <%currency_symbol = get_currency_symbol(cr, uid, currency[0]) %>
1496- %endif
1497- <%
1498- currency_total_invoice = 0.0
1499- currency_total_payment = 0.0
1500- currency_total_debit = 0.0
1501- currency_total_credit = 0.0
1502- currency_total_manual_move = 0.0
1503- currency_balance_accumulated = 0.0
1504- %>
1505-
1506- <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 100%;">${_('Accounts in ')} ${currency[0]}</div>
1507-
1508- %for account in currency[1]:
1509- %if account.ledger_lines or account.init_balance:
1510- <%
1511- if not account.partners_order:
1512- continue
1513- account_total_invoice = 0.0
1514- account_total_payment = 0.0
1515- account_total_debit = 0.0
1516- account_total_credit = 0.0
1517- account_total_manual_move = 0.0
1518- account_balance_accumulated = 0.0
1519- account_balance_accumulated_curr = 0.0
1520- %>
1521-
1522- <div class="account_title bg" style="width: 100%; margin-top: 15px; font-size: 12px;">${account.code} - ${account.name} - ${account.report_currency_id.name or account.company_id.currency_id.name}</div>
1523-
1524- %for partner_name, p_id, p_ref, p_name in account.partners_order:
1525- <%
1526- total_invoice = 0.0
1527- total_payment = 0.0
1528- total_debit = 0.0
1529- total_credit = 0.0
1530- total_manual_move = 0.0
1531- accumulated_balance = 0.0
1532- accumulated_balance_curr = 0.0
1533- total_accumulated_balance = 0.0
1534-
1535- partner_accumulated_balance = 0.0
1536- partner_accumulated_balance_curr = 0.0
1537-
1538- partner_accumulated_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
1539- init_balance = 0.0
1540- init_balance = get_initial_balance(cr, uid, p_id, account, filter_type, filter_data, fiscal_year, currency[0])
1541- accumulated_balance = init_balance
1542- %>
1543- <div class="act_as_table list_table" style="margin-top: 5px;">
1544- <div class="act_as_caption account_title">
1545- ${ get_partner_name(cr, uid, partner_name, p_id, p_ref, p_name) or _('No Partner')}
1546- </div>
1547- <div class="act_as_thead">
1548- <div class="act_as_row labels">
1549- ## date
1550- <div class="act_as_cell first_column" style="width: 50px;">${_('Date')}</div>
1551- ## period
1552- <div class="act_as_cell" style="width: 70px;">${_('Period')}</div>
1553- ## move
1554- <div class="act_as_cell" style="width: 70px;">${_('Entry')}</div>
1555- ## journal
1556- <div class="act_as_cell" style="width: 70px;">${_('Journal')}</div>
1557- ## partner
1558- <!--div class="act_as_cell" style="width: 60px;">${_('Partner')}</div-->
1559- ## label
1560- <div class="act_as_cell" style="width: 270px;">${_('Label')}</div>
1561- ## reconcile
1562- <div class="act_as_cell" style="width: 70px;">${_('Rec.')}</div>
1563- ## Invoices
1564- <div class="act_as_cell amount" style="width: 100px;">${_('Invoice')}</div>
1565- ## credit
1566- <div class="act_as_cell amount" style="width: 100px;">${_('Payments')}</div>
1567- ## debit
1568- <div class="act_as_cell amount" style="width: 100px;">${_('Credit')}</div>
1569- ## Payments
1570- <div class="act_as_cell amount" style="width: 100px;">${_('Debit')}</div>
1571- ## Manual Move
1572- <div class="act_as_cell amount" style="width: 115px;">${_('Manual Move')}</div>
1573- ## balance cumulated
1574- <div class="act_as_cell amount" style="width: 115px;">${_('Cumul. Bal.')}</div>
1575- %if amount_currency(data):
1576- ## currency balance
1577- <div class="act_as_cell amount sep_left" style="width: 80px;">${_('Curr. Balance')}</div>
1578- ## curency code
1579- <div class="act_as_cell amount" style="width: 30px; text-align: right;">${_('Curr.')}</div>
1580- %endif
1581- </div>
1582- </div>
1583- <div class="act_as_tbody">
1584- %if initial_balance_mode and (total_debit or total_credit):
1585- <%
1586- #partner_accumulated_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
1587- #partner_accumulated_balance_curr = account.init_balance.get(p_id, {}).get('init_balance_currency') or 0.0
1588- #balance_forward_currency = account.init_balance.get(p_id, {}).get('currency_name') or ''
1589-
1590- #accumulated_balance += partner_accumulated_balance
1591- #accumulated_balance_curr += partner_accumulated_balance_curr
1592- %>
1593- %endif
1594- <div class="act_as_cell first_column" style="width: 50px;">${_('')}</div>
1595- ## period
1596- <div class="act_as_cell" style="width: 70px;">${_('')}</div>
1597- ## move
1598- <div class="act_as_cell" style="width: 70px;">${_('')}</div>
1599- ## journal
1600- <div class="act_as_cell" style="width: 70px;">${_('')}</div>
1601- <div class="act_as_cell" style="width: 270px;">${_('Initial Balance')}</div>
1602- <div class="act_as_cell" style="width: 70px;">${_('')}</div>
1603- <div class="act_as_cell amount" style="width: 100px;">${_('')}</div>
1604- <div class="act_as_cell amount" style="width: 100px;">${_('')}</div>
1605- <div class="act_as_cell amount" style="width: 100px;">${_('')}</div>
1606- <div class="act_as_cell amount" style="width: 100px;">${_('')}</div>
1607- <div class="act_as_cell amount" style="width: 115px;">${_('')}</div>
1608- <div class="act_as_cell amount" style="width: 115px;">${formatLang(init_balance)}</div>
1609-
1610- <%total_accumulated_balance = init_balance %>
1611-
1612- %for line in account.ledger_lines.get(p_id, []):
1613- <%
1614- label_elements = [line.get('lname') or '']
1615- if line.get('invoice_number'):
1616- label_elements.append("(%s)" % (line['invoice_number'],))
1617- label = ' '.join(label_elements)
1618-
1619- invoice_amount = 0.0
1620- payment_amount = 0.0
1621- credit_amount = 0.0
1622- debit_amount = 0.0
1623- MM_amount = 0.0
1624-
1625- amount = get_amount(cr, uid, line, currency[0])
1626- %>
1627- <div class="act_as_row lines">
1628- ## date
1629- <div class="act_as_cell first_column">${formatLang(line.get('ldate') or '', date=True)}</div>
1630- ## period
1631- <div class="act_as_cell">${line.get('period_code') or ''}</div>
1632- ## move
1633- <div class="act_as_cell">${line.get('move_name') or ''}</div>
1634- ## journal
1635- <div class="act_as_cell">${line.get('jcode') or ''}</div>
1636- ## partner
1637- <!--div class="act_as_cell overflow_ellipsis">${line.get('partner_name') or ''}</div-->
1638- ## label
1639- <div class="act_as_cell">${label}</div>
1640- ## reconcile
1641- <div class="act_as_cell">${line.get('rec_name') or ''}</div>
1642- ## Invoice
1643- <div class="act_as_cell amount">
1644- %if amount[0] == 'invoice':
1645- <%
1646- invoice_amount = amount[1]
1647- total_invoice += invoice_amount
1648- %>
1649- ${ formatLang(invoice_amount or 0.0) }
1650- %else:
1651- ${'0.0'}
1652- %endif
1653- %if amount[2] != None and amount[0] == 'invoice':
1654- ${' ('}${ formatLang(amount[2]) }${')'}
1655- %endif
1656- </div>
1657- ## Payment
1658- <div class="act_as_cell amount">
1659- %if amount[0] == 'payment':
1660- <%
1661- payment_amount = amount[1]
1662- total_payment += payment_amount
1663- %>
1664- ${ formatLang(payment_amount or 0.0) }
1665- %else:
1666- ${'0.0'}
1667- %endif
1668- %if amount[2] != None and amount[0] == 'payment':
1669- ${' ('}${ formatLang(amount[2]) }${')'}
1670- %endif
1671- </div>
1672- ## Credit
1673- <div class="act_as_cell amount">
1674- %if amount[0] == 'credit':
1675- <%
1676- credit_amount = amount[1]
1677- total_credit += credit_amount
1678- %>
1679- ${ formatLang(credit_amount or 0.0) }
1680- %else:
1681- ${'0.0'}
1682- %endif
1683- %if amount[2] != None and amount[0] == 'credit':
1684- ${' ('}${ formatLang(amount[2]) }${')'}
1685- %endif
1686- </div>
1687- ## Debit
1688- <div class="act_as_cell amount">
1689- %if amount[0] == 'debit':
1690- <%
1691- debit_amount = amount[1]
1692- total_debit += debit_amount
1693- %>
1694- ${ formatLang(debit_amount or 0.0) }
1695- %else:
1696- ${'0.0'}
1697- %endif
1698- %if amount[2] != None and amount[0] == 'debit':
1699- ${' ('}${ formatLang(amount[2]) }${')'}
1700- %endif
1701- </div>
1702- ## Manual move
1703- <div class="act_as_cell amount">
1704- %if amount[0] == 'manual':
1705- <%
1706- MM_amount = amount[1]
1707- total_manual_move += MM_amount
1708- %>
1709- ${ formatLang(MM_amount or 0.0) }
1710- %else:
1711- ${'0.0'}
1712- %endif
1713- %if amount[2] != None and amount[0] == 'manual':
1714- ${' ('}${ formatLang(amount[2]) }${')'}
1715- %endif
1716- </div>
1717- ## balance cumulated
1718- <%
1719- accumulated_balance = (invoice_amount+payment_amount+credit_amount+debit_amount+MM_amount) or 0.0
1720- total_accumulated_balance += accumulated_balance
1721- %>
1722- <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(total_accumulated_balance) }</div>
1723- %if amount_currency(data):
1724- ## currency balance
1725- <div class="act_as_cell sep_left amount">${formatLang(line.get('amount_currency') or 0.0) }</div>
1726- ## curency code
1727- <div class="act_as_cell" style="text-align: right; ">${line.get('currency_code') or ''}</div>
1728- %endif
1729- </div>
1730- %endfor
1731- <div class="act_as_row lines labels">
1732- ## date
1733- <div class="act_as_cell first_column"></div>
1734- ## period
1735- <div class="act_as_cell"></div>
1736- ## move
1737- <div class="act_as_cell"></div>
1738- ## journal
1739- <div class="act_as_cell"></div>
1740- ## partner
1741- <div class="act_as_cell"></div>
1742- ## label
1743- <div class="act_as_cell">${_('Saldo')}</div>
1744- ## reconcile
1745- <!--div class="act_as_cell"></div-->
1746- %if currency[0] != 'CRC':
1747- ## invoice
1748- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_invoice) }</div>
1749- ## payment
1750- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_payment) }</div>
1751- ## credit
1752- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_credit) }</div>
1753- ## debit
1754- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_debit) }</div>
1755- ## manual move
1756- <div class="act_as_cell amount">${currency_symbol} ${formatLang(total_manual_move) }</div>
1757- ## balance cumulated
1758- <div class="act_as_cell amount" style="padding-right: 1px;">${currency_symbol} ${formatLang(total_accumulated_balance) }</div>
1759- %else:
1760- ## invoice
1761- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_invoice) }</div>
1762- ## payment
1763- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_payment) }</div>
1764- ## credit
1765- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_credit) }</div>
1766- ## debit
1767- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_debit) }</div>
1768- ## manual move
1769- <div class="act_as_cell amount">${company.currency_id.symbol} ${formatLang(total_manual_move) }</div>
1770- ## balance cumulated
1771- <div class="act_as_cell amount" style="padding-right: 1px;">${company.currency_id.symbol} ${formatLang(total_accumulated_balance) }</div>
1772- %endif
1773- %if amount_currency(data):
1774- ## currency balance
1775- %if account.report_currency_id:
1776- <!--div class="act_as_cell amount sep_left">${formatLang(accumulated_balance_curr) | amount }</div-->
1777- %else:
1778- <div class="act_as_cell sep_left amount">${ u'-' }</div>
1779- %endif
1780- ## currency code
1781- <div class="act_as_cell" style="text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
1782- %endif
1783- </div>
1784- </div>
1785- </div>
1786- <%
1787- account_total_invoice += total_invoice
1788- account_total_payment += total_payment
1789- account_total_debit += total_debit
1790- account_total_credit += total_credit
1791- account_total_manual_move += total_manual_move
1792- account_balance_accumulated += total_accumulated_balance
1793- account_balance_accumulated_curr += account_balance_accumulated
1794-
1795- currency_total_invoice += total_invoice
1796- currency_total_payment += total_payment
1797- currency_total_debit += total_debit
1798- currency_total_credit += total_credit
1799- currency_total_manual_move += total_manual_move
1800- currency_balance_accumulated += total_accumulated_balance
1801- %>
1802- %endfor
1803-
1804- <div class="act_as_table list_table" style="margin-top:5px;">
1805- <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
1806- <div class="act_as_cell first_column" style="width: 300px;">${account.code} - ${account.name}</div>
1807- ## label
1808- <div class="act_as_cell" style="width: 302px;">${_("Saldo")}</div>
1809- %if currency[0] != 'CRC':
1810- ## invoice
1811- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_invoice) }</div>
1812- ## payment
1813- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_payment) }</div>
1814- ## credit
1815- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_credit) }</div>
1816- ## debit
1817- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(account_total_debit) }</div>
1818- ## manual move
1819- <div class="act_as_cell amount" style="width: 115px;">${currency_symbol} ${ formatLang(account_total_manual_move) }</div>
1820- ## balance cumulated
1821- <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${currency_symbol} ${ formatLang(account_balance_accumulated) }</div>
1822- %else:
1823- ## invoice
1824- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_invoice) }</div>
1825- ## payment
1826- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_payment) }</div>
1827- ## credit
1828- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_credit) }</div>
1829- ## debit
1830- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(account_total_debit) }</div>
1831- ## manual move
1832- <div class="act_as_cell amount" style="width: 115px;">${company.currency_id.symbol} ${ formatLang(account_total_manual_move) }</div>
1833- ## balance cumulated
1834- <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${company.currency_id.symbol} ${ formatLang(account_balance_accumulated) }</div>
1835- %endif
1836- %if amount_currency(data):
1837- ## currency balance
1838- %if account.report_currency_id:
1839- <!--div class="act_as_cell amount sep_left" style="width: 80px;">${ formatLang(account_balance_accumulated_curr) | amount }</div-->
1840- %else:
1841- <div class="act_as_cell amount sep_left" style="width: 80px;">${ u'-' }</div>
1842- %endif
1843- ## curency code
1844- <div class="act_as_cell amount" style="width: 30px; text-align: right; padding-right: 1px;">${ account.report_currency_id.name if account.report_currency_id else u'' }</div>
1845- %endif
1846- </div>
1847- </div>
1848- </div>
1849- %endif
1850- %endfor
1851- <div class="act_as_table list_table" style="margin-top:5px;">
1852- <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
1853- %if currency[0] != 'CRC':
1854- <div class="act_as_cell first_column" style="width: 300px;">${_('Total for Accounts in ')} ${currency[0]}</div>
1855- %else:
1856- <div class="act_as_cell first_column" style="width: 300px;">${_('Total for Accounts in ')} ${company.currency_id.name}</div>
1857- %endif
1858- ## label
1859- <div class="act_as_cell" style="width: 302px;"></div>
1860- %if currency[0] != 'CRC':
1861- ## invoice
1862- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(currency_total_invoice) }</div>
1863- ## payment
1864- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(currency_total_payment) }</div>
1865- ## credit
1866- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(currency_total_credit) }</div>
1867- ## debit
1868- <div class="act_as_cell amount" style="width: 100px;">${currency_symbol} ${ formatLang(currency_total_debit) }</div>
1869- ## manual move
1870- <div class="act_as_cell amount" style="width: 115px;">${currency_symbol} ${ formatLang(currency_total_manual_move) }</div>
1871- ## balance cumulated
1872- <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${currency_symbol} ${ formatLang(currency_balance_accumulated) }</div>
1873- %else:
1874- ## invoice
1875- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(currency_total_invoice) }</div>
1876- ## payment
1877- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(currency_total_payment) }</div>
1878- ## credit
1879- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(currency_total_credit) }</div>
1880- ## debit
1881- <div class="act_as_cell amount" style="width: 100px;">${company.currency_id.symbol} ${ formatLang(currency_total_debit) }</div>
1882- ## manual move
1883- <div class="act_as_cell amount" style="width: 115px;">${company.currency_id.symbol} ${ formatLang(currency_total_manual_move) }</div>
1884- ## balance cumulated
1885- <div class="act_as_cell amount" style="width: 115px; padding-right: 1px;">${company.currency_id.symbol} ${ formatLang(currency_balance_accumulated) }</div>
1886- %endif
1887- </div>
1888- </div>
1889- %endfor
1890-</body>
1891-</html>
1892
1893=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_open_invoices.py'
1894--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_open_invoices.py 2012-06-21 23:21:28 +0000
1895+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_open_invoices.py 1970-01-01 00:00:00 +0000
1896@@ -1,80 +0,0 @@
1897-# -*- coding: utf-8 -*-
1898-##############################################################################
1899-#
1900-# OpenERP, Open Source Management Solution
1901-# Addons modules by CLEARCORP S.A.
1902-# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
1903-#
1904-# This program is free software: you can redistribute it and/or modify
1905-# it under the terms of the GNU Affero General Public License as
1906-# published by the Free Software Foundation, either version 3 of the
1907-# License, or (at your option) any later version.
1908-#
1909-# This program is distributed in the hope that it will be useful,
1910-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1911-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1912-# GNU Affero General Public License for more details.
1913-#
1914-# You should have received a copy of the GNU Affero General Public License
1915-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1916-#
1917-##############################################################################
1918-
1919-import pooler
1920-
1921-from collections import defaultdict
1922-from report import report_sxw
1923-from datetime import datetime
1924-from itertools import groupby
1925-from operator import itemgetter
1926-from mako.template import Template
1927-
1928-from tools.translate import _
1929-
1930-from openerp.osv import osv
1931-from openerp.addons.report_webkit import report_helper
1932-import addons
1933-
1934-from l10n_cr_partners_ledger import l10n_cr_PartnersLedgerWebkit
1935-from openerp.addons.account_financial_report_webkit.report.webkit_parser_header_fix import HeaderFooterTextWebKitParser
1936-
1937-class l10n_cr_PartnersOpenInvoicesWebkit(l10n_cr_PartnersLedgerWebkit):
1938-
1939- def __init__(self, cursor, uid, name, context):
1940- super(l10n_cr_PartnersOpenInvoicesWebkit, self).__init__(cursor, uid, name, context=context)
1941- self.pool = pooler.get_pool(self.cr.dbname)
1942- self.cursor = self.cr
1943-
1944- company = self.pool.get('res.users').browse(self.cr, uid, uid, context=context).company_id
1945- header_report_name = ' - '.join((_('OPEN INVOICES REPORT'), company.name, company.currency_id.name))
1946-
1947- footer_date_time = self.formatLang(str(datetime.today()), date_time=True)
1948-
1949- self.localcontext.update({
1950- 'is_open': self.is_open,
1951- 'report_name':_('Open Invoices Report'),
1952- 'additional_args': [
1953- ('--header-font-name', 'Helvetica'),
1954- ('--footer-font-name', 'Helvetica'),
1955- ('--header-font-size', '10'),
1956- ('--footer-font-size', '6'),
1957- ('--header-left', header_report_name),
1958- ('--header-spacing', '2'),
1959- ('--footer-left', footer_date_time),
1960- ('--footer-right', ' '.join((_('Page'), '[page]', _('of'), '[topage]'))),
1961- ('--footer-line',),
1962- ],
1963- })
1964-
1965- def is_open(self,cr, uid, account_move_line):
1966- move_line_obj = self.pool.get('account.move.line').browse(cr,uid,account_move_line['id'])
1967-
1968- if move_line_obj.reconcile_id.id == False:
1969- return True
1970- else:
1971- return False
1972-
1973-HeaderFooterTextWebKitParser('report.account_financial_report_webkit.account.account_report_open_invoices_webkit',
1974- 'account.account',
1975- 'addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako',
1976- parser=l10n_cr_PartnersOpenInvoicesWebkit)
1977
1978=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partner_balance.py'
1979--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partner_balance.py 2012-06-13 20:01:31 +0000
1980+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partner_balance.py 2013-08-20 07:28:14 +0000
1981@@ -41,13 +41,13 @@
1982 })
1983
1984
1985- def get_partners_by_curr(self, cr, uid, partner):
1986+ def get_partners_by_curr(self, cr, uid, partner, account_type):
1987 currency_names_list = []
1988 partners_curr_list = []
1989 partners_by_curr = []
1990
1991 obj_move = self.pool.get('account.move.line')
1992- obj_search = obj_move.search(cr, uid, [('partner_id','=',partner.id),'&',('reconcile_id','=',False),'|',('account_id.type','=','payable'),('account_id.type','=','receivable')])
1993+ obj_search = obj_move.search(cr, uid, [('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','=', account_type)])
1994 move_lines = obj_move.browse(cr, uid, obj_search)
1995
1996 for move_line in move_lines:
1997
1998=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py'
1999--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py 2012-07-20 16:00:33 +0000
2000+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/l10n_cr_partners_ledger.py 1970-01-01 00:00:00 +0000
2001@@ -1,183 +0,0 @@
2002-# -*- coding: utf-8 -*-
2003-##############################################################################
2004-#
2005-# OpenERP, Open Source Management Solution
2006-# Addons modules by CLEARCORP S.A.
2007-# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
2008-#
2009-# This program is free software: you can redistribute it and/or modify
2010-# it under the terms of the GNU Affero General Public License as
2011-# published by the Free Software Foundation, either version 3 of the
2012-# License, or (at your option) any later version.
2013-#
2014-# This program is distributed in the hope that it will be useful,
2015-# but WITHOUT ANY WARRANTY; without even the implied warranty of
2016-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2017-# GNU Affero General Public License for more details.
2018-#
2019-# You should have received a copy of the GNU Affero General Public License
2020-# along with this program. If not, see <http://www.gnu.org/licenses/>.
2021-#
2022-##############################################################################
2023-
2024-import pooler
2025-
2026-from collections import defaultdict
2027-from report import report_sxw
2028-from osv import osv
2029-from tools.translate import _
2030-from datetime import datetime
2031-
2032-from openerp.addons.account_financial_report_webkit.report.partners_ledger import PartnersLedgerWebkit
2033-from openerp.addons.account_financial_report_webkit.report.webkit_parser_header_fix import HeaderFooterTextWebKitParser
2034-
2035-class l10n_cr_PartnersLedgerWebkit(PartnersLedgerWebkit):
2036-
2037- def __init__(self, cursor, uid, name, context):
2038- super(l10n_cr_PartnersLedgerWebkit, self).__init__(cursor, uid, name, context=context)
2039- self.pool = pooler.get_pool(self.cr.dbname)
2040- self.cursor = self.cr
2041-
2042- self.localcontext.update({
2043- 'get_amount': self.get_amount,
2044- 'get_partner_name': self.get_partner_name,
2045- 'get_accounts_by_curr': self.get_accounts_by_curr,
2046- 'get_currency_symbol': self.get_currency_symbol,
2047- 'get_initial_balance': self.get_initial_balance,
2048- })
2049-
2050- def get_accounts_by_curr(self, cr, uid, objects):
2051- currency_names_list = []
2052- accounts_curr_list = []
2053- accounts_by_curr = []
2054-
2055- for account in objects:
2056- currency_name = account.report_currency_id.name
2057- if currency_name not in currency_names_list:
2058- currency_names_list.append(currency_name)
2059-
2060- for currency_name in currency_names_list:
2061- account_by_curr = []
2062- for account in objects:
2063- if account.report_currency_id.name == currency_name:
2064- account_by_curr.append(account)
2065- accounts_curr_list.append(account_by_curr)
2066-
2067- i = 0
2068- for currency_name in currency_names_list:
2069- temp_tup = (currency_name, accounts_curr_list[i])
2070- accounts_by_curr.append(temp_tup)
2071- i += 1
2072-
2073- return accounts_by_curr
2074-
2075- def get_amount(self,cr, uid, account_move_line, currency):
2076- account_obj = self.pool.get('account.account').browse(cr,uid,account_move_line['account_id'])
2077-
2078- obj_invoice = self.pool.get('account.invoice')
2079- invoice_search = obj_invoice.search(cr,uid,[('move_id','=',account_move_line['move_id'])])
2080- invoice = None
2081- if invoice_search != []:
2082- invoice = obj_invoice.browse(cr,uid,invoice_search[0])
2083-
2084- obj_voucher = self.pool.get('account.voucher')
2085- voucher_search = obj_voucher.search(cr,uid,[('move_id','=',account_move_line['move_id'])])
2086-
2087- voucher = None
2088- if voucher_search != []:
2089- voucher = obj_voucher.browse(cr,uid,voucher_search[0])
2090-
2091- res = ('none', 0.0, 0.0)
2092-
2093- amount = 0.0
2094- if currency != 'CRC':
2095- amount = account_move_line['amount_currency']
2096- else:
2097- if account_move_line['debit'] != 0.0 :
2098- amount = account_move_line['debit']
2099- elif account_move_line['credit'] != 0.0 :
2100- amount = account_move_line['credit'] * -1
2101-
2102- # Invoices
2103- if invoice:
2104- if invoice.type == 'out_invoice': # Customer Invoice
2105- res = ('invoice', amount)
2106- elif invoice.type == 'in_invoice': # Supplier Invoice
2107- res = ('invoice', amount)
2108- elif invoice.type == 'in_refund': # Debit Note
2109- res = ('debit', amount)
2110- elif invoice.type == 'out_refund': # Credit Note
2111- res = ('credit', amount)
2112- # Vouchers
2113- elif voucher:
2114- if voucher.type == 'payment': # Payment
2115- res = ('payment', amount)
2116- elif voucher.type == 'sale': # Invoice
2117- res = ('invoice', amount)
2118- elif voucher.type == 'receipt': # Payment
2119- res = ('payment', amount)
2120- # Manual Move
2121- else:
2122- res = ('manual', amount)
2123-
2124- if res[1] == None or (currency != None and res[1] == 0.0):
2125- secundary_amount = (account_move_line['debit'] != 0.0) and account_move_line['debit'] or account_move_line['credit']
2126- res = (res[0], 0.0, secundary_amount)
2127- else:
2128- res = (res[0], res[1], None)
2129-
2130- return res
2131-
2132- def get_partner_name(self,cr,uid,partner_name, p_id, p_ref, p_name):
2133-
2134- res = ''
2135- if p_ref != None and p_name != None:
2136- res = res+p_ref+' '+p_name
2137- else:
2138- res = partner_name
2139-
2140-
2141- return res
2142-
2143- def get_currency_symbol(self, cr, uid, currency_name, context=None):
2144- currency_obj = self.pool.get('res.currency')
2145-
2146- currency_id = currency_obj.search(cr, uid, [('name', '=', currency_name)], context=context)[0]
2147- currency = currency_obj.browse(cr, uid, currency_id)
2148-
2149- return currency.symbol
2150-
2151- def get_initial_balance(self, cr, uid, partner, account, filter_type, filter_data, fiscal_year, currency, context=None):
2152- date_start = ''
2153- initial_balance = 0.0
2154-
2155- if filter_type == '':
2156- date_start = fiscal_year.date_start
2157- move_lines_id = self.pool.get('account.move.line').search(cr, uid, [('account_id', '=', account.id), ('partner_id', '=', partner), ('period_id.fiscalyear_id.date_start', '<', date_start), ('reconcile_id', '=', False)], context=context)
2158- else:
2159- if filter_type == 'filter_period':
2160- date_start = filter_data[0].date_start
2161- move_lines_id = self.pool.get('account.move.line').search(cr, uid, [('account_id', '=', account.id), ('partner_id', '=', partner), ('period_id.date_start', '<', date_start), ('reconcile_id', '=', False)], context=context)
2162- elif filter_type == 'filter_date':
2163- date_start = filter_data[0]
2164- move_lines_id = self.pool.get('account.move.line').search(cr, uid, [('account_id', '=', account.id), ('partner_id', '=', partner), ('date', '<', date_start), ('reconcile_id', '=', False)], context=context)
2165-
2166- move_lines = self.pool.get('account.move.line').browse(cr, uid, move_lines_id)
2167-
2168- amount = 0.0
2169- for move_line in move_lines:
2170- if currency != 'CRC':
2171- amount = move_line.amount_currency
2172- else:
2173- if move_line.debit != 0.0 :
2174- amount = move_line.debit
2175- elif move_line.credit != 0.0 :
2176- amount = move_line.credit * -1
2177- initial_balance += amount
2178-
2179- return initial_balance
2180-
2181-HeaderFooterTextWebKitParser('report.account_financial_report_webkit.account.account_report_partners_ledger_webkit',
2182- 'account.account',
2183- 'addons/l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako',
2184- parser=l10n_cr_PartnersLedgerWebkit)
2185\ No newline at end of file
2186
2187=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report/report.xml'
2188--- TODO-7.0/l10n_cr_account_financial_report_webkit/report/report.xml 2013-02-06 22:22:56 +0000
2189+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report/report.xml 2013-08-20 07:28:14 +0000
2190@@ -1,39 +1,7 @@
2191 <?xml version="1.0" encoding="utf-8"?>
2192 <openerp>
2193 <data>
2194-
2195- <!-- we do not use report tag has we can not set header ref -->
2196- <record id="account_financial_report_webkit.account_report_partners_ledger_webkit" model="ir.actions.report.xml">
2197- <field name="report_type">webkit</field>
2198- <field name="report_name">account_financial_report_webkit.account.account_report_partners_ledger_webkit</field>
2199- <field eval="[(6,0,[])]" name="groups_id"/>
2200- <field eval="0" name="multi"/>
2201- <field eval="0" name="auto"/>
2202- <field eval="1" name="header"/>
2203- <field name="model">account.account</field>
2204- <field name="type">ir.actions.report.xml</field>
2205- <field name="name">Partner Ledger Webkit</field>
2206- <field name="report_rml">l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako</field>
2207- <field name="report_file">l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partners_ledger.mako</field>
2208- <field name="webkit_header" ref="financial_landscape_header"/>
2209- </record>
2210-
2211-
2212- <record id="account_financial_report_webkit.account_report_open_invoices_webkit" model="ir.actions.report.xml">
2213- <field name="report_type">webkit</field>
2214- <field name="report_name">account_financial_report_webkit.account.account_report_open_invoices_webkit</field>
2215- <field eval="[(6,0,[])]" name="groups_id"/>
2216- <field eval="0" name="multi"/>
2217- <field eval="0" name="auto"/>
2218- <field eval="1" name="header"/>
2219- <field name="model">account.account</field>
2220- <field name="type">ir.actions.report.xml</field>
2221- <field name="name">Open Invoices Report</field>
2222- <field name="report_rml">l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako</field>
2223- <field name="report_file">l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_open_invoices.mako</field>
2224- <field name="webkit_header" ref="financial_landscape_header"/>
2225- </record>
2226-
2227+
2228 <report auto="False" id="l10n_cr_partner_balance" model="res.partner"
2229 name="l10n.cr.partner.balance.layout_ccorp" file="l10n_cr_account_financial_report_webkit/report/l10n_cr_account_report_partner_balance.mako" string="Statement of Account" report_type="webkit"/>
2230
2231
2232=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/report_menus.xml'
2233--- TODO-7.0/l10n_cr_account_financial_report_webkit/report_menus.xml 2013-01-22 19:54:28 +0000
2234+++ TODO-7.0/l10n_cr_account_financial_report_webkit/report_menus.xml 2013-08-20 07:28:14 +0000
2235@@ -2,15 +2,6 @@
2236 <openerp>
2237 <data>
2238
2239- <!-- TODO
2240- <menuitem icon="STOCK_PRINT" name="Partner Ledger"
2241- parent="account.next_id_22" action="action_account_partners_ledger_menu_webkit"
2242- groups="account.group_account_manager,account.group_account_user" id="account.menu_account_partner_ledger"/> -->
2243-
2244- <menuitem icon="STOCK_PRINT" name="Open Invoices"
2245- parent="account.next_id_22" action="action_account_open_invoices_menu_webkit"
2246- groups="account.group_account_manager,account.group_account_user" id="account_financial_report_webkit.menu_account_open_invoices"/>
2247-
2248 <menuitem icon="STOCK_PRINT" name="Account Bank Balances"
2249 parent="account.final_accounting_reports" action="action_account_balances_menu_webkit"
2250 groups="account.group_account_manager,account.group_account_user" id="account_financial_report_webkit.menu_Account_Balances_report"/>
2251
2252=== modified file 'TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/__init__.py'
2253--- TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/__init__.py 2012-07-20 16:00:33 +0000
2254+++ TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/__init__.py 2013-08-20 07:28:14 +0000
2255@@ -20,8 +20,5 @@
2256 #
2257 ##############################################################################
2258
2259-
2260-import partners_ledger_wizard
2261-import open_invoices_wizard
2262 import account_bank_balances_wizard
2263 import l10n_cr_account_financial_report_wizard
2264
2265=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_open_invoices_wizard_view.xml'
2266--- TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_open_invoices_wizard_view.xml 2012-06-22 20:40:49 +0000
2267+++ TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_open_invoices_wizard_view.xml 1970-01-01 00:00:00 +0000
2268@@ -1,31 +0,0 @@
2269-<?xml version="1.0" encoding="utf-8"?>
2270-<openerp>
2271- <data>
2272-
2273- <record id="l10n_cr_account_open_invoices_view_webkit" model="ir.ui.view">
2274- <field name="name">Open Invoices Report</field>
2275- <field name="model">open.invoices.webkit</field>
2276- <field name="type">form</field>
2277- <field name="inherit_id" ref="account_financial_report_webkit.account_open_invoices_view_webkit"/>
2278- <field name="arch" type="xml">
2279- <data>
2280- <page string="Layout Options" name="layout_options" position = "replace">
2281- <field name="amount_currency" invisible = "True"/>
2282- <field name="group_by_currency" invisible = "True"/>
2283- </page>
2284- </data>
2285- </field>
2286- </record>
2287-
2288- <record id="action_account_open_invoices_menu_webkit" model="ir.actions.act_window">
2289- <field name="name">Open Invoices Report</field>
2290- <field name="type">ir.actions.act_window</field>
2291- <field name="res_model">open.invoices.webkit</field>
2292- <field name="view_type">form</field>
2293- <field name="view_mode">form</field>
2294- <field name="view_id" ref="l10n_cr_account_open_invoices_view_webkit"/>
2295- <field name="target">new</field>
2296- </record>
2297-
2298- </data>
2299-</openerp>
2300
2301=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_partners_ledger_wizard_view.xml'
2302--- TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_partners_ledger_wizard_view.xml 2012-06-22 20:40:49 +0000
2303+++ TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/l10n_cr_partners_ledger_wizard_view.xml 1970-01-01 00:00:00 +0000
2304@@ -1,30 +0,0 @@
2305-<?xml version="1.0" encoding="utf-8"?>
2306-<openerp>
2307- <data>
2308-
2309- <record id="l10n_cr_account_partner_ledger_view_webkit" model="ir.ui.view">
2310- <field name="name">Partner Ledger</field>
2311- <field name="model">partners.ledger.webkit</field>
2312- <field name="type">form</field>
2313- <field name="inherit_id" ref="account_financial_report_webkit.account_partner_ledger_view_webkit"/>
2314- <field name="arch" type="xml">
2315- <data>
2316- <page string="Layout Options" name="layout_options" position = "replace">
2317- <field name="amount_currency" invisible = "True"/>
2318- </page>
2319- </data>
2320- </field>
2321- </record>
2322-
2323- <record id="action_account_partners_ledger_menu_webkit" model="ir.actions.act_window">
2324- <field name="name">Partner Ledger</field>
2325- <field name="type">ir.actions.act_window</field>
2326- <field name="res_model">partners.ledger.webkit</field>
2327- <field name="view_type">form</field>
2328- <field name="view_mode">form</field>
2329- <field name="view_id" ref="l10n_cr_account_partner_ledger_view_webkit"/>
2330- <field name="target">new</field>
2331- </record>
2332-
2333- </data>
2334-</openerp>
2335
2336=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/open_invoices_wizard.py'
2337--- TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/open_invoices_wizard.py 2012-07-09 21:54:26 +0000
2338+++ TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/open_invoices_wizard.py 1970-01-01 00:00:00 +0000
2339@@ -1,52 +0,0 @@
2340-# -*- coding: utf-8 -*-
2341-##############################################################################
2342-#
2343-# OpenERP, Open Source Management Solution
2344-# Addons modules by CLEARCORP S.A.
2345-# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
2346-#
2347-# This program is free software: you can redistribute it and/or modify
2348-# it under the terms of the GNU Affero General Public License as
2349-# published by the Free Software Foundation, either version 3 of the
2350-# License, or (at your option) any later version.
2351-#
2352-# This program is distributed in the hope that it will be useful,
2353-# but WITHOUT ANY WARRANTY; without even the implied warranty of
2354-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2355-# GNU Affero General Public License for more details.
2356-#
2357-# You should have received a copy of the GNU Affero General Public License
2358-# along with this program. If not, see <http://www.gnu.org/licenses/>.
2359-#
2360-##############################################################################
2361-
2362-from osv import fields, osv
2363-
2364-
2365-class l10n_cr_AccountReportOpenInvoicesWizard(osv.osv_memory):
2366- """Will launch partner ledger report and pass required args"""
2367-
2368- _inherit = "open.invoices.webkit"
2369- _name = "open.invoices.webkit"
2370- _description = "Open Invoices Report"
2371-
2372-
2373- def pre_print_report(self, cr, uid, ids, data, context=None):
2374- data = super(l10n_cr_AccountReportOpenInvoicesWizard, self).pre_print_report(cr, uid, ids, data, context)
2375- if context is None:
2376- context = {}
2377- vals = self.read(cr, uid, ids,
2378- ['until_date',],
2379- context=context)[0]
2380- data['form'].update(vals)
2381- return data
2382-
2383-
2384- def _print_report(self, cursor, uid, ids, data, context=None):
2385- context = context or {}
2386- # we update form with display account value
2387- data = self.pre_print_report(cursor, uid, ids, data, context=context)
2388- return {'type': 'ir.actions.report.xml',
2389- 'report_name': 'account_financial_report_webkit.account.account_report_open_invoices_webkit',
2390- 'datas': data}
2391-
2392
2393=== removed file 'TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/partners_ledger_wizard.py'
2394--- TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/partners_ledger_wizard.py 2012-06-05 20:10:55 +0000
2395+++ TODO-7.0/l10n_cr_account_financial_report_webkit/wizard/partners_ledger_wizard.py 1970-01-01 00:00:00 +0000
2396@@ -1,43 +0,0 @@
2397-# -*- coding: utf-8 -*-
2398-##############################################################################
2399-#
2400-# OpenERP, Open Source Management Solution
2401-# Addons modules by CLEARCORP S.A.
2402-# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
2403-#
2404-# This program is free software: you can redistribute it and/or modify
2405-# it under the terms of the GNU Affero General Public License as
2406-# published by the Free Software Foundation, either version 3 of the
2407-# License, or (at your option) any later version.
2408-#
2409-# This program is distributed in the hope that it will be useful,
2410-# but WITHOUT ANY WARRANTY; without even the implied warranty of
2411-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2412-# GNU Affero General Public License for more details.
2413-#
2414-# You should have received a copy of the GNU Affero General Public License
2415-# along with this program. If not, see <http://www.gnu.org/licenses/>.
2416-#
2417-##############################################################################
2418-
2419-import time
2420-
2421-from osv import fields, osv
2422-
2423-
2424-class l10n_cr_AccountReportPartnersLedgerWizard(osv.osv_memory):
2425- """Will launch partner ledger report and pass required args"""
2426-
2427- _inherit = "partners.ledger.webkit"
2428- _name = "partners.ledger.webkit"
2429- _description = "Partner Ledger Report"
2430-
2431-
2432- def _print_report(self, cursor, uid, ids, data, context=None):
2433- context = context or {}
2434- # we update form with display account value
2435- data = self.pre_print_report(cursor, uid, ids, data, context=context)
2436- return {'type': 'ir.actions.report.xml',
2437- 'report_name': 'account_financial_report_webkit.account.account_report_partners_ledger_webkit',
2438- 'datas': data}
2439-
2440
2441=== modified file 'TODO-7.0/l10n_cr_account_financial_statements/i18n/es_CR.po'
2442--- TODO-7.0/l10n_cr_account_financial_statements/i18n/es_CR.po 2012-11-14 08:12:05 +0000
2443+++ TODO-7.0/l10n_cr_account_financial_statements/i18n/es_CR.po 2013-08-20 07:28:14 +0000
2444@@ -452,3 +452,11 @@
2445 msgid "Compare By"
2446 msgstr "Comparar por"
2447
2448+
2449+#. module: account
2450+#: model:ir.ui.menu,name:account.menu_account_report_pl
2451+msgid "Profit And Loss"
2452+msgstr "Estado de Resultados"
2453+
2454+
2455+
2456
2457=== modified file 'TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.mako'
2458--- TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.mako 2013-01-02 20:44:43 +0000
2459+++ TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.mako 2013-08-20 07:28:14 +0000
2460@@ -64,7 +64,7 @@
2461 total_fiscalyear = income_total_fiscalyear + expense_total_fiscalyear
2462 total_percentage_last_period = income_total_last_period != 0 and (100 * total_last_period / income_total_last_period) or 0
2463 total_percentage_period = income_total_period != 0 and (100 * total_period / income_total_period) or 0
2464- total_percentage_variation = income_total_last_period != 0 and (100 * total_variation / total_last_period) or 0
2465+ total_percentage_variation = total_last_period != 0 and (100 * total_variation / total_last_period) or 0
2466 total_percentage_fiscalyear = income_total_fiscalyear != 0 and (100 * total_fiscalyear / income_total_fiscalyear) or 0
2467 %>
2468 <% row_even = False %>
2469
2470=== modified file 'TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.py'
2471--- TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.py 2012-11-14 05:24:25 +0000
2472+++ TODO-7.0/l10n_cr_account_financial_statements/report/profit_statement_report.py 2013-08-20 07:28:14 +0000
2473@@ -104,6 +104,7 @@
2474 period = account_period_obj.browse(cr, uid, self._get_form_param('period_from', data))
2475 last_period = self.get_last_period(cr, uid, period)
2476 fiscal_year = self.get_fiscalyear(cr, uid, period)
2477+ filter_type = self._get_filter(data)
2478
2479 #build account_ids list
2480 income_account_ids = library_obj.get_account_child_ids(cr, uid, category_account_ids['income'])
2481@@ -114,12 +115,12 @@
2482 expense_accounts = account_account_obj.browse(cr, uid, expense_account_ids)
2483
2484 #build balances
2485- income_period_balances = library_obj.get_account_balance(cr, uid, income_account_ids, ['balance'], start_period_id=period.id, end_period_id=period.id)
2486- expense_period_balances = library_obj.get_account_balance(cr, uid, expense_account_ids, ['balance'], start_period_id=period.id, end_period_id=period.id)
2487- income_last_period_balances = library_obj.get_account_balance(cr, uid, income_account_ids, ['balance'], start_period_id=last_period.id, end_period_id=last_period.id)
2488- expense_last_period_balances = library_obj.get_account_balance(cr, uid, expense_account_ids, ['balance'], start_period_id=last_period.id, end_period_id=last_period.id)
2489- income_fiscal_year_balances = library_obj.get_account_balance(cr, uid, income_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id)
2490- expense_fiscal_year_balances = library_obj.get_account_balance(cr, uid, expense_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id)
2491+ income_period_balances = library_obj.get_account_balance(cr, uid, income_account_ids, ['balance'], start_period_id=period.id, end_period_id=period.id,filter_type=filter_type)
2492+ expense_period_balances = library_obj.get_account_balance(cr, uid, expense_account_ids, ['balance'], start_period_id=period.id, end_period_id=period.id,filter_type=filter_type)
2493+ income_last_period_balances = library_obj.get_account_balance(cr, uid, income_account_ids, ['balance'], start_period_id=last_period.id, end_period_id=last_period.id,filter_type=filter_type)
2494+ expense_last_period_balances = library_obj.get_account_balance(cr, uid, expense_account_ids, ['balance'], start_period_id=last_period.id, end_period_id=last_period.id,filter_type=filter_type)
2495+ income_fiscal_year_balances = library_obj.get_account_balance(cr, uid, income_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id,filter_type=filter_type)
2496+ expense_fiscal_year_balances = library_obj.get_account_balance(cr, uid, expense_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id, filter_type=filter_type)
2497
2498 #build total balances
2499 total_income_balances = {
2500
2501=== modified file 'TODO-7.0/l10n_cr_account_financial_statements/report/situation_balance_report.py'
2502--- TODO-7.0/l10n_cr_account_financial_statements/report/situation_balance_report.py 2012-11-14 08:22:28 +0000
2503+++ TODO-7.0/l10n_cr_account_financial_statements/report/situation_balance_report.py 2013-08-20 07:28:14 +0000
2504@@ -117,6 +117,7 @@
2505 period = account_period_obj.browse(cr, uid, self._get_form_param('period_from', data))
2506 fiscal_year = self.get_fiscalyear(cr, uid, period)
2507 opening_period = self.get_opening_period(cr, uid, period)
2508+ filter_type = self._get_filter(data)
2509
2510 #build account_ids list
2511 asset_account_ids = library_obj.get_account_child_ids(cr, uid, category_account_ids['asset'])
2512@@ -133,17 +134,17 @@
2513 expense_account = category_account_ids['expense']
2514
2515 #build balances
2516- asset_period_balances = library_obj.get_account_balance(cr, uid, asset_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id)
2517- liability_period_balances = library_obj.get_account_balance(cr, uid, liability_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id)
2518- equity_period_balances = library_obj.get_account_balance(cr, uid, equity_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id)
2519- income_period_balance = library_obj.get_account_balance(cr, uid, [income_account_id], ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id)
2520- expense_period_balance = library_obj.get_account_balance(cr, uid, [expense_account_id], ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id)
2521+ asset_period_balances = library_obj.get_account_balance(cr, uid, asset_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id,filter_type=filter_type)
2522+ liability_period_balances = library_obj.get_account_balance(cr, uid, liability_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id, filter_type=filter_type)
2523+ equity_period_balances = library_obj.get_account_balance(cr, uid, equity_account_ids, ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id, filter_type=filter_type)
2524+ income_period_balance = library_obj.get_account_balance(cr, uid, [income_account_id], ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id, filter_type=filter_type)
2525+ expense_period_balance = library_obj.get_account_balance(cr, uid, [expense_account_id], ['balance'], end_period_id=period.id, fiscal_year_id=fiscal_year.id,filter_type=filter_type)
2526
2527- asset_fiscal_year_balances = library_obj.get_account_balance(cr, uid, asset_account_ids, ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id)
2528- liability_fiscal_year_balances = library_obj.get_account_balance(cr, uid, liability_account_ids, ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id)
2529- equity_fiscal_year_balances = library_obj.get_account_balance(cr, uid, equity_account_ids, ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id)
2530- income_fiscal_year_balance = library_obj.get_account_balance(cr, uid, [income_account_id], ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id)
2531- expense_fiscal_year_balance = library_obj.get_account_balance(cr, uid, [expense_account_id], ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id)
2532+ asset_fiscal_year_balances = library_obj.get_account_balance(cr, uid, asset_account_ids, ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id,filter_type=filter_type)
2533+ liability_fiscal_year_balances = library_obj.get_account_balance(cr, uid, liability_account_ids, ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id,filter_type=filter_type)
2534+ equity_fiscal_year_balances = library_obj.get_account_balance(cr, uid, equity_account_ids, ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id,filter_type=filter_type)
2535+ income_fiscal_year_balance = library_obj.get_account_balance(cr, uid, [income_account_id], ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id,filter_type=filter_type)
2536+ expense_fiscal_year_balance = library_obj.get_account_balance(cr, uid, [expense_account_id], ['balance'], start_period_id=opening_period.id, end_period_id=opening_period.id,filter_type=filter_type)
2537
2538
2539
2540
2541=== modified file 'TODO-7.0/l10n_cr_account_financial_statements/report_menus.xml'
2542--- TODO-7.0/l10n_cr_account_financial_statements/report_menus.xml 2012-11-13 22:28:19 +0000
2543+++ TODO-7.0/l10n_cr_account_financial_statements/report_menus.xml 2013-08-20 07:28:14 +0000
2544@@ -2,13 +2,13 @@
2545 <openerp>
2546 <data>
2547
2548- <menuitem icon="STOCK_PRINT" name="Profit Statement Report"
2549+ <menuitem icon="STOCK_PRINT" name="Profit And Loss"
2550 parent="account.final_accounting_reports" action="action_profit_statement_report_menu_webkit"
2551- id="menu_profit_statement_report"/>
2552+ id="account.menu_account_report_pl"/>
2553
2554 <menuitem icon="STOCK_PRINT" name="Situation Balance Report"
2555 parent="account.final_accounting_reports" action="action_situation_balance_report_menu_webkit"
2556- id="menu_situation_balance_report"/>
2557+ id="account.menu_account_report_bs"/>
2558
2559 </data>
2560 </openerp>
2561
2562=== removed directory 'TODO-7.0/l10n_cr_accounting_report_library'
2563=== modified file 'TODO-7.0/l10n_cr_base/i18n/es.po'
2564--- TODO-7.0/l10n_cr_base/i18n/es.po 2013-03-05 05:26:24 +0000
2565+++ TODO-7.0/l10n_cr_base/i18n/es.po 2013-08-20 07:28:14 +0000
2566@@ -14,8 +14,8 @@
2567 "MIME-Version: 1.0\n"
2568 "Content-Type: text/plain; charset=UTF-8\n"
2569 "Content-Transfer-Encoding: 8bit\n"
2570-"X-Launchpad-Export-Date: 2013-03-05 05:26+0000\n"
2571-"X-Generator: Launchpad (build 16514)\n"
2572+"X-Launchpad-Export-Date: 2013-08-06 05:01+0000\n"
2573+"X-Generator: Launchpad (build 16718)\n"
2574
2575 #. module: l10n_cr_base
2576 #: model:res.partner.title,name:l10n_cr_base.res_partner_title_ing
2577
2578=== added directory 'l10n_cr_account_banking_cr_bncr'
2579=== added file 'l10n_cr_account_banking_cr_bncr/__init__.py'
2580--- l10n_cr_account_banking_cr_bncr/__init__.py 1970-01-01 00:00:00 +0000
2581+++ l10n_cr_account_banking_cr_bncr/__init__.py 2013-08-20 07:28:14 +0000
2582@@ -0,0 +1,24 @@
2583+# -*- encoding: utf-8 -*-
2584+##############################################################################
2585+#
2586+# Copyright (C) 2011 credativ Ltd (<http://www.credativ.co.uk>).
2587+# All Rights Reserved
2588+#
2589+# This program is free software: you can redistribute it and/or modify
2590+# it under the terms of the GNU Affero General Public License as
2591+# published by the Free Software Foundation, either version 3 of the
2592+# License, or (at your option) any later version.
2593+#
2594+# This program is distributed in the hope that it will be useful,
2595+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2596+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2597+# GNU Affero General Public License for more details.
2598+#
2599+# You should have received a copy of the GNU Affero General Public License
2600+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2601+#
2602+##############################################################################
2603+
2604+import bncr_format
2605+
2606+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2607
2608=== added file 'l10n_cr_account_banking_cr_bncr/__openerp__.py'
2609--- l10n_cr_account_banking_cr_bncr/__openerp__.py 1970-01-01 00:00:00 +0000
2610+++ l10n_cr_account_banking_cr_bncr/__openerp__.py 2013-08-20 07:28:14 +0000
2611@@ -0,0 +1,37 @@
2612+# -*- coding: utf-8 -*-
2613+##############################################################################
2614+#
2615+# OpenERP, Open Source Management Solution
2616+# Addons modules by CLEARCORP S.A.
2617+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
2618+#
2619+# This program is free software: you can redistribute it and/or modify
2620+# it under the terms of the GNU Affero General Public License as
2621+# published by the Free Software Foundation, either version 3 of the
2622+# License, or (at your option) any later version.
2623+#
2624+# This program is distributed in the hope that it will be useful,
2625+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2626+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2627+# GNU Affero General Public License for more details.
2628+#
2629+# You should have received a copy of the GNU Affero General Public License
2630+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2631+#
2632+##############################################################################
2633+
2634+{
2635+ 'name': 'National Bank Account Banking',
2636+ 'version': '0.5',
2637+ 'license': 'AGPL-3',
2638+ 'author': 'CLEARCORP S.A.',
2639+ 'website': 'http://www.clearcorp.co.cr',
2640+ 'category': 'Account Banking',
2641+ 'depends': ['account_banking','account_parser_type',],
2642+ 'init_xml': [],
2643+ 'update_xml': [],
2644+ 'demo_xml': [],
2645+ 'description': '',
2646+ 'active': False,
2647+ 'installable': True,
2648+}
2649
2650=== added file 'l10n_cr_account_banking_cr_bncr/bncr_format.py'
2651--- l10n_cr_account_banking_cr_bncr/bncr_format.py 1970-01-01 00:00:00 +0000
2652+++ l10n_cr_account_banking_cr_bncr/bncr_format.py 2013-08-20 07:28:14 +0000
2653@@ -0,0 +1,189 @@
2654+# -*- coding: utf-8 -*-
2655+##############################################################################
2656+#
2657+# OpenERP, Open Source Management Solution
2658+# Addons modules by CLEARCORP S.A.
2659+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
2660+#
2661+# This program is free software: you can redistribute it and/or modify
2662+# it under the terms of the GNU Affero General Public License as
2663+# published by the Free Software Foundation, either version 3 of the
2664+# License, or (at your option) any later version.
2665+#
2666+# This program is distributed in the hope that it will be useful,
2667+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2668+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2669+# GNU Affero General Public License for more details.
2670+#
2671+# You should have received a copy of the GNU Affero General Public License
2672+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2673+#
2674+##############################################################################
2675+
2676+from account_banking.parsers import models
2677+from tools.translate import _
2678+from bncr_parser import BNCRParser
2679+import re
2680+from osv import osv, fields
2681+import logging
2682+import pprint
2683+from datetime import datetime
2684+import base64
2685+
2686+bt = models.mem_bank_transaction
2687+logger = logging.getLogger( 'bncr_logger' )
2688+
2689+class transaction(models.mem_bank_transaction):
2690+
2691+ mapping = {
2692+ 'execution_date' : '',
2693+ 'effective_date' : '',
2694+ 'local_currency' : '',
2695+ 'transfer_type' : '',
2696+ 'reference' : '',
2697+ 'message' : '',
2698+ 'name' : '',
2699+ 'amount': '',
2700+ 'creditmarker': '',
2701+ }
2702+
2703+ def __init__(self, record, *args, **kwargs):
2704+
2705+ '''
2706+ Transaction creation
2707+ '''
2708+ #record is a dictionary, that is the reason to use iteritems().
2709+ super(transaction, self).__init__(*args, **kwargs)
2710+ for key, value in record.iteritems():
2711+ if record.has_key(key):
2712+ setattr(self, key, record[key])
2713+
2714+ if not self.is_valid():
2715+ logger.info("Invalid: %s", record)
2716+
2717+ def is_valid(self):
2718+ '''
2719+ We don't have remote_account so override base
2720+ '''
2721+ return (self.execution_date
2722+ and self.transferred_amount and True) or False
2723+
2724+class statement(models.mem_bank_statement):
2725+ '''
2726+ Bank statement imported data '''
2727+
2728+ def _transmission_number(self, record):
2729+ self.id = record['transref']
2730+
2731+ def _account_number(self, record):
2732+ self.local_account = record['account_number']
2733+ self.local_currency = record['currencycode']
2734+
2735+ def _statement_number(self, record):
2736+ self.id = record['id']
2737+
2738+ def _opening_balance(self, record):
2739+ self.start_balance = float(record['startingbalance'])
2740+
2741+ def _closing_balance(self, record):
2742+ self.end_balance = float(record['endingbalance'])
2743+ self.date = record['bookingdate']
2744+
2745+ def _transaction_new(self, record):
2746+ parser = BNCRParser()
2747+ sub_record = parser.statement_lines(record) #dictionary
2748+ for sub in sub_record:
2749+ self.transactions.append(transaction(sub))
2750+
2751+ def _not_used():
2752+ logger.info("Didn't use record: %s", record)
2753+
2754+ def _forward_available(self, record):
2755+ self.end_balance = float(record['endingbalance'])
2756+ self.date = record['bookingdate']
2757+
2758+ def _execution_date_transferred_amount (self, record):
2759+ self.execution_date = record['bookingdate']
2760+ self.transferred_amount = float(record['ammount'])
2761+
2762+ def transaction_info(self, record):
2763+ '''
2764+ Add extra information to transaction
2765+ '''
2766+ # Additional information for previous transaction
2767+ if len(self.transactions) < 1:
2768+ logger.info("Received additional information for non existent transaction:")
2769+ logger.info(record)
2770+ else:
2771+ transaction = self.transactions[-1]
2772+ transaction.id = ','.join([record[k] for k in ['infoline{0}'.format(i) for i in range(2,5)] if record.has_key(k)])
2773+
2774+def raise_error(message, line):
2775+ raise osv.osv.except_osv(_('Import error'),
2776+ 'Error in import:%s\n\n%s' % (message, line))
2777+
2778+class parser_bncr( models.parser ):
2779+
2780+ '''
2781+ This adds a new parser in the selection options.
2782+ When the account is associated to a parser, the following code makes it appear as an option
2783+ '''
2784+ code = 'BNCR-Parser'
2785+ name = _( 'BNCR Bank statement import' )
2786+ country_code = 'CR'
2787+ doc = _('''\
2788+ This format is available through
2789+ the National Bank web interface.
2790+ ''')
2791+
2792+ '''
2793+ ** Kwargs parameter is used for a dynamic list of parameters.
2794+ The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
2795+ so get information from the wizard and passed by the ** kwargs.
2796+ Then in the parses that are needed, are extracted from the ** kwargs and if needed,
2797+ the parser still works the same way without this parameter.
2798+
2799+ The rest of the methods must receive this parameter. (As the method that parse the header and the lines).
2800+
2801+ If you need a new parameter, you specify its name and value, using the ** kwargs is a dictionary,
2802+ extract its value, with the respective key
2803+ '''
2804+
2805+ def parse(self, cr, statements_file, **kwargs):
2806+ result = []
2807+ parser = BNCRParser()
2808+ stmnt = statement()
2809+
2810+ """
2811+ **kwargs have all the parameters that have the wizard and
2812+ has all the parameters passed from the wizard before calling
2813+ the method that parses the file.
2814+ """
2815+ #try:
2816+ #pass to encoding with the correct type of file.
2817+ data = base64.decodestring(statements_file)
2818+
2819+ records = parser.parse_stamenent_record(data,**kwargs)
2820+
2821+ stmnt._transmission_number(records)
2822+ stmnt._account_number(records)
2823+ stmnt._statement_number(records)
2824+ stmnt._opening_balance(records)
2825+ stmnt._closing_balance(records)
2826+ stmnt._forward_available(records)
2827+ stmnt._execution_date_transferred_amount (records)
2828+ stmnt._transaction_new(data)#call the method statement_lines in parser to parse all the lines in file and add to stament.
2829+
2830+ '''
2831+ A stament must have a header and transacctions. The method parse_stamenent_record parse the header and the
2832+ method _transaction_new parse all the line (transactions) in the file.
2833+ '''
2834+ if stmnt.is_valid():
2835+ result.append(stmnt)
2836+
2837+ return result
2838+ '''
2839+ except:
2840+ raise osv.except_osv(_('Error'), _('The file have a invalid extension for this parser.\nThe valid extension are .txt or .csv'))
2841+ '''
2842+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2843
2844=== added file 'l10n_cr_account_banking_cr_bncr/bncr_parser.py'
2845--- l10n_cr_account_banking_cr_bncr/bncr_parser.py 1970-01-01 00:00:00 +0000
2846+++ l10n_cr_account_banking_cr_bncr/bncr_parser.py 2013-08-20 07:28:14 +0000
2847@@ -0,0 +1,274 @@
2848+# -*- coding: utf-8 -*-
2849+##############################################################################
2850+#
2851+# OpenERP, Open Source Management Solution
2852+# Addons modules by CLEARCORP S.A.
2853+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
2854+#
2855+# This program is free software: you can redistribute it and/or modify
2856+# it under the terms of the GNU Affero General Public License as
2857+# published by the Free Software Foundation, either version 3 of the
2858+# License, or (at your option) any later version.
2859+#
2860+# This program is distributed in the hope that it will be useful,
2861+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2862+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2863+# GNU Affero General Public License for more details.
2864+#
2865+# You should have received a copy of the GNU Affero General Public License
2866+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2867+#
2868+##############################################################################
2869+"""
2870+Parser for Davivienda format files
2871+"""
2872+import re
2873+from datetime import datetime
2874+from dateutil import parser
2875+from pprint import PrettyPrinter
2876+from copy import copy
2877+
2878+class BNCRParser( object ):
2879+
2880+ #Define the header for the extract to import.
2881+ '''
2882+ ** Kwargs parameter is used for a dynamic list of parameters.
2883+ The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
2884+ so get information from the wizard and passed by the ** kwargs.
2885+ Then in the parses that are needed, are extracted from the ** kwargs and if needed,
2886+ the parser still works the same way without this parameter.
2887+
2888+ The rest of the methods must receive this parameter. (As the method that parse the header and the lines).
2889+
2890+ If you need a new parameter, you specify its name and value, using the ** kwargs is a dictionary,
2891+ extract its value, with the respective key
2892+ '''
2893+ def statement_record ( self, rec, **kwargs):
2894+ lines = []
2895+ line_dict = {}
2896+ startingbalance = 0.0
2897+
2898+ line_dict = {
2899+ 'transref': '', # _transmission_number
2900+ 'account_number': '', #_account_number
2901+ 'statementnr':'', # statement_number
2902+ 'startingbalance': 0.0, #_opening_balance
2903+ 'currencycode': '', #currencycode
2904+ 'endingbalance': 0.0, #_closing_balance
2905+ 'bookingdate': '', #moving_date
2906+ 'ammount': 0.0,
2907+ 'id': '',
2908+ }
2909+ #Split the file in statements
2910+ list_split = rec.split('\n')
2911+
2912+ #currency_code (local_currency in the stament) extracted from account_number object from the wizard.
2913+ #account_number (local_account) extracted from account_number object from the wizard.
2914+ #date_to_str and date_from_str are the dates in wizard, both are strings
2915+
2916+ line_dict['account_number'] = kwargs['account_number']
2917+
2918+ line_dict['currencycode'] = kwargs['local_currency']
2919+
2920+ line_dict['statementnr'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + ' Extracto BNCR ' + line_dict['account_number'] #Interval time of the file.
2921+
2922+ #transmission_number (Date when done the import)
2923+ date_obj= datetime.now()
2924+ line_dict['transref'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
2925+ #bookingdate
2926+ line_dict['bookingdate'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
2927+
2928+ '''
2929+ For the BNCR parser, the ending_balance comes from wizard. With total of debit and credit and the ending_balance
2930+ compute the initial_balance.
2931+ '''
2932+ #extract the total of debit and credit from the file. The last statements and compute the startingbalance
2933+ last_position = (len(list_split) - 1)
2934+ last_line = list_split[last_position]
2935+ #last line can be blanck, find the last line with data.
2936+ if last_line == "":
2937+ while True:
2938+ last_position -= 1
2939+ last_line = list_split[last_position]
2940+ if last_line is not "":
2941+ break
2942+
2943+ last_line_split = last_line.split(';')
2944+
2945+ #For another type of format, take the character \t
2946+ if len(last_line_split) > 1:
2947+ final_line_totals = last_line_split
2948+ else:
2949+ final_line_totals = last_line.split('\t')
2950+
2951+ #######################################################
2952+
2953+ if final_line_totals[3] != '':
2954+ debit = float(final_line_totals[3].replace(",",""))
2955+ else:
2956+ debit = 0.0
2957+ if final_line_totals[4] != '':
2958+ credit = float(final_line_totals[4].replace(",",""))
2959+ else:
2960+ credit = 0.0
2961+
2962+ startingbalance = float(kwargs['ending_balance']) + debit - credit
2963+ line_dict['startingbalance'] = str(startingbalance)
2964+
2965+ #the ending_balance extracted from **kwargs (comes from wizard)
2966+ endingbalance = float(kwargs['ending_balance'])
2967+ line_dict['endingbalance'] = str(kwargs['ending_balance'])
2968+
2969+ line_dict['ammount'] = startingbalance + endingbalance
2970+ line_dict['id'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + ' Extracto BNCR ' + line_dict['account_number']
2971+
2972+ return line_dict
2973+
2974+ '''
2975+ Parse all the lines in the file. Once the header is parser, the next step are the lines.
2976+ '''
2977+ def statement_lines ( self, rec ):
2978+ parser = BNCRParser()
2979+ mapping = {
2980+ 'execution_date' : '',
2981+ 'effective_date' : '',
2982+ 'transfer_type' : '',
2983+ 'reference' : '',
2984+ 'message' : '',
2985+ 'name' : '',
2986+ 'transferred_amount': '',
2987+ 'creditmarker': '',
2988+ }
2989+
2990+ lines = []
2991+ line_dict = {}
2992+ currencycode = ''
2993+
2994+ list_split = rec.split('\n')
2995+ entrada = False
2996+
2997+ start = 1
2998+ end = (len(list_split) - 1)
2999+ last_line = list_split[end]
3000+ #last line can be blanck, find the last line with data.
3001+ if last_line == "":
3002+ while True:
3003+ end -= 1
3004+ last_line = list_split[end]
3005+ if last_line is not "":
3006+ break
3007+
3008+ sub_list = list_split [start:end] #The end line is amount totals of credit and debit
3009+ for sub in sub_list:
3010+ line = sub.split(';')
3011+ if len(line) > 1:
3012+ final_line = line
3013+ #For another type of format, take the character \t
3014+ else:
3015+ final_line = sub.split('\t')
3016+
3017+ #effective_date
3018+ date_str = final_line[1].replace("/","-")
3019+ date= datetime.strptime(date_str, "%Y-%m-%d")
3020+ mapping['effective_date'] = date #fecha_contable.
3021+ #execution_date
3022+ mapping['execution_date'] = date #fecha_movimiento
3023+
3024+ mapping['transfer_type'] = 'NTRF'
3025+ mapping['reference'] = final_line[2] #NumDocumento
3026+ mapping['message'] = final_line[2]+' '+final_line[5] #NumDocumento + Description
3027+ mapping['name'] = final_line[2]+' '+final_line[5] #NumDocumento + Description
3028+ mapping['id'] = final_line[2]+' '+final_line[5] #NumDocumento + Description
3029+
3030+ #the field in position 3 is debit, the position 4 is credit
3031+ if final_line[4] != '':
3032+ credit = float(final_line[4].replace(",",""))
3033+ mapping['transferred_amount'] = credit
3034+ mapping['creditmarker'] = 'C'
3035+
3036+ elif final_line[3] != '':
3037+ #In this case, the debit is negative.
3038+ debit = float(final_line[3].replace(",",""))
3039+ mapping['transferred_amount'] = -1 * debit
3040+
3041+ lines.append(copy(mapping))
3042+
3043+ return lines
3044+
3045+ """
3046+ ** Kwargs parameter is used for a dynamic list of parameters.
3047+ The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
3048+ so get information from the wizard and passed by the ** kwargs.
3049+ Then in the parses that are needed, are extracted from the ** kwargs and if needed,
3050+ the parser still works the same way without this parameter.
3051+
3052+ The rest of the methods must receive this parameter. (As the method that parse the header and the lines).
3053+
3054+ If you need a new parameter, you specify its name and value, using the ** kwargs is a dictionary,
3055+ extract its value, with the respective key
3056+ """
3057+ def parse_stamenent_record( self, rec, **kwargs):
3058+
3059+ matchdict = dict()
3060+
3061+ #Set the header for the stament.
3062+ matchdict = self.statement_record(rec, **kwargs);
3063+
3064+ # Remove members set to None
3065+ matchdict = dict( [( k, v ) for k, v in matchdict.iteritems() if v] )
3066+
3067+ matchkeys = set( matchdict.keys() )
3068+ needstrip = set( [ 'transref', 'account_number', 'statementnr', 'currencycode', 'endingbalance', 'bookingdate'] )
3069+
3070+ for field in matchkeys & needstrip:
3071+ matchdict[field] = matchdict[field].strip()
3072+
3073+ # Convert to float. Comma is decimal separator
3074+ needsfloat = set( ["startingbalance", "endingbalance", "amount"] )
3075+ for field in matchkeys & needsfloat:
3076+ matchdict[field] = float( matchdict[field].replace( ',', '.' ) )
3077+
3078+ # Convert date fields
3079+ needdate = set( ["bookingdate"] )
3080+
3081+ for field in matchkeys & needdate:
3082+ datestring = matchdict[field]
3083+ date_obj= datetime.strptime(datestring, "%d-%m-%Y %H:%M:%S")
3084+ matchdict[field] = date_obj
3085+
3086+ return matchdict
3087+
3088+ def parse( self, cr, data ):
3089+ records = []
3090+ # Some records are multiline
3091+ for line in data:
3092+ if len(line) <= 1:
3093+ continue
3094+ if line[0] == ':' and len(line) > 1:
3095+ records.append(line)
3096+ else:
3097+ records[-1] = '\n'.join([records[-1], line])
3098+
3099+ output = []
3100+
3101+ for rec in records:
3102+ #parse_stament_record call the method that parse the header and the stament of the file.
3103+ output.append(self.parse_stamenent_record( rec ))
3104+
3105+ return output
3106+
3107+def parse_file( filename ):
3108+ bncrfile = open( filename, "r" )
3109+ p = BNCRParser().parse( bncrfile.readlines() )
3110+
3111+
3112+def main():
3113+ """The main function, currently just calls a dummy filename
3114+
3115+ :returns: description
3116+ """
3117+ parse_file("testfile")
3118+
3119+if __name__ == '__main__':
3120+ main()
3121+
3122
3123=== modified file 'l10n_cr_account_banking_cr_davivienda/__init__.py' (properties changed: +x to -x)
3124=== modified file 'l10n_cr_account_banking_cr_davivienda/__openerp__.py' (properties changed: +x to -x)
3125--- l10n_cr_account_banking_cr_davivienda/__openerp__.py 2013-02-22 22:35:48 +0000
3126+++ l10n_cr_account_banking_cr_davivienda/__openerp__.py 2013-08-20 07:28:14 +0000
3127@@ -27,7 +27,7 @@
3128 'author': 'CLEARCORP S.A.',
3129 'website': 'http://www.clearcorp.co.cr',
3130 'category': 'Account Banking',
3131- 'depends': ['account_banking'],
3132+ 'depends': ['account_banking','account_parser_type'],
3133 'init_xml': [],
3134 'update_xml': [],
3135 'demo_xml': [],
3136
3137=== modified file 'l10n_cr_account_banking_cr_davivienda/davivienda_format.py' (properties changed: +x to -x)
3138--- l10n_cr_account_banking_cr_davivienda/davivienda_format.py 2013-02-22 22:35:48 +0000
3139+++ l10n_cr_account_banking_cr_davivienda/davivienda_format.py 2013-08-20 07:28:14 +0000
3140@@ -24,10 +24,11 @@
3141 from tools.translate import _
3142 from davivienda_parser import DaviviendaParser
3143 import re
3144-import osv
3145+from osv import osv, fields
3146 import logging
3147 import pprint
3148 from datetime import datetime
3149+import base64
3150
3151 bt = models.mem_bank_transaction
3152 logger = logging.getLogger( 'davivienda_logger' )
3153@@ -76,6 +77,7 @@
3154
3155 def _account_number(self, record):
3156 self.local_account = record['account_number']
3157+ self.local_currency = record['currencycode']
3158
3159 def _statement_number(self, record):
3160 self.id = record['id']
3161@@ -102,7 +104,7 @@
3162
3163 def _execution_date_transferred_amount (self, record):
3164 self.execution_date = record['bookingdate']
3165- self.transferred_amount = float(record['ammount'])
3166+ self.transferred_amount = float(record['amount'])
3167
3168 def transaction_info(self, record):
3169 '''
3170@@ -133,7 +135,8 @@
3171 This format is available through
3172 the Davivienda web interface.
3173 ''')
3174- '''
3175+
3176+ '''
3177 ** Kwargs parameter is used for a dynamic list of parameters.
3178 The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
3179 so get information from the wizard and passed by the ** kwargs.
3180@@ -146,12 +149,19 @@
3181 extract its value, with the respective key
3182 '''
3183
3184- def parse(self, cr, data, **kwargs):
3185+ def parse(self, cr, statements_file, **kwargs):
3186 result = []
3187 parser = DaviviendaParser()
3188 stmnt = statement()
3189+ """
3190+ **kwargs have all the parameters that have the wizard and
3191+ has all the parameters passed from the wizard before calling
3192+ the method that parses the file.
3193+ """
3194+ #pass to encoding with the correct type of file.
3195+ data = base64.decodestring(statements_file)
3196
3197- #parse the data for the header of the stament.
3198+ #parse the data for the header of the stament.amount
3199 records = parser.parse_stamenent_record(data, **kwargs)
3200
3201 stmnt._transmission_number(records)
3202@@ -171,5 +181,5 @@
3203 result.append(stmnt)
3204
3205 return result
3206-
3207+
3208 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3209
3210=== modified file 'l10n_cr_account_banking_cr_davivienda/davivienda_parser.py'
3211--- l10n_cr_account_banking_cr_davivienda/davivienda_parser.py 2013-02-22 22:35:48 +0000
3212+++ l10n_cr_account_banking_cr_davivienda/davivienda_parser.py 2013-08-20 07:28:14 +0000
3213@@ -27,6 +27,8 @@
3214 from dateutil import parser
3215 from pprint import PrettyPrinter
3216 from copy import copy
3217+from osv import osv, fields
3218+from tools.translate import _
3219
3220 class DaviviendaParser( object ):
3221
3222@@ -55,53 +57,67 @@
3223 'currencycode': '', #currencycode
3224 'endingbalance': 0.0, #_closing_balance
3225 'bookingdate': '', #moving_date
3226- 'ammount': 0.0,
3227+ 'amount': 0.0,
3228 'id': '',
3229 }
3230
3231- #currency_code (local_currency in the stament) extracted from account_number object from the wizard.
3232- #account_number (local_account) extracted from account_number object from the wizard.
3233- #date_to_str and date_from_str are the dates in wizard, both are strings
3234- #the parameters come from davivienda_format in parser class.
3235- line_dict['account_number'] = kwargs['account_number']
3236-
3237- line_dict['currencycode'] = kwargs['local_currency']
3238-
3239- line_dict['statementnr'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + 'Extracto Davivienda ' + line_dict['account_number'] #Interval time of the file.
3240-
3241- startingbalance = endingbalance = 0.0
3242+ #Separe the file in statements
3243 list_split = rec.split('\n')
3244-
3245- #transmission_number (Date when done the import)
3246- date_obj= datetime.now()
3247- line_dict['transref'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
3248- #bookingdate
3249- line_dict['bookingdate'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
3250-
3251- #with the first line compute the initial_balance
3252+ #Obtain the first line to know the account number
3253 fist_line = list_split[1]
3254 first_line_split = fist_line.split(';')
3255- startingbalance = float(first_line_split[5].replace(",","")) + float(first_line_split[3].replace(",","")) - float(first_line_split[4].replace(",",""))
3256- line_dict['startingbalance'] = str(startingbalance)
3257-
3258- #the ending_balance is the balance of the last line.
3259- last_position = (len(list_split) - 1)
3260- last_line = list_split[last_position]
3261- #last line can be blanck, find the last line with data.
3262- if last_line == "":
3263- while True:
3264- last_position -= 1
3265- last_line = list_split[last_position]
3266- if last_line is not "":
3267- break
3268- last_line_split = last_line.split(';')
3269- endingbalance += float(last_line_split[5].replace(",",""))
3270- line_dict['endingbalance'] = str(endingbalance)
3271-
3272- line_dict['ammount'] = startingbalance + endingbalance
3273- line_dict['id'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + ' Extracto Davivienda ' + line_dict['account_number']
3274-
3275- return line_dict
3276+
3277+ account_number_wizard = kwargs['account_number']#from wizard
3278+ account_number_file = first_line_split[11]#from file.
3279+
3280+ #if the account_number in the file match with the account selected in the wizard, return True
3281+ if account_number_file.find(account_number_wizard) > -1:
3282+ #currency_code (local_currency in the stament) extracted from account_number object from the wizard.
3283+ #account_number (local_account) extracted from account_number object from the wizard.
3284+ #date_to_str and date_from_str are the dates in wizard, both are strings
3285+ #the parameters come from davivienda_format in parser class.
3286+ line_dict['account_number'] = kwargs['account_number']
3287+
3288+ line_dict['currencycode'] = kwargs['local_currency']
3289+
3290+ line_dict['statementnr'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + 'Extracto Davivienda ' + line_dict['account_number'] #Interval time of the file.
3291+
3292+ startingbalance = endingbalance = 0.0
3293+
3294+ #transmission_number (Date when done the import)
3295+ date_obj= datetime.now()
3296+ line_dict['transref'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
3297+ #bookingdate
3298+ line_dict['bookingdate'] = date_obj.strftime("%d-%m-%Y %H:%M:%S")
3299+
3300+ #with the first line compute the initial_balance
3301+ fist_line = list_split[1]
3302+ first_line_split = fist_line.split(';')
3303+ startingbalance = float(first_line_split[5].replace(",","")) + float(first_line_split[3].replace(",","")) - float(first_line_split[4].replace(",",""))
3304+ line_dict['startingbalance'] = str(startingbalance)
3305+
3306+ #the ending_balance is the balance of the last line.
3307+ last_position = (len(list_split) - 1)
3308+ last_line = list_split[last_position]
3309+ #last line can be blanck, find the last line with data.
3310+ if last_line == "":
3311+ while True:
3312+ last_position -= 1
3313+ last_line = list_split[last_position]
3314+ if len(last_line) > 0 and last_line != "" and last_line != '\r':
3315+ break
3316+ last_line_split = last_line.split(';')
3317+ endingbalance += float(last_line_split[5].replace(",",""))
3318+ line_dict['endingbalance'] = str(endingbalance)
3319+
3320+ line_dict['amount'] = str(startingbalance + endingbalance)
3321+ line_dict['id'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + ' Extracto Davivienda ' + line_dict['account_number']
3322+
3323+ return line_dict
3324+
3325+ else:
3326+ raise osv.except_osv(_('Error'),
3327+ _('Error en la importación! La cuenta especificada en el archivo no coincide con la seleccionada en el asistente de importacion'))
3328
3329 '''
3330 Parse all the lines in the file. Once the header is parser, the next step are the lines.
3331@@ -137,7 +153,7 @@
3332 if last_line is not "":
3333 break
3334
3335- sub_list = list_split [start:end+1]
3336+ sub_list = list_split [start:end]
3337 for sub in sub_list:
3338 line = sub.split(';')
3339 #effective_date
3340@@ -165,7 +181,17 @@
3341
3342 lines.append(copy(mapping))
3343
3344- return lines
3345+ return lines
3346+
3347+ #clear special characters in a row.
3348+ def clean_special_characters(self, text_celd):
3349+ special_characters = {'\r':''}
3350+
3351+ for i, j in special_characters.iteritems():
3352+ text = text_celd.replace(i, j)
3353+
3354+ #remove all the blank space.
3355+ return re.sub(r'\s', '', text)
3356
3357 """
3358 ** Kwargs parameter is used for a dynamic list of parameters.
3359@@ -179,7 +205,8 @@
3360 If you need a new parameter, you specify its name and value, using the ** kwargs is a dictionary,
3361 extract its value, with the respective key
3362 """
3363- def parse_stamenent_record( self, rec, **kwargs):
3364+
3365+ def parse_stamenent_record( self, rec, **kwargs): #parse the header.
3366
3367 matchdict = dict()
3368
3369@@ -187,7 +214,7 @@
3370 matchdict = self.statement_record(rec, **kwargs);
3371
3372 # Remove members set to None
3373- matchdict = dict( [( k, v ) for k, v in matchdict.iteritems() if v] )
3374+ #matchdict = dict( [( k, v ) for k, v in matchdict.iteritems() if v] )
3375
3376 matchkeys = set( matchdict.keys() )
3377 needstrip = set( [ 'transref', 'account_number', 'statementnr', 'currencycode', 'endingbalance', 'bookingdate'] )
3378@@ -201,7 +228,7 @@
3379 matchdict[field] = float( matchdict[field].replace( ',', '.' ) )
3380
3381 # Convert date fields
3382- needdate = set( ["bookingdate"] )
3383+ needdate = set( ["bookingdate", "effective_date", "execution_date"] )
3384
3385 for field in matchkeys & needdate:
3386 datestring = matchdict[field]
3387@@ -209,7 +236,8 @@
3388 matchdict[field] = date_obj
3389
3390 return matchdict
3391-
3392+
3393+ #call the method that parse the header and the statements.
3394 def parse( self, cr, data ):
3395 records = []
3396 # Some records are multiline
3397@@ -224,23 +252,9 @@
3398 output = []
3399
3400 for rec in records:
3401+ #parse_stamenent_record parse the header and the statements
3402 output.append( self.parse_stamenent_record( rec ) )
3403
3404 return output
3405
3406
3407-def parse_file( filename ):
3408- daviviendafile = open( filename, "r" )
3409- p = DaviviendaParser().parse( daviviendafile.readlines() )
3410-
3411-
3412-def main():
3413- """The main function, currently just calls a dummy filename
3414-
3415- :returns: description
3416- """
3417- parse_file("testfile")
3418-
3419-if __name__ == '__main__':
3420- main()
3421-
3422
3423=== added directory 'l10n_cr_account_banking_cr_lafise'
3424=== added file 'l10n_cr_account_banking_cr_lafise/__init__.py'
3425--- l10n_cr_account_banking_cr_lafise/__init__.py 1970-01-01 00:00:00 +0000
3426+++ l10n_cr_account_banking_cr_lafise/__init__.py 2013-08-20 07:28:14 +0000
3427@@ -0,0 +1,24 @@
3428+# -*- encoding: utf-8 -*-
3429+##############################################################################
3430+#
3431+# Copyright (C) 2011 credativ Ltd (<http://www.credativ.co.uk>).
3432+# All Rights Reserved
3433+#
3434+# This program is free software: you can redistribute it and/or modify
3435+# it under the terms of the GNU Affero General Public License as
3436+# published by the Free Software Foundation, either version 3 of the
3437+# License, or (at your option) any later version.
3438+#
3439+# This program is distributed in the hope that it will be useful,
3440+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3441+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3442+# GNU Affero General Public License for more details.
3443+#
3444+# You should have received a copy of the GNU Affero General Public License
3445+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3446+#
3447+##############################################################################
3448+
3449+import lafise_format
3450+
3451+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3452
3453=== added file 'l10n_cr_account_banking_cr_lafise/__openerp__.py'
3454--- l10n_cr_account_banking_cr_lafise/__openerp__.py 1970-01-01 00:00:00 +0000
3455+++ l10n_cr_account_banking_cr_lafise/__openerp__.py 2013-08-20 07:28:14 +0000
3456@@ -0,0 +1,37 @@
3457+# -*- coding: utf-8 -*-
3458+##############################################################################
3459+#
3460+# OpenERP, Open Source Management Solution
3461+# Addons modules by CLEARCORP S.A.
3462+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
3463+#
3464+# This program is free software: you can redistribute it and/or modify
3465+# it under the terms of the GNU Affero General Public License as
3466+# published by the Free Software Foundation, either version 3 of the
3467+# License, or (at your option) any later version.
3468+#
3469+# This program is distributed in the hope that it will be useful,
3470+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3471+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3472+# GNU Affero General Public License for more details.
3473+#
3474+# You should have received a copy of the GNU Affero General Public License
3475+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3476+#
3477+##############################################################################
3478+
3479+{
3480+ 'name': 'Lafise Account Banking',
3481+ 'version': '0.5',
3482+ 'license': 'AGPL-3',
3483+ 'author': 'CLEARCORP S.A.',
3484+ 'website': 'http://www.clearcorp.co.cr',
3485+ 'category': 'Account Banking',
3486+ 'depends': ['account_banking','account_parser_type'],
3487+ 'init_xml': [],
3488+ 'update_xml': [],
3489+ 'demo_xml': [],
3490+ 'description': 'Module to import Lafise CR format transation files.',
3491+ 'active': False,
3492+ 'installable': True,
3493+}
3494
3495=== added file 'l10n_cr_account_banking_cr_lafise/lafise_format.py'
3496--- l10n_cr_account_banking_cr_lafise/lafise_format.py 1970-01-01 00:00:00 +0000
3497+++ l10n_cr_account_banking_cr_lafise/lafise_format.py 2013-08-20 07:28:14 +0000
3498@@ -0,0 +1,205 @@
3499+# -*- coding: utf-8 -*-
3500+##############################################################################
3501+#
3502+# OpenERP, Open Source Management Solution
3503+# Addons modules by CLEARCORP S.A.
3504+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
3505+#
3506+# This program is free software: you can redistribute it and/or modify
3507+# it under the terms of the GNU Affero General Public License as
3508+# published by the Free Software Foundation, either version 3 of the
3509+# License, or (at your option) any later version.
3510+#
3511+# This program is distributed in the hope that it will be useful,
3512+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3513+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3514+# GNU Affero General Public License for more details.
3515+#
3516+# You should have received a copy of the GNU Affero General Public License
3517+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3518+#
3519+##############################################################################
3520+
3521+from account_banking.parsers import models
3522+from tools.translate import _
3523+from lafise_parser import LafiseParser
3524+import re
3525+from osv import osv, fields
3526+import logging
3527+import pprint
3528+from datetime import datetime
3529+import base64
3530+import StringIO
3531+from lxml import etree
3532+
3533+bt = models.mem_bank_transaction
3534+logger = logging.getLogger( 'lafise_logger' )
3535+
3536+class transaction(models.mem_bank_transaction):
3537+
3538+ mapping = {
3539+ 'execution_date' : '',
3540+ 'effective_date' : '',
3541+ 'local_currency' : '',
3542+ 'transfer_type' : '',
3543+ 'reference' : '',
3544+ 'message' : '',
3545+ 'name' : '',
3546+ 'amount': '',
3547+ 'creditmarker': '',
3548+ }
3549+
3550+ def __init__(self, record, *args, **kwargs):
3551+
3552+ '''
3553+ Transaction creation
3554+ '''
3555+ #record is a dictionary, that is the reason to use iteritems().
3556+ super(transaction, self).__init__(*args, **kwargs)
3557+ for key, value in record.iteritems():
3558+ if record.has_key(key):
3559+ setattr(self, key, record[key])
3560+
3561+ if not self.is_valid():
3562+ logger.info("Invalid: %s", record)
3563+
3564+ def is_valid(self):
3565+ '''
3566+ We don't have remote_account so override base
3567+ '''
3568+ return (self.execution_date
3569+ and self.transferred_amount and True) or False
3570+
3571+class statement(models.mem_bank_statement):
3572+ '''
3573+ Bank statement imported data '''
3574+
3575+ def _transmission_number(self, record):
3576+ self.id = record['transref']
3577+
3578+ def _account_number(self, record):
3579+ self.local_account = record['account_number']
3580+ self.local_currency = record['currencycode']
3581+
3582+ def _statement_number(self, record):
3583+ self.id = record['id']
3584+
3585+ def _opening_balance(self, record):
3586+ self.start_balance = float(record['startingbalance'])
3587+
3588+ def _closing_balance(self, record):
3589+ self.end_balance = float(record['endingbalance'])
3590+ self.date = record['bookingdate']
3591+
3592+ def _transaction_new(self, record, rows):
3593+ parser = LafiseParser()
3594+ #parse the lines in the file.
3595+
3596+ '''
3597+ Record is the header of the file
3598+ Rows is the lines when the parser to html read the file.
3599+ '''
3600+ sub_record = parser.statement_lines(record, rows) #dictionary
3601+ for sub in sub_record:
3602+ self.transactions.append(transaction(sub))
3603+
3604+ def _not_used():
3605+ logger.info("Didn't use record: %s", record)
3606+
3607+ def _forward_available(self, record):
3608+ self.end_balance = float(record['endingbalance'])
3609+ self.date = record['bookingdate']
3610+
3611+ def _execution_date_transferred_amount (self, record):
3612+ self.execution_date = record['bookingdate']
3613+ self.transferred_amount = float(record['ammount'])
3614+
3615+ def transaction_info(self, record):
3616+ '''
3617+ Add extra information to transaction
3618+ '''
3619+ # Additional information for previous transaction
3620+ if len(self.transactions) < 1:
3621+ logger.info("Received additional information for non existent transaction:")
3622+ logger.info(record)
3623+ else:
3624+ transaction = self.transactions[-1]
3625+ transaction.id = ','.join([record[k] for k in ['infoline{0}'.format(i) for i in range(2,5)] if record.has_key(k)])
3626+
3627+def raise_error(message, line):
3628+ raise osv.osv.except_osv(_('Import error'),
3629+ 'Error in import:%s\n\n%s' % (message, line))
3630+
3631+class parse_lafise( models.parser ):
3632+
3633+ '''
3634+ This adds a new parser in the selection options.
3635+ When the account is associated to a parser, the following code makes it appear as an option
3636+ '''
3637+ code = 'Lafise-Parser'
3638+ name = _( 'Lafise statement import' )
3639+ country_code = 'CR'
3640+ doc = _('''\
3641+ This format is available through
3642+ the Lafise web interface.
3643+ ''')
3644+ '''
3645+ ** Kwargs parameter is used for a dynamic list of parameters.
3646+ The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
3647+ so get information from the wizard and passed by the ** kwargs.
3648+ Then in the parses that are needed, are extracted from the ** kwargs and if needed,
3649+ the parser still works the same way without this parameter.
3650+
3651+ The rest of the methods must receive this parameter. (As the method that parse the header and the lines).
3652+
3653+ If you need a new parameter, you specify its name and value, using the ** kwargs is a dictionary,
3654+ extract its value, with the respective key
3655+ '''
3656+
3657+ def parse(self, cr, statements_file, **kwargs):
3658+ list_result = []
3659+ stmnt = statement()
3660+ parser_lafise = LafiseParser()
3661+
3662+ #decode to string the binary file in the wizard
3663+ content = base64.decodestring(statements_file)
3664+
3665+ '''
3666+ The lafise file when the content is decode to string return a html string.
3667+ The html format for the file is incorrect, so the function etree.HTMLParser()
3668+ With this function, the file have the correct tags and content for the file in html.
3669+ '''
3670+ parser = etree.HTMLParser() #parse to correct html format.
3671+ tree = etree.parse(StringIO.StringIO(content), parser) #Create a root with tags and content with the html file.
3672+ result = etree.tostring(tree.getroot(),pretty_print=True, method="html") #parse to string.
3673+
3674+ table = etree.HTML(result) #pass a tags HTML
3675+ rows = table.iter() #extract all the rows in the file.
3676+
3677+ #pass the rows to parse the headers
3678+ records = parser_lafise.parse_stamenent_record(rows, **kwargs)
3679+
3680+ stmnt._transmission_number(records)
3681+ stmnt._account_number(records)
3682+ stmnt._statement_number(records)
3683+ stmnt._opening_balance(records)
3684+ stmnt._closing_balance(records)
3685+ stmnt._forward_available(records)
3686+ stmnt._execution_date_transferred_amount (records)
3687+
3688+ #call the method statement_lines in parser to parse all the lines in file and add to stament. Receive the rows.
3689+ #pass the records to extract the currency (the currency is in the header file)
3690+ rows = table.iter() #extract all the rows in the file, when a iteration finish, must be reload the variable.
3691+ stmnt._transaction_new(records,rows)
3692+
3693+ '''
3694+ A stament must have a header and transacctions. The method parse_stamenent_record parse the header and the
3695+ method _transaction_new parse all the line (transactions) in the file.
3696+ '''
3697+
3698+ if stmnt.is_valid():
3699+ list_result.append(stmnt)
3700+
3701+ return list_result
3702+
3703+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3704
3705=== added file 'l10n_cr_account_banking_cr_lafise/lafise_parser.py'
3706--- l10n_cr_account_banking_cr_lafise/lafise_parser.py 1970-01-01 00:00:00 +0000
3707+++ l10n_cr_account_banking_cr_lafise/lafise_parser.py 2013-08-20 07:28:14 +0000
3708@@ -0,0 +1,339 @@
3709+# -*- coding: utf-8 -*-
3710+##############################################################################
3711+#
3712+# OpenERP, Open Source Management Solution
3713+# Addons modules by CLEARCORP S.A.
3714+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
3715+#
3716+# This program is free software: you can redistribute it and/or modify
3717+# it under the terms of the GNU Affero General Public License as
3718+# published by the Free Software Foundation, either version 3 of the
3719+# License, or (at your option) any later version.
3720+#
3721+# This program is distributed in the hope that it will be useful,
3722+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3723+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3724+# GNU Affero General Public License for more details.
3725+#
3726+# You should have received a copy of the GNU Affero General Public License
3727+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3728+#
3729+##############################################################################
3730+"""
3731+Parser for Lafise html format files
3732+"""
3733+import re
3734+from datetime import datetime
3735+from dateutil import parser
3736+from pprint import PrettyPrinter
3737+from copy import copy
3738+from tools.translate import _
3739+from osv import osv, fields
3740+
3741+class LafiseParser(object):
3742+
3743+ #Define the header for the extract to import.
3744+ '''
3745+ ** Kwargs parameter is used for a dynamic list of parameters.
3746+ The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
3747+ so get information from the wizard and passed by the ** kwargs.
3748+ Then in the parses that are needed, are extracted from the ** kwargs and if needed,
3749+ the parser still works the same way without this parameter.
3750+
3751+ The rest of the methods must receive this parameter. (As the method that parse the header and the lines).
3752+
3753+ If you need a new parameter, you specify its name and value, using the ** kwargs is a dictionary,
3754+ extract its value, with the respective key
3755+ '''
3756+
3757+ """
3758+ As the lafise file comes in a html format, the parameter rows is the file parser,
3759+ the values can be extracted with the property .text in the row.
3760+ For the header, extracted the account, currency, initial_balance, ending_balance.
3761+
3762+ It must iterate in the rows to obtain the values.
3763+ """
3764+
3765+ def statement_record ( self, rows, **kwargs):
3766+ lines = []
3767+ line_dict = {}
3768+ count = 1
3769+ currency_code = ''
3770+
3771+ line_dict = {
3772+ 'transref': '', # _transmission_number
3773+ 'account_number': '', #_account_number
3774+ 'statementnr':'', # statement_number
3775+ 'startingbalance': 0.0, #_opening_balance
3776+ 'currencycode': '', #currencycode
3777+ 'endingbalance': 0.0, #_closing_balance
3778+ 'bookingdate': '', #moving_date
3779+ 'ammount': 0.0,
3780+ 'id': '',
3781+ }
3782+ #transmission_number and bookingdate -> Date when make the extract import.
3783+ date_obj= datetime.now()
3784+ line_dict['transref'] = date_obj
3785+
3786+ #delete blank rows
3787+ for row in rows:
3788+ values = [col.text for col in row]
3789+ if len(values) > 0:
3790+ lines.append(values)
3791+
3792+ #lines is a list of lists.
3793+ #First, check if the account in the wizard match with the account in the file.
3794+ if self.match_account(lines, kwargs['account_number']):
3795+ #extract from the wizard the account
3796+ line_dict['account_number'] = kwargs['account_number']
3797+
3798+ for list in lines:
3799+ #currency_code in th file
3800+ if count == 4:
3801+ currency = list[4]
3802+
3803+ if "COL" in currency:
3804+ currency_code = 'CRC'
3805+
3806+ elif "USD" in currency:
3807+ currency_code = 'USD'
3808+
3809+ line_dict['currencycode'] = currency_code
3810+
3811+ #initial balance
3812+ if count == 16:
3813+ line_dict['startingbalance'] = self.extract_float(str(list[5]).replace(",",""))
3814+
3815+ #interrupted the cycle, because the information is complete for the header.
3816+ elif count >= 24:
3817+ break
3818+ count +=1
3819+
3820+ #statementnr
3821+ line_dict['statementnr'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + ' Extracto Lafise ' + line_dict['account_number'] #Interval time of the file.
3822+
3823+ #bookingdate
3824+ line_dict['bookingdate'] = date_obj
3825+
3826+ #id
3827+ line_dict['id'] = kwargs['date_from_str'] + ' - '+ kwargs['date_to_str'] + ' Extracto Lafise ' + line_dict['account_number']
3828+
3829+ #ending_balance
3830+ list = self.clean_special_characters_list(lines) #clean all the special characters and the rows without information
3831+ result = self.calculate_final_balance(list)
3832+ line_dict['endingbalance'] = float(line_dict['startingbalance']) - float(result['debit']) + float(result['credit'])
3833+
3834+ #amount
3835+ line_dict['ammount'] = float(line_dict['startingbalance']) + float(line_dict['endingbalance'])
3836+
3837+ return line_dict
3838+
3839+ else:
3840+ raise osv.except_osv(_('Error'),
3841+ _('Error en la importación! La cuenta especificada en el archivo no coincide con la seleccionada en el asistente de importacion'))
3842+
3843+ '''
3844+ Parse all the lines in the file. Once the header is parser, the next step are the lines.
3845+ '''
3846+ def statement_lines (self, records, rows):
3847+ parser = LafiseParser()
3848+ line_id = 1 #To distinct the lines, in the case of someone are repeat.
3849+
3850+ mapping = {
3851+ 'execution_date' : '',
3852+ 'effective_date' : '',
3853+ 'transfer_type' : '',
3854+ 'reference' : '',
3855+ 'message' : '',
3856+ 'name' : '',
3857+ 'transferred_amount': '',
3858+ 'creditmarker': '',
3859+ }
3860+
3861+ lines = clean_list = []
3862+ statements = []
3863+ currencycode = records['currencycode']
3864+ count = 1 #in line 18 start the statements.
3865+
3866+ #delete blank rows
3867+ for row in rows:
3868+ values = [col.text for col in row]
3869+ if len(values) > 0:
3870+ lines.append(values)
3871+
3872+ #clear lines of special characters
3873+ clean_list = self.clean_special_characters_list(lines)
3874+
3875+ for line in clean_list:
3876+ #effective_date
3877+ date_str = self.extract_date_regular_expresion(self.clean_special_characters(line[0]))
3878+ date = datetime.strptime(date_str, "%d/%m/%y")
3879+ mapping['effective_date'] = date #fecha_contable.
3880+
3881+ #execution_date
3882+ mapping['execution_date'] = date #fecha_movimiento
3883+
3884+ str_line = self.clean_special_characters(line[2]) + ' ID line: ' + str(line_id)
3885+
3886+ mapping['local_currency'] = currencycode
3887+ mapping['transfer_type'] = 'NTRF'
3888+ mapping['reference'] = self.extract_number(self.clean_special_characters(line[1]))
3889+ mapping['message'] = str_line
3890+ mapping['name'] = str_line
3891+ mapping['id'] = str_line
3892+
3893+ debit = float(self.extract_float(self.clean_special_characters(line[3])))
3894+ credit = float(self.extract_float(self.clean_special_characters(line[4])))
3895+
3896+ if (credit > 0.0): #in this case, credit is a input of money
3897+ mapping['transferred_amount'] = credit
3898+ mapping['creditmarker'] = 'C'
3899+
3900+ else: #debit is output
3901+ mapping['transferred_amount'] = -debit
3902+
3903+ statements.append(copy(mapping))
3904+ line_id += 1
3905+
3906+ return statements
3907+
3908+ """
3909+ ** Kwargs parameter is used for a dynamic list of parameters.
3910+ The wizard imported extracts used in all parsers and not all parsers have all the necessary information in your file,
3911+ so get information from the wizard and passed by the ** kwargs.
3912+ Then in the parses that are needed, are extracted from the ** kwargs and if needed,
3913+ the parser still works the same way without this parameter.
3914+
3915+ The rest of the methods must receive this parameter. (As the method that parse the header and the lines).
3916+
3917+ If you need a new parameter, you specify its name and value, using the ** kwargs is a dictionary,
3918+ extract its value, with the respective key
3919+ """
3920+ def parse_stamenent_record( self, rec, **kwargs):
3921+
3922+ matchdict = dict()
3923+
3924+ #Set the header for the stament.
3925+ matchdict = self.statement_record(rec, **kwargs);
3926+
3927+ return matchdict
3928+
3929+ def parse( self, cr, data ):
3930+ records = []
3931+ # Some records are multiline
3932+ for line in data:
3933+ if len(line) <= 1:
3934+ continue
3935+ if line[0] == ':' and len(line) > 1:
3936+ records.append(line)
3937+ else:
3938+ records[-1] = '\n'.join([records[-1], line])
3939+
3940+ output = []
3941+
3942+ for rec in records:
3943+ output.append( self.parse_stamenent_record( rec ) )
3944+
3945+ return output
3946+
3947+ ##################################<-AUXILIAR METHODS->####################################
3948+ def extract_number( self, account_number ):
3949+ cad = ''
3950+ result = re.findall(r'[0-9]+', account_number)
3951+
3952+ for character in result:
3953+ cad = cad + character
3954+ return cad
3955+
3956+ def extract_float ( self, ammount ):
3957+ cad = ''
3958+ result = re.findall(r"[-+]?\d*\.\d+|\d+",ammount)
3959+
3960+ for character in result:
3961+ cad = cad + character
3962+ return cad
3963+
3964+ def extract_date_regular_expresion(self, date):
3965+ cad = ''
3966+ result = []
3967+ date_string = ''
3968+ result = re.findall('[0-9]{1,2}/[0-9]{1,2}/[0-9]{2}', date)
3969+
3970+ for character in result:
3971+ cad = cad + character
3972+ return cad
3973+
3974+ #clear special characters in a specific celd.
3975+ def clean_special_characters(self, text_celd):
3976+ special_characters = {'\r\n':'','\t':''}
3977+
3978+ for i, j in special_characters.iteritems():
3979+ text = text_celd.replace(i, j)
3980+
3981+ #remove all the blank space.
3982+ #return re.sub(r'\s', '', text)
3983+ return text
3984+
3985+ #clear special characters in a specific row.
3986+ def clean_special_characters_list(self, lines):
3987+ new_row = list = []
3988+ special_characters = {'\r\n':'','\t':'','\r':'','\n':'','\\t':'','\t':''}
3989+ count = 1
3990+
3991+ for l in lines:
3992+ if (count >= 18): #in the line 18 start the statements
3993+ if len(list) == 0:
3994+ list = []
3995+
3996+ for celd in l:
3997+ if celd != None:
3998+ for i, j in special_characters.iteritems():
3999+ text = celd.replace(i, j)
4000+ text = re.sub(r'\t', '', text) #'\t' is the "tab" character
4001+
4002+ if text != '':
4003+ new_row.append(text)
4004+
4005+ if len(new_row) > 0:
4006+ list.append(new_row) #list containt all the rows clean
4007+ new_row = []
4008+
4009+ count +=1
4010+
4011+ return list
4012+
4013+ #Return true if the account selected in the wizard match with the account in the file.
4014+ def match_account(self, lines, account_wizard):
4015+ count = 1
4016+ acc_number = ''
4017+ for list in lines:
4018+ if count == 4:
4019+ acc_number= self.extract_number(list[1])
4020+ break
4021+ else:
4022+ count +=1
4023+
4024+ if acc_number.find(account_wizard) > -1:
4025+ return True
4026+
4027+ else:
4028+ return False
4029+
4030+ #List is the list of the statements, the method calculate the final_balance
4031+ #with the debit and credit
4032+ def calculate_final_balance(self, list):
4033+ result = {'debit': 0.0, 'credit':0.0}
4034+ total_debit = total_credit = 0.0
4035+
4036+ for line in list:
4037+ debit = float(self.extract_float(self.clean_special_characters(line[3])))
4038+ credit = float(self.extract_float(self.clean_special_characters(line[4])))
4039+
4040+ total_debit += debit
4041+ total_credit += credit
4042+
4043+ result ['debit'] = total_debit
4044+ result ['credit'] = total_credit
4045+
4046+ return result
4047+
4048\ No newline at end of file
4049
4050=== added directory 'l10n_cr_account_banking_reports'
4051=== added directory 'l10n_cr_account_banking_reports/report'
4052=== added file 'l10n_cr_account_banking_reports/report/conciliation_bank.py.OTHER'
4053--- l10n_cr_account_banking_reports/report/conciliation_bank.py.OTHER 1970-01-01 00:00:00 +0000
4054+++ l10n_cr_account_banking_reports/report/conciliation_bank.py.OTHER 2013-08-20 07:28:14 +0000
4055@@ -0,0 +1,420 @@
4056+# -*- coding: utf-8 -*-
4057+##############################################################################
4058+#
4059+# OpenERP, Open Source Management Solution
4060+# Addons modules by CLEARCORP S.A.
4061+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
4062+#
4063+# This program is free software: you can redistribute it and/or modify
4064+# it under the terms of the GNU Affero General Public License as
4065+# published by the Free Software Foundation, either version 3 of the
4066+# License, or (at your option) any later version.
4067+#
4068+# This program is distributed in the hope that it will be useful,
4069+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4070+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4071+# GNU Affero General Public License for more details.
4072+#
4073+# You should have received a copy of the GNU Affero General Public License
4074+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4075+#
4076+##############################################################################
4077+
4078+import time
4079+from report import report_sxw
4080+from tools.translate import _
4081+import pooler
4082+from datetime import datetime
4083+
4084+from openerp.addons.account_financial_report_webkit.report.common_reports import CommonReportHeaderWebkit
4085+from openerp.addons.account_financial_report_webkit.report.partners_ledger import PartnersLedgerWebkit
4086+
4087+class conciliation_bank(report_sxw.rml_parse, CommonReportHeaderWebkit):
4088+
4089+ def __init__(self, cursor, uid, name, context):
4090+ super(conciliation_bank, self).__init__(cursor, uid, name, context=context)
4091+ self.pool = pooler.get_pool(self.cr.dbname)
4092+ self.cursor = self.cr
4093+
4094+ self.localcontext.update({
4095+ 'time': time,
4096+ 'cr' : cursor,
4097+ 'uid': uid,
4098+ 'get_amount': self.get_amount,
4099+ 'get_bank_data': self.get_bank_data,
4100+ 'get_bank_account': self.get_bank_account,
4101+ 'filter_form': self._get_filter,
4102+ 'display_target_move': self._get_display_target_move,
4103+ })
4104+
4105+ def set_context(self, objects, data, ids, report_type=None):
4106+ main_filter = self._get_form_param('filter', data, default='filter_no')
4107+ target_move = self._get_form_param('target_move', data, default='all')
4108+ start_date = self._get_form_param('date_from', data)
4109+ stop_date = self._get_form_param('date_to', data)
4110+ input_bank_balance = self._get_form_param('bank_balance', data)
4111+ start_period = self.get_start_period_br(data)
4112+ stop_period = self.get_end_period_br(data)
4113+ fiscalyear = self.get_fiscalyear_br(data)
4114+ chart_account = self._get_chart_account_id_br(data)
4115+
4116+ if main_filter == 'filter_no' and fiscalyear:
4117+ start_period = self.get_first_fiscalyear_period(fiscalyear)
4118+ stop_period = self.get_last_fiscalyear_period(fiscalyear)
4119+ elif main_filter == 'filter_date':
4120+ start = start_date
4121+ stop = stop_date
4122+ else:
4123+ start = start_period
4124+ stop = stop_period
4125+
4126+ self.localcontext.update({
4127+ 'fiscalyear': fiscalyear,
4128+ 'start_date': start_date,
4129+ 'stop_date': stop_date,
4130+ 'start_period': start_period,
4131+ 'stop_period': stop_period,
4132+ 'target_move': target_move,
4133+ 'input_bank_balance': input_bank_balance,
4134+ 'chart_account': chart_account,
4135+
4136+ })
4137+
4138+ return super(conciliation_bank, self).set_context(objects, data, ids,
4139+ report_type=report_type)
4140+
4141+ def get_amount(self,cr, uid, account_move_line, currency):
4142+ account_obj = self.pool.get('account.account').browse(cr,uid,account_move_line.account_id.id)
4143+
4144+ obj_invoice = self.pool.get('account.invoice')
4145+ invoice_search = obj_invoice.search(cr,uid,[('move_id','=',account_move_line.move_id.id)])
4146+ invoice = None
4147+ if invoice_search != []:
4148+ invoice = obj_invoice.browse(cr,uid,invoice_search[0])
4149+
4150+ obj_voucher = self.pool.get('account.voucher')
4151+ voucher_search = obj_voucher.search(cr,uid,[('move_id','=',account_move_line.move_id.id)])
4152+
4153+ voucher = None
4154+ if voucher_search != []:
4155+ voucher = obj_voucher.browse(cr,uid,voucher_search[0])
4156+
4157+ res = ('none', 0.0, 0.0)
4158+
4159+ amount = 0.0
4160+ if currency != False:
4161+ amount = account_move_line.amount_currency
4162+ else:
4163+ if account_move_line.debit != 0.0 :
4164+ amount = account_move_line.debit
4165+ elif account_move_line.credit != 0.0 :
4166+ amount = account_move_line.credit * -1
4167+
4168+ # Invoices
4169+ if invoice:
4170+ if invoice.type == 'out_invoice': # Customer Invoice
4171+ res = ('invoice', amount)
4172+ elif invoice.type == 'in_invoice': # Supplier Invoice
4173+ res = ('invoice', amount)
4174+ elif invoice.type == 'in_refund': # Debit Note
4175+ res = ('debit', amount)
4176+ elif invoice.type == 'out_refund': # Credit Note
4177+ res = ('credit', amount)
4178+ # Vouchers
4179+ elif voucher:
4180+ if voucher.type == 'payment': # Payment
4181+ res = ('payment', amount)
4182+ elif voucher.type == 'sale': # Invoice
4183+ res = ('invoice', amount)
4184+ elif voucher.type == 'receipt': # Payment
4185+ res = ('payment', amount)
4186+ # Debit o Credit
4187+ else:
4188+ if amount > 0.0:
4189+ res = ('debit', amount)
4190+ else:
4191+ res = ('credit', amount)
4192+
4193+
4194+ if res[1] == None or (currency != None and res[1] == 0.0):
4195+ secundary_amount = (account_move_line.debit != 0.0) and account_move_line.debit or account_move_line.credit
4196+ res = (res[0], 0.0, secundary_amount)
4197+ else:
4198+ res = (res[0], res[1], None)
4199+
4200+ return res
4201+
4202+ def get_bank_data(self, cr, uid, parent_account_id, filter_type, filter_data, fiscalyear, target_move, historic_strict, special_period, context=None):
4203+ result_bank_balance = {}
4204+ result_move_lines = []
4205+ filters = {}
4206+
4207+ account_obj = self.pool.get('account.account')
4208+ account_webkit_report_library_obj = self.pool.get('account.webkit.report.library')
4209+ parent_account = account_obj.browse(cr, uid, parent_account_id)
4210+ child_account_ids = account_obj.search(cr, uid, [('parent_id','=',parent_account_id)])
4211+ child_accounts = child_account_ids and account_obj.browse(cr, uid, child_account_ids) or False
4212+
4213+ if not child_accounts:
4214+ return result_bank_balance, result_move_lines, account_foreign
4215+
4216+ if parent_account.report_currency_id:
4217+ account_currency = parent_account.report_currency_id
4218+ elif parent_account.currency_id:
4219+ account_currency = parent_account.currency_id
4220+ else:
4221+ account_currency = parent_account.company_id.currency_id
4222+ if account_currency.id == parent_account.company_id.currency_id.id:
4223+ account_is_foreign = False
4224+ else:
4225+ account_is_foreign = True
4226+
4227+ reconciled_account = None
4228+ transit_accounts = []
4229+ transit_account_ids = []
4230+ for child_account in child_accounts:
4231+ #TODO: get the user types for the reconciled_account from system properties
4232+ if child_account.user_type.code == 'BKRE':
4233+ reconciled_account = child_account
4234+ else:
4235+ if child_account.reconcile:
4236+ transit_accounts.append(child_account)
4237+ transit_account_ids.append(child_account.id)
4238+
4239+ #A reconciled_account and at least one transit_account is needed
4240+ if not (reconciled_account or transit_accounts):
4241+ return result_bank_balance, result_move_lines, account_foreign
4242+
4243+ #TODO: set input_bank_balance with data from wizard
4244+ input_bank_balance = 0.0
4245+ bank_balance = 0.0
4246+ accounting_balance = 0.0
4247+ incomes_to_register = 0.0
4248+ credits_to_reconcile = 0.0
4249+ expenditures_to_register = 0.0
4250+ debits_to_reconcile = 0.0
4251+ accounting_total = 0.0
4252+ bank_total = 0.0
4253+
4254+ fiscal_year_id = fiscalyear.id
4255+
4256+ if filter_type == 'filter_date':
4257+ end_period = False
4258+ end_date = filter_data[1]
4259+
4260+ elif filter_type == 'filter_period':
4261+ end_period = filter_data[1]
4262+ end_date = False
4263+
4264+ #TODO: Set the max date or period list for the balance query from the wizard data
4265+ # If the wizard is filtered by date, the max date is entered as is
4266+ # If the wizard is filtered by period, the query needs the valid list of periods in a WHERE statement form
4267+ balance_query_filter = ''
4268+
4269+ if account_is_foreign:
4270+
4271+ bank_balance = account_webkit_report_library_obj.get_account_balance(cr,
4272+ uid,
4273+ [reconciled_account.id],
4274+ ['foreign_balance'],
4275+ end_date=end_date,
4276+ end_period_id=end_period.id,
4277+ fiscal_year_id=fiscal_year_id,
4278+ filter_type=filter_type,
4279+ context=context)[reconciled_account.id]['foreign_balance']
4280+
4281+ accounting_balance = account_webkit_report_library_obj.get_account_balance(cr,
4282+ uid,
4283+ [parent_account_id],
4284+ ['foreign_balance'],
4285+ end_date=end_date,
4286+ end_period_id=end_period.id,
4287+ fiscal_year_id=fiscal_year_id,
4288+ filter_type = filter_type,
4289+ context=context)[parent_account_id]['foreign_balance']
4290+ else:
4291+ bank_balance = account_webkit_report_library_obj.get_account_balance(cr,
4292+ uid,
4293+ [reconciled_account.id],
4294+ ['balance'],
4295+ end_date=end_date,
4296+ end_period_id=end_period.id,
4297+ fiscal_year_id=fiscal_year_id,
4298+ filter_type = filter_type,
4299+ context=context)[reconciled_account.id]['balance']
4300+ accounting_balance = account_webkit_report_library_obj.get_account_balance(cr,
4301+ uid,
4302+ [parent_account_id],
4303+ ['balance'],
4304+ end_date=end_date,
4305+ end_period_id=end_period.id,
4306+ fiscal_year_id=fiscal_year_id,
4307+ filter_type = filter_type,
4308+ context=context)[parent_account_id]['balance']
4309+
4310+ '''
4311+ bank_balance = reconciled_account.foreign_balance
4312+ accounting_balance = parent_account.foreign_balance
4313+ else:
4314+ bank_balance = reconciled_account.balance
4315+ accounting_balance = parent_account.balance
4316+ '''
4317+
4318+ move_obj = self.pool.get('account.move')
4319+ move_line_obj = self.pool.get('account.move.line')
4320+
4321+ """
4322+ Cambio realizado el 9 de enero de 2012
4323+
4324+ Anteriormente, el método get_move_lines (del objeto account.webkit.report.library, librería estándar de los reportes,
4325+ sólo se utilizaba en el reporte de Conciliación bancaria. El reporte de conciliación bancaria no recibe el período de inicio
4326+ por lo que el método de get_move_lines no contempla el período de inicio, necesario en el reporte de saldo de cuenta de bancos.
4327+ Se realiza el cambio tanto en el reporte de conciliación bancaria para que el período inicial no se tome en cuenta (inicializado en None)
4328+ y en la librería se especifica que si se encuentra en None no lo tome en cuenta y que si trae información lo utilice dentro del filtro
4329+ para sacar el rango de periodos que se digita en el wizard.
4330+
4331+ Se modifica tanto el reporte de conciliación bancaria, como la librería, para que el método funcione solamente con un período final o bien
4332+ con un rango de períodos, como trabaja el reporte de saldo de cuenta de bancos.
4333+
4334+ Para el caso de las fechas, se trabaja de la misma forma. (El saldo de cuentas de bancos si toma la fecha de inicio)
4335+
4336+ OBSERVACIÓN -> data['form']['historic_strict'],las variables boleanas (historic_strict y special_period) se deben pasar
4337+ de esta forma, sino vienen como objetos y no con el valor real (True or False). Esto se hace desde el conciliation_bank.mako
4338+
4339+ """
4340+ filter_data[0] = None
4341+ unreconciled_move_lines = account_webkit_report_library_obj.get_move_lines(cr, uid, transit_account_ids, filter_type=filter_type, filter_data=filter_data, fiscalyear=fiscalyear, target_move=target_move, unreconcile = True, historic_strict=historic_strict, special_period=special_period, context=context)
4342+
4343+ result_move_lines = {
4344+ 'credits_to_reconcile' : [],
4345+ 'debits_to_reconcile' : [],
4346+ 'incomes_to_register' : [],
4347+ 'expenditures_to_register' : [],
4348+ }
4349+ for line in unreconciled_move_lines:
4350+ move = line.move_id
4351+ if not move:
4352+ if account_is_foreign:
4353+ if line.amount_currency > 0:
4354+ result_move_lines['incomes_to_register'].append(line)
4355+ incomes_to_register += line.amount_currency
4356+ else:
4357+ result_move_lines['expenditures_to_register'].append(line)
4358+ expenditures_to_register -= line.amount_currency
4359+ else:
4360+ if line.debit > 0:
4361+ result_move_lines['incomes_to_register'].append(line)
4362+ incomes_to_register += line.debit
4363+ else:
4364+ result_move_lines['expenditures_to_register'].append(line)
4365+ expenditures_to_register += line.credit
4366+ print "No move"
4367+ continue
4368+
4369+ #Select the best contra move line (biggest amount, inverse amount from line)
4370+ contra_line = line
4371+ for other_line in move.line_id:
4372+ if other_line.id == line.id:
4373+ continue
4374+ elif other_line.debit == line.credit or other_line.credit == line.debit:
4375+ contra_line = other_line
4376+ break
4377+ elif account_is_foreign and (other_line.amount_currency == -1 * line.amount_currency):
4378+ contra_line = other_line
4379+ break
4380+ if (line.debit != 0 and contra_line.credit > other_line.credit) or \
4381+ (line.credit != 0 and contra_line.debit < other_line.debit):
4382+ contra_line = other_line
4383+ elif (account_is_foreign and
4384+ (
4385+ (line.amount_currency > 0 and
4386+ contra_line.amount_currency < other_line.amount_currency)
4387+ or
4388+ (line.amount_currency <= 0 and
4389+ contra_line.amount_currency > other_line.amount_currency)
4390+ )
4391+ ):
4392+ contra_line = other_line
4393+
4394+ if line.id == contra_line.id:
4395+ if account_is_foreign:
4396+ if line.amount_currency > 0:
4397+ result_move_lines['incomes_to_register'].append(line)
4398+ incomes_to_register += line.amount_currency
4399+ else:
4400+ result_move_lines['expenditures_to_register'].append(line)
4401+ expenditures_to_register -= line.amount_currency
4402+ else:
4403+ if line.debit > 0:
4404+ result_move_lines['incomes_to_register'].append(line)
4405+ incomes_to_register += line.debit
4406+ else:
4407+ result_move_lines['expenditures_to_register'].append(line)
4408+ expenditures_to_register += line.credit
4409+ else:
4410+ #Debit or credit to register: present in statement but not in other accounts
4411+ if contra_line.account_id.id == reconciled_account.id:
4412+ if account_is_foreign:
4413+ if line.amount_currency < 0:
4414+ result_move_lines['incomes_to_register'].append(line)
4415+ incomes_to_register -= line.amount_currency
4416+ else:
4417+ result_move_lines['expenditures_to_register'].append(line)
4418+ expenditures_to_register += line.amount_currency
4419+ else:
4420+ if line.credit > 0:
4421+ result_move_lines['incomes_to_register'].append(line)
4422+ incomes_to_register += line.credit
4423+ else:
4424+ result_move_lines['expenditures_to_register'].append(line)
4425+ expenditures_to_register += line.debit
4426+ #Debit or credit to reconcile: present in other accounts but not in statements
4427+ else:
4428+ if account_is_foreign:
4429+ if line.amount_currency > 0:
4430+ result_move_lines['credits_to_reconcile'].append(line)
4431+ credits_to_reconcile += line.amount_currency
4432+ else:
4433+ result_move_lines['debits_to_reconcile'].append(line)
4434+ debits_to_reconcile -= line.amount_currency
4435+ else:
4436+ if line.debit > 0:
4437+ result_move_lines['credits_to_reconcile'].append(line)
4438+ credits_to_reconcile += line.debit
4439+ else:
4440+ result_move_lines['debits_to_reconcile'].append(line)
4441+ debits_to_reconcile += line.credit
4442+
4443+ accounting_total = accounting_balance + incomes_to_register - expenditures_to_register
4444+ bank_total = bank_balance + credits_to_reconcile - debits_to_reconcile
4445+
4446+ result_bank_balance = {
4447+ 'input_bank_balance' : input_bank_balance,
4448+ 'bank_balance' : bank_balance,
4449+ 'accounting_balance' : accounting_balance,
4450+ 'incomes_to_register' : incomes_to_register,
4451+ 'credits_to_reconcile' : credits_to_reconcile,
4452+ 'expenditures_to_register' : expenditures_to_register,
4453+ 'debits_to_reconcile' : debits_to_reconcile,
4454+ 'accounting_total' : accounting_total,
4455+ 'bank_total' : bank_total,
4456+ }
4457+
4458+ #special_period = historic_strict = False
4459+
4460+ return result_bank_balance, result_move_lines, account_is_foreign
4461+
4462+ def get_bank_account(self, cr, uid, data):
4463+ info = data.get('form', {}).get('bank_account_ids')
4464+ if info:
4465+ bank_account = self.pool.get('account.account').browse(cr, uid, info[0])
4466+ return bank_account
4467+ return False
4468+
4469+
4470+report_sxw.report_sxw(
4471+ 'report.account_financial_report_webkit.account.account_report_conciliation_bank_webkit',
4472+ 'account.account',
4473+ 'addons/l10n_cr_account_banking_reports/report/conciliation_bank.mako',
4474+ parser=conciliation_bank)
4475+
4476
4477=== added directory 'l10n_cr_account_banking_reports/wizard'
4478=== added file 'l10n_cr_account_banking_reports/wizard/conciliation_bank_wizard.xml.OTHER'
4479--- l10n_cr_account_banking_reports/wizard/conciliation_bank_wizard.xml.OTHER 1970-01-01 00:00:00 +0000
4480+++ l10n_cr_account_banking_reports/wizard/conciliation_bank_wizard.xml.OTHER 2013-08-20 07:28:14 +0000
4481@@ -0,0 +1,73 @@
4482+<?xml version="1.0" encoding="utf-8"?>
4483+<openerp>
4484+ <data>
4485+
4486+ <record id="conciliation_bank_view_webkit" model="ir.ui.view">
4487+ <field name="name">Conciliation Bank</field>
4488+ <field name="model">conciliation.bank.webkit</field>
4489+ <field name="type">form</field>
4490+ <field name="inherit_id" ref="account.account_common_report_view"/>
4491+ <field name="arch" type="xml">
4492+ <data>
4493+ <xpath expr="/form/label[@string='']" position="replace">
4494+ <separator string="Conciliation Bank" colspan="4"/>
4495+ <label nolabel="1" colspan="4" string="This report allows you to print or generate a pdf of your partner ledger with details of all your payable/receivable account"/>
4496+ </xpath>
4497+ <field name="target_move" position="after">
4498+ <field name="historic_strict"></field>
4499+ </field>
4500+ <field name="chart_account_id" position='attributes'>
4501+ <attribute name="colspan">4</attribute>
4502+ </field>
4503+ <field name="chart_account_id" position='after'>
4504+ <field name="bank_account_ids" required = 'True'/>
4505+ <field name="bank_balance" required = 'True'/>
4506+ </field>
4507+ <page name="filters" position="attributes">
4508+ <attribute name="string">Time Filters</attribute>
4509+ </page>
4510+ <page name="journal_ids" position="attributes">
4511+ <attribute name="invisible">True</attribute>
4512+ </page>
4513+ <field name="date_from" position="replace">
4514+ <field name="date_from" invisible="1" required = "False" attrs="{'readonly':[('filter', '!=', 'filter_date')]}" colspan="4"/>
4515+ </field>
4516+ <field name="period_from" position="replace">
4517+ <field name="period_from" invisible="1" required = "False" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')]}" colspan="4"/>
4518+ </field>
4519+ <field name="period_to" position="attributes">
4520+ <attribute name="domain">[('fiscalyear_id', '=', fiscalyear_id), ('special', '=', False)]</attribute>
4521+ </field>
4522+ <field name="period_to" position="after">
4523+ <field name="special_period" attrs="{'readonly':[('filter', '!=', 'filter_period')]}"></field>
4524+ </field>
4525+ <field name="fiscalyear_id" position="attributes">
4526+ <attribute name="required">1</attribute>
4527+ </field>
4528+ </data>
4529+ </field>
4530+ </record>
4531+
4532+ <record id="action_conciliation_bank_menu_webkit" model="ir.actions.act_window">
4533+ <field name="name">Conciliation Bank</field>
4534+ <field name="type">ir.actions.act_window</field>
4535+ <field name="res_model">conciliation.bank.webkit</field>
4536+ <field name="view_type">form</field>
4537+ <field name="view_mode">form</field>
4538+ <field name="view_id" ref="conciliation_bank_view_webkit"/>
4539+ <field name="target">new</field>
4540+ </record>
4541+
4542+ <record model="ir.values" id="action_account_conciliation_bank_values_webkit">
4543+ <field name="model_id" ref="account.model_account_account"/>
4544+ <field name="object" eval="1"/>
4545+ <field name="name">Conciliation Bank</field>
4546+ <field name="key2">client_print_multi</field>
4547+ <field name="value"
4548+ eval="'ir.actions.act_window,' +str(ref('action_conciliation_bank_menu_webkit'))"/>
4549+ <field name="key">action</field>
4550+ <field name="model">account.account</field>
4551+ </record>
4552+
4553+ </data>
4554+</openerp>
4555
4556=== added directory 'l10n_cr_account_financial_report_open_invoices'
4557=== added file 'l10n_cr_account_financial_report_open_invoices/__init__.py'
4558--- l10n_cr_account_financial_report_open_invoices/__init__.py 1970-01-01 00:00:00 +0000
4559+++ l10n_cr_account_financial_report_open_invoices/__init__.py 2013-08-20 07:28:14 +0000
4560@@ -0,0 +1,26 @@
4561+# -*- coding: utf-8 -*-
4562+##############################################################################
4563+#
4564+# OpenERP, Open Source Management Solution
4565+# Addons modules by CLEARCORP S.A.
4566+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
4567+#
4568+# This program is free software: you can redistribute it and/or modify
4569+# it under the terms of the GNU Affero General Public License as
4570+# published by the Free Software Foundation, either version 3 of the
4571+# License, or (at your option) any later version.
4572+#
4573+# This program is distributed in the hope that it will be useful,
4574+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4575+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4576+# GNU Affero General Public License for more details.
4577+#
4578+# You should have received a copy of the GNU Affero General Public License
4579+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4580+#
4581+##############################################################################
4582+
4583+import account
4584+import wizard
4585+import report
4586+
4587
4588=== added file 'l10n_cr_account_financial_report_open_invoices/__openerp__.py'
4589--- l10n_cr_account_financial_report_open_invoices/__openerp__.py 1970-01-01 00:00:00 +0000
4590+++ l10n_cr_account_financial_report_open_invoices/__openerp__.py 2013-08-20 07:28:14 +0000
4591@@ -0,0 +1,43 @@
4592+# -*- coding: utf-8 -*-
4593+##############################################################################
4594+#
4595+# OpenERP, Open Source Management Solution
4596+# Addons modules by CLEARCORP S.A.
4597+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
4598+#
4599+# This program is free software: you can redistribute it and/or modify
4600+# it under the terms of the GNU Affero General Public License as
4601+# published by the Free Software Foundation, either version 3 of the
4602+# License, or (at your option) any later version.
4603+#
4604+# This program is distributed in the hope that it will be useful,
4605+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4606+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4607+# GNU Affero General Public License for more details.
4608+#
4609+# You should have received a copy of the GNU Affero General Public License
4610+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4611+#
4612+##############################################################################
4613+
4614+
4615+{
4616+ 'name': 'Webkit based extended report financial report',
4617+ 'description': "",
4618+ 'version': '1.0',
4619+ 'author': 'CLEARCORP S.A.',
4620+ 'category': 'Finance',
4621+ 'website': "http://clearcorp.co.cr",
4622+ 'images': [],
4623+ 'depends': ['account','account_financial_report_webkit'],
4624+ 'init_xml': [],
4625+ 'demo_xml' : [],
4626+ 'update_xml': ['report/report.xml',
4627+ 'wizard/l10n_cr_account_report_open_invoices_wizard_view.xml',
4628+ 'report_menus.xml',
4629+ ],
4630+ 'test': [],
4631+ 'active': False,
4632+ 'installable': True,
4633+ 'license': 'AGPL-3',
4634+}
4635
4636=== added directory 'l10n_cr_account_financial_report_open_invoices/i18n'
4637=== added file 'l10n_cr_account_financial_report_open_invoices/i18n/es_CR.po'
4638--- l10n_cr_account_financial_report_open_invoices/i18n/es_CR.po 1970-01-01 00:00:00 +0000
4639+++ l10n_cr_account_financial_report_open_invoices/i18n/es_CR.po 2013-08-20 07:28:14 +0000
4640@@ -0,0 +1,225 @@
4641+# Translation of OpenERP Server.
4642+# This file contains the translation of the following modules:
4643+# * l10n_cr_account_financial_report_open_invoices
4644+#
4645+msgid ""
4646+msgstr ""
4647+"Project-Id-Version: OpenERP Server 6.1\n"
4648+"Report-Msgid-Bugs-To: \n"
4649+"POT-Creation-Date: 2013-04-01 20:34+0000\n"
4650+"PO-Revision-Date: 2013-04-01 20:34+0000\n"
4651+"Last-Translator: <>\n"
4652+"Language-Team: \n"
4653+"MIME-Version: 1.0\n"
4654+"Content-Type: text/plain; charset=UTF-8\n"
4655+"Content-Transfer-Encoding: \n"
4656+"Plural-Forms: \n"
4657+
4658+#. module: l10n_cr_account_financial_report_open_invoices
4659+#: constraint:open.invoices.webkit:0
4660+msgid "When no Fiscal year is selected, you must choose to filter by periods or by date."
4661+msgstr "Cuando no se selecciona ningún año fiscal, se debe elegir para filtrar por períodos o por fecha."
4662+
4663+#. module: l10n_cr_account_financial_report_open_invoices
4664+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:23
4665+msgid "No"
4666+msgstr "No"
4667+
4668+#. module: l10n_cr_account_financial_report_open_invoices
4669+#: view:open.invoices.webkit:0
4670+msgid "Layout Options"
4671+msgstr "Opciones de Diseño"
4672+
4673+#. module: l10n_cr_account_financial_report_open_invoices
4674+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:145
4675+msgid "Curr."
4676+msgstr "Curr."
4677+
4678+#. module: l10n_cr_account_financial_report_open_invoices
4679+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:126
4680+msgid "Label"
4681+msgstr "Etiqueta"
4682+
4683+#. module: l10n_cr_account_financial_report_open_invoices
4684+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:136
4685+msgid "Debit"
4686+msgstr "Débito"
4687+
4688+#. module: l10n_cr_account_financial_report_open_invoices
4689+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:39
4690+msgid "Initial Balance"
4691+msgstr "Balance inicial"
4692+
4693+#. module: l10n_cr_account_financial_report_open_invoices
4694+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:122
4695+msgid "Journal"
4696+msgstr "Diario"
4697+
4698+#. module: l10n_cr_account_financial_report_open_invoices
4699+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:303
4700+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:362
4701+msgid "Saldo"
4702+msgstr "Saldo"
4703+
4704+#. module: l10n_cr_account_financial_report_open_invoices
4705+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:118
4706+msgid "Period"
4707+msgstr "Período"
4708+
4709+#. module: l10n_cr_account_financial_report_open_invoices
4710+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:114
4711+msgid "Date"
4712+msgstr "Fecha"
4713+
4714+#. module: l10n_cr_account_financial_report_open_invoices
4715+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:28
4716+msgid "Chart of Account"
4717+msgstr "Catálogo de cuentas"
4718+
4719+#. module: l10n_cr_account_financial_report_open_invoices
4720+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:38
4721+msgid "Target Moves"
4722+msgstr "Movimientos destino"
4723+
4724+#. module: l10n_cr_account_financial_report_open_invoices
4725+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:45
4726+msgid "From:"
4727+msgstr "Desde:"
4728+
4729+#. module: l10n_cr_account_financial_report_open_invoices
4730+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:51
4731+msgid "To:"
4732+msgstr "Hasta:"
4733+
4734+#. module: l10n_cr_account_financial_report_open_invoices
4735+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:116
4736+msgid "Due Date"
4737+msgstr "Due Date"
4738+
4739+#. module: l10n_cr_account_financial_report_open_invoices
4740+#: constraint:open.invoices.webkit:0
4741+msgid "The fiscalyear, periods or chart of account chosen have to belong to the same company."
4742+msgstr "El año fiscal, períodos o plan contable elegidos deben pertenecer a la misma compañía."
4743+
4744+#. module: l10n_cr_account_financial_report_open_invoices
4745+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:134
4746+msgid "Credit"
4747+msgstr "Crédito"
4748+
4749+#. module: l10n_cr_account_financial_report_open_invoices
4750+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:29
4751+msgid "Fiscal Year"
4752+msgstr "Año fiscal"
4753+
4754+#. module: l10n_cr_account_financial_report_open_invoices
4755+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:37
4756+msgid "Accounts Filter"
4757+msgstr "Filtro de cuentas"
4758+
4759+#. module: l10n_cr_account_financial_report_open_invoices
4760+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:138
4761+msgid "Manual Move"
4762+msgstr "Movimiento manual"
4763+
4764+#. module: l10n_cr_account_financial_report_open_invoices
4765+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:120
4766+msgid "Entry"
4767+msgstr "Apunte"
4768+
4769+#. module: l10n_cr_account_financial_report_open_invoices
4770+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:60
4771+msgid "Custom Filter"
4772+msgstr "Filtro personalizado"
4773+
4774+#. module: l10n_cr_account_financial_report_open_invoices
4775+#: code:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.py:64
4776+#, python-format
4777+msgid "Page"
4778+msgstr "Página"
4779+
4780+#. module: l10n_cr_account_financial_report_open_invoices
4781+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:74
4782+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:76
4783+msgid "Accounts in "
4784+msgstr "Cuentas en "
4785+
4786+#. module: l10n_cr_account_financial_report_open_invoices
4787+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:140
4788+msgid "Cumul. Bal."
4789+msgstr "Bal. Acuml."
4790+
4791+#. module: l10n_cr_account_financial_report_open_invoices
4792+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:128
4793+msgid "Rec."
4794+msgstr "Rec."
4795+
4796+#. module: l10n_cr_account_financial_report_open_invoices
4797+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:23
4798+msgid "Computed"
4799+msgstr "Computed"
4800+
4801+#. module: l10n_cr_account_financial_report_open_invoices
4802+#: code:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.py:64
4803+#, python-format
4804+msgid "of"
4805+msgstr "de"
4806+
4807+#. module: l10n_cr_account_financial_report_open_invoices
4808+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:34
4809+msgid "Periods Filter"
4810+msgstr "Filtro de períodos"
4811+
4812+#. module: l10n_cr_account_financial_report_open_invoices
4813+#: code:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.py:55
4814+#: model:ir.actions.act_window,name:l10n_cr_account_financial_report_open_invoices.action_account_open_invoices_menu_webkit
4815+#: model:ir.model,name:l10n_cr_account_financial_report_open_invoices.model_open_invoices_webkit
4816+#, python-format
4817+msgid "Open Invoices Report"
4818+msgstr "Reporte de Facturas Pendientes"
4819+
4820+#. module: l10n_cr_account_financial_report_open_invoices
4821+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:32
4822+msgid "Dates Filter"
4823+msgstr "Filtro de fechas"
4824+
4825+#. module: l10n_cr_account_financial_report_open_invoices
4826+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:109
4827+msgid "No Partner"
4828+msgstr "Sin compañía"
4829+
4830+#. module: l10n_cr_account_financial_report_open_invoices
4831+#: code:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.py:49
4832+#, python-format
4833+msgid "OPEN INVOICES REPORT"
4834+msgstr "REPORTE DE FACTURAS PENDIENTES"
4835+
4836+#. module: l10n_cr_account_financial_report_open_invoices
4837+#: constraint:open.invoices.webkit:0
4838+msgid "Clearance date must be the very last date of the last period or later."
4839+msgstr "Fecha de Liquidación debe ser la última fecha del último período o después de este."
4840+
4841+#. module: l10n_cr_account_financial_report_open_invoices
4842+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:130
4843+msgid "Invoice"
4844+msgstr "Factura"
4845+
4846+#. module: l10n_cr_account_financial_report_open_invoices
4847+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:124
4848+msgid "Partner"
4849+msgstr "Compañía"
4850+
4851+#. module: l10n_cr_account_financial_report_open_invoices
4852+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:132
4853+msgid "Payments"
4854+msgstr "Pagos"
4855+
4856+#. module: l10n_cr_account_financial_report_open_invoices
4857+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:143
4858+msgid "Curr. Balance"
4859+msgstr "Curr. Balance"
4860+
4861+#. module: l10n_cr_account_financial_report_open_invoices
4862+#: report:addons/l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako:23
4863+msgid "Opening Entries"
4864+msgstr "Opening Entries"
4865+
4866
4867=== added directory 'l10n_cr_account_financial_report_open_invoices/report'
4868=== added file 'l10n_cr_account_financial_report_open_invoices/report/__init__.py'
4869--- l10n_cr_account_financial_report_open_invoices/report/__init__.py 1970-01-01 00:00:00 +0000
4870+++ l10n_cr_account_financial_report_open_invoices/report/__init__.py 2013-08-20 07:28:14 +0000
4871@@ -0,0 +1,22 @@
4872+# -*- coding: utf-8 -*-
4873+##############################################################################
4874+#
4875+# OpenERP, Open Source Management Solution
4876+# Addons modules by CLEARCORP S.A.
4877+# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
4878+#
4879+# This program is free software: you can redistribute it and/or modify
4880+# it under the terms of the GNU Affero General Public License as
4881+# published by the Free Software Foundation, either version 3 of the
4882+# License, or (at your option) any later version.
4883+#
4884+# This program is distributed in the hope that it will be useful,
4885+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4886+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4887+# GNU Affero General Public License for more details.
4888+#
4889+# You should have received a copy of the GNU Affero General Public License
4890+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4891+#
4892+##############################################################################
4893+import l10n_cr_account_report_open_invoices
4894\ No newline at end of file
4895
4896=== added file 'l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako'
4897--- l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako 1970-01-01 00:00:00 +0000
4898+++ l10n_cr_account_financial_report_open_invoices/report/l10n_cr_account_report_open_invoices.mako 2013-08-20 07:28:14 +0000
4899@@ -0,0 +1,407 @@
4900+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4901+<html xmlns="http://www.w3.org/1999/xhtml">
4902+ <head>
4903+ <style type="text/css">
4904+ .overflow_ellipsis {
4905+ text-overflow: ellipsis;
4906+ overflow: hidden;
4907+ white-space: nowrap;
4908+ }
4909+
4910+ ${css}
4911+ </style>
4912+ </head>
4913+ <body>
4914+ <%!
4915+ def amount(text):
4916+ return text.replace('-', '&#8209;') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
4917+ %>
4918+
4919+ <%setLang(user.context_lang)%>
4920+
4921+ <%
4922+ initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
4923+ %>
4924+
4925+ <div class="act_as_table data_table">
4926+ <div class="act_as_row labels">
4927+ <div class="act_as_cell">${_('Chart of Account')}</div>
4928+ <div class="act_as_cell">${_('Fiscal Year')}</div>
4929+ <div class="act_as_cell">
4930+ %if filter_form(data) == 'filter_date':
4931+ ${_('Dates Filter')}
4932+ %else:
4933+ ${_('Periods Filter')}
4934+ %endif
4935+ </div>
4936+ <div class="act_as_cell">${_('Accounts Filter')}</div>
4937+ <div class="act_as_cell">${_('Target Moves')}</div>
4938+ <div class="act_as_cell">${_('Initial Balance')}</div>
4939+ </div>
4940+ <div class="act_as_row">
4941+ <div class="act_as_cell">${ chart_account.name }</div>
4942+ <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
4943+ <div class="act_as_cell">
4944+ ${_('From:')}
4945+ %if filter_form(data) == 'filter_date':
4946+ ${formatLang(start_date, date=True) if start_date else u'' }
4947+ %else:
4948+ ${start_period.name if start_period else u''}
4949+ %endif
4950+ ${_('To:')}
4951+ %if filter_form(data) == 'filter_date':
4952+ ${ formatLang(stop_date, date=True) if stop_date else u'' }
4953+ %else:
4954+ ${stop_period.name if stop_period else u'' }
4955+ %endif
4956+ </div>
4957+ <div class="act_as_cell">
4958+ %if partner_ids:
4959+ ${_('Custom Filter')}
4960+ %else:
4961+ ${ display_partner_account(data) }
4962+ %endif
4963+ </div>
4964+ <div class="act_as_cell">${ display_target_move(data) }</div>
4965+ <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
4966+ </div>
4967+ </div>
4968+ <%
4969+ account_by_curr = get_accounts_by_curr(cr, uid, objects)
4970+ %>
4971+ %for currency in account_by_curr:
4972+ %if currency[0] != 'CRC':
4973+ <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${currency[0]}</div>
4974+ %else:
4975+ <div class="account_title bg" style="margin-top: 20px; font-size: 14px; width: 1080px;">${_('Accounts in ')} ${company.currency_id.name}</div>
4976+ %endif
4977+ %for account in currency[1]:
4978+ %if account.ledger_lines or account.init_balance:
4979+ <%
4980+ if not account.partners_order:
4981+ continue
4982+ account_total_invoice = 0.0
4983+ account_total_payment = 0.0
4984+ account_total_debit = 0.0
4985+ account_total_credit = 0.0
4986+ account_total_manual_move = 0.0
4987+ account_balance_cumul = 0.0
4988+ account_balance_cumul_curr = 0.0
4989+ %>
4990+
4991+ <div class="account_title bg" style="width: 1080px; margin-top: 15px; font-size: 12px;">${account.code} - ${account.name} - ${account.report_currency_id.name or account.company_id.currency_id.name}</div>
4992+
4993+ %for partner_name, p_id, p_ref, p_name in account.partners_order:
4994+ <%
4995+ total_invoice = 0.0
4996+ total_payment = 0.0
4997+ total_debit = 0.0
4998+ total_credit = 0.0
4999+ total_manual_move = 0.0
5000+ cumul_balance = 0.0
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches