Merge lp:~gs.clearcorp/openerp-costa-rica/7.0_l10n_cr_ins_csv_generator into lp:openerp-costa-rica
- 7.0_l10n_cr_ins_csv_generator
- Merge into 7.0
Proposed by
Glen Sojo
Status: | Merged |
---|---|
Merged at revision: | 250 |
Proposed branch: | lp:~gs.clearcorp/openerp-costa-rica/7.0_l10n_cr_ins_csv_generator |
Merge into: | lp:openerp-costa-rica |
Diff against target: |
708 lines (+637/-0) 11 files modified
l10n_cr_hr_ins_csv_generator/__init__.py (+24/-0) l10n_cr_hr_ins_csv_generator/__openerp__.py (+52/-0) l10n_cr_hr_ins_csv_generator/i18n/es_CR.po (+213/-0) l10n_cr_hr_ins_csv_generator/l10n_cr_hr_ins_csv_generator.py (+55/-0) l10n_cr_hr_ins_csv_generator/tools/__init__.py (+23/-0) l10n_cr_hr_ins_csv_generator/tools/custom_encoder.py (+87/-0) l10n_cr_hr_ins_csv_generator/view/l10n_cr_hr_ins_csv_generator_view.xml (+43/-0) l10n_cr_hr_ins_csv_generator/wizard/__init__.py (+23/-0) l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard.py (+65/-0) l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml (+11/-0) l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml (+41/-0) |
To merge this branch: | bzr merge lp:~gs.clearcorp/openerp-costa-rica/7.0_l10n_cr_ins_csv_generator |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ClearCorp drivers | Pending | ||
Review via email: mp+191276@code.launchpad.net |
Commit message
Description of the change
Module l10n_cr_
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'l10n_cr_hr_ins_csv_generator' |
2 | === added file 'l10n_cr_hr_ins_csv_generator/__init__.py' |
3 | --- l10n_cr_hr_ins_csv_generator/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ l10n_cr_hr_ins_csv_generator/__init__.py 2013-10-15 19:06:07 +0000 |
5 | @@ -0,0 +1,24 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | +############################################################################## |
8 | +# |
9 | +# OpenERP, Open Source Management Solution |
10 | +# Addons modules by CLEARCORP S.A. |
11 | +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). |
12 | +# |
13 | +# This program is free software: you can redistribute it and/or modify |
14 | +# it under the terms of the GNU Affero General Public License as |
15 | +# published by the Free Software Foundation, either version 3 of the |
16 | +# License, or (at your option) any later version. |
17 | +# |
18 | +# This program is distributed in the hope that it will be useful, |
19 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | +# GNU Affero General Public License for more details. |
22 | +# |
23 | +# You should have received a copy of the GNU Affero General Public License |
24 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | +# |
26 | +############################################################################## |
27 | + |
28 | +import l10n_cr_hr_ins_csv_generator |
29 | +import wizard |
30 | \ No newline at end of file |
31 | |
32 | === added file 'l10n_cr_hr_ins_csv_generator/__openerp__.py' |
33 | --- l10n_cr_hr_ins_csv_generator/__openerp__.py 1970-01-01 00:00:00 +0000 |
34 | +++ l10n_cr_hr_ins_csv_generator/__openerp__.py 2013-10-15 19:06:07 +0000 |
35 | @@ -0,0 +1,52 @@ |
36 | +# -*- coding: utf-8 -*- |
37 | +############################################################################## |
38 | +# |
39 | +# OpenERP, Open Source Management Solution |
40 | +# Addons modules by CLEARCORP S.A. |
41 | +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). |
42 | +# |
43 | +# This program is free software: you can redistribute it and/or modify |
44 | +# it under the terms of the GNU Affero General Public License as |
45 | +# published by the Free Software Foundation, either version 3 of the |
46 | +# License, or (at your option) any later version. |
47 | +# |
48 | +# This program is distributed in the hope that it will be useful, |
49 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
50 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
51 | +# GNU Affero General Public License for more details. |
52 | +# |
53 | +# You should have received a copy of the GNU Affero General Public License |
54 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
55 | +# |
56 | +############################################################################## |
57 | + |
58 | +{ |
59 | + "name" : 'Costa Rica INS csv Generator', |
60 | + "version" : '1.0', |
61 | + "author" : 'CLEARCORP S.A.', |
62 | + 'complexity': 'normal', |
63 | + "description": """ |
64 | +Module build for the generation of custom files to upload information to the INS systems |
65 | + """, |
66 | + "category": 'Human Resources', |
67 | + "sequence": 4, |
68 | + "website" : "http://clearcorp.co.cr", |
69 | + "images" : [], |
70 | + "icon" : False, |
71 | + "depends" : [ |
72 | + 'hr_payroll', |
73 | + ], |
74 | + "data" : [ |
75 | + 'wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml', |
76 | + 'wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml', |
77 | + 'view/l10n_cr_hr_ins_csv_generator_view.xml', |
78 | + ], |
79 | + "init_xml" : [], |
80 | + "demo_xml" : [], |
81 | + "update_xml" : [], |
82 | + "test" : [], |
83 | + "auto_install": False, |
84 | + "application": False, |
85 | + "installable": True, |
86 | + 'license': 'AGPL-3', |
87 | +} |
88 | \ No newline at end of file |
89 | |
90 | === added directory 'l10n_cr_hr_ins_csv_generator/i18n' |
91 | === added symlink 'l10n_cr_hr_ins_csv_generator/i18n/es.po' |
92 | === target is u'es_CR.po' |
93 | === added file 'l10n_cr_hr_ins_csv_generator/i18n/es_CR.po' |
94 | --- l10n_cr_hr_ins_csv_generator/i18n/es_CR.po 1970-01-01 00:00:00 +0000 |
95 | +++ l10n_cr_hr_ins_csv_generator/i18n/es_CR.po 2013-10-15 19:06:07 +0000 |
96 | @@ -0,0 +1,213 @@ |
97 | +# Translation of OpenERP Server. |
98 | +# This file contains the translation of the following modules: |
99 | +# * ins_csv_generator |
100 | +# |
101 | +msgid "" |
102 | +msgstr "" |
103 | +"Project-Id-Version: OpenERP Server 7.0\n" |
104 | +"Report-Msgid-Bugs-To: \n" |
105 | +"POT-Creation-Date: 2013-10-14 18:12+0000\n" |
106 | +"PO-Revision-Date: 2013-10-14 18:12+0000\n" |
107 | +"Last-Translator: <>\n" |
108 | +"Language-Team: \n" |
109 | +"MIME-Version: 1.0\n" |
110 | +"Content-Type: text/plain; charset=UTF-8\n" |
111 | +"Content-Transfer-Encoding: \n" |
112 | +"Plural-Forms: \n" |
113 | + |
114 | +#. module: ins_csv_generator |
115 | +#: field:hr.employee,ins_working_day:0 |
116 | +msgid "Working Day" |
117 | +msgstr "Jornada Laboral" |
118 | + |
119 | +#. module: ins_csv_generator |
120 | +#: view:hr.ins.csv.generator.generator.wizard:0 |
121 | +msgid "Encoded text file:" |
122 | +msgstr "Archivo de texto codificado" |
123 | + |
124 | +#. module: ins_csv_generator |
125 | +#: field:hr.employee,ins_id_type:0 |
126 | +msgid "Id Type" |
127 | +msgstr "Tipo de Indentificación" |
128 | + |
129 | +#. module: ins_csv_generator |
130 | +#: model:ir.ui.menu,name:ins_csv_generator.menu_generator |
131 | +msgid "Generate INS File" |
132 | +msgstr "Generar Archivo INS" |
133 | + |
134 | +#. module: ins_csv_generator |
135 | +#: selection:hr.employee,ins_id_type:0 |
136 | +msgid "Cédula Residencia" |
137 | +msgstr "Cédula Residencia" |
138 | + |
139 | +#. module: ins_csv_generator |
140 | +#: view:hr.ins.csv.generator.generator.wizard:0 |
141 | +msgid "Wizard" |
142 | +msgstr "Asistente" |
143 | + |
144 | +#. module: ins_csv_generator |
145 | +#: selection:hr.employee,ins_working_day:0 |
146 | +msgid "Tiempo completo" |
147 | +msgstr "Tiempo Completo" |
148 | + |
149 | +#. module: ins_csv_generator |
150 | +#: selection:hr.employee,ins_id_type:0 |
151 | +msgid "Cédula Nacional" |
152 | +msgstr "Cédula Nacional" |
153 | + |
154 | +#. module: ins_csv_generator |
155 | +#: model:ir.model,name:ins_csv_generator.model_hr_employee |
156 | +msgid "Employee" |
157 | +msgstr "Empleado" |
158 | + |
159 | +#. module: ins_csv_generator |
160 | +#: view:hr.employee:0 |
161 | +msgid "Identification Information" |
162 | +msgstr "Información de Identificación" |
163 | + |
164 | +#. module: ins_csv_generator |
165 | +#: view:hr.ins.csv.generator.generator.wizard:0 |
166 | +msgid "Generate csv File" |
167 | +msgstr "Generar Archivos csv" |
168 | + |
169 | +#. module: ins_csv_generator |
170 | +#: view:hr.employee:0 |
171 | +msgid "Working Information" |
172 | +msgstr "Información Laboral" |
173 | + |
174 | +#. module: ins_csv_generator |
175 | +#: field:hr.employee,ins_paid_days:0 |
176 | +msgid "Paid Days" |
177 | +msgstr "Días Pagados" |
178 | + |
179 | +#. module: ins_csv_generator |
180 | +#: field:hr.employee,ins_last_name1:0 |
181 | +msgid "First Last Name" |
182 | +msgstr "Primer Apellido" |
183 | + |
184 | +#. module: ins_csv_generator |
185 | +#: field:hr.ins.csv.generator.generator.wizard,state:0 |
186 | +msgid "State" |
187 | +msgstr "Estado" |
188 | + |
189 | +#. module: ins_csv_generator |
190 | +#: selection:hr.employee,ins_working_day:0 |
191 | +msgid "Medio tiempo" |
192 | +msgstr "Medio Tiempo" |
193 | + |
194 | +#. module: ins_csv_generator |
195 | +#: selection:hr.ins.csv.generator.generator.wizard,state:0 |
196 | +msgid "get" |
197 | +msgstr "Obtener" |
198 | + |
199 | +#. module: ins_csv_generator |
200 | +#: view:hr.ins.csv.generator.generator.wizard:0 |
201 | +msgid "Fill the required fields" |
202 | +msgstr "Llenar los campos requeridos" |
203 | + |
204 | +#. module: ins_csv_generator |
205 | +#: view:hr.employee:0 |
206 | +msgid "Others" |
207 | +msgstr "Others" |
208 | + |
209 | +#. module: ins_csv_generator |
210 | +#: field:hr.employee,ins_job_code:0 |
211 | +msgid "Job Code" |
212 | +msgstr "Código de Trabajo" |
213 | + |
214 | +#. module: ins_csv_generator |
215 | +#: field:hr.employee,ins_last_name2:0 |
216 | +msgid "Second Last Name" |
217 | +msgstr "Segundo Apellido" |
218 | + |
219 | +#. module: ins_csv_generator |
220 | +#: selection:hr.employee,ins_working_day:0 |
221 | +msgid "Ocasional" |
222 | +msgstr "Ocasional" |
223 | + |
224 | +#. module: ins_csv_generator |
225 | +#: view:hr.ins.csv.generator.generator.wizard:0 |
226 | +msgid "Are you sure you want to generate the csv file?" |
227 | +msgstr "¿Estás seguro que deseas generar el archivo csv?" |
228 | + |
229 | +#. module: ins_csv_generator |
230 | +#: field:hr.employee,ins_name:0 |
231 | +#: field:hr.ins.csv.generator.generator.wizard,name:0 |
232 | +msgid "Name" |
233 | +msgstr "Nombre" |
234 | + |
235 | +#. module: ins_csv_generator |
236 | +#: field:hr.employee,ins_paid_hours:0 |
237 | +msgid "Paid Hours" |
238 | +msgstr "Horas Pagadas" |
239 | + |
240 | +#. module: ins_csv_generator |
241 | +#: selection:hr.employee,ins_working_day:0 |
242 | +msgid "Por jornales" |
243 | +msgstr "Por Jornales" |
244 | + |
245 | +#. module: ins_csv_generator |
246 | +#: view:hr.employee:0 |
247 | +msgid "Full Name Configuration" |
248 | +msgstr "Configuración de Nombre Completo" |
249 | + |
250 | +#. module: ins_csv_generator |
251 | +#: selection:hr.employee,ins_id_type:0 |
252 | +msgid "Permiso Trabajo" |
253 | +msgstr "Permiso de Trabajo" |
254 | + |
255 | +#. module: ins_csv_generator |
256 | +#: selection:hr.ins.csv.generator.generator.wizard,state:0 |
257 | +msgid "generate" |
258 | +msgstr "Generar" |
259 | + |
260 | +#. module: ins_csv_generator |
261 | +#: selection:hr.employee,ins_id_type:0 |
262 | +msgid "Número Pasaporte" |
263 | +msgstr "Número de Pasaporte" |
264 | + |
265 | +#. module: ins_csv_generator |
266 | +#: view:hr.employee:0 |
267 | +msgid "INS Information" |
268 | +msgstr "Información INS" |
269 | + |
270 | +#. module: ins_csv_generator |
271 | +#: field:hr.ins.csv.generator.generator.wizard,date_end:0 |
272 | +msgid "Date End" |
273 | +msgstr "Fecha Final" |
274 | + |
275 | +#. module: ins_csv_generator |
276 | +#: model:ir.actions.act_window,name:ins_csv_generator.action_generator_wizard_create |
277 | +msgid "INS csv Generator" |
278 | +msgstr "Generador de csv INS" |
279 | + |
280 | +#. module: ins_csv_generator |
281 | +#: field:hr.employee,ins_exportable:0 |
282 | +msgid "Export?" |
283 | +msgstr "Exportar?" |
284 | + |
285 | +#. module: ins_csv_generator |
286 | +#: field:hr.ins.csv.generator.generator.wizard,data:0 |
287 | +msgid "File" |
288 | +msgstr "Archivo" |
289 | + |
290 | +#. module: ins_csv_generator |
291 | +#: view:hr.ins.csv.generator.generator.wizard:0 |
292 | +msgid "Cancel" |
293 | +msgstr "Cancelar" |
294 | + |
295 | +#. module: ins_csv_generator |
296 | +#: selection:hr.employee,ins_id_type:0 |
297 | +msgid "Sin Documentos" |
298 | +msgstr "Sin Documentos" |
299 | + |
300 | +#. module: ins_csv_generator |
301 | +#: field:hr.ins.csv.generator.generator.wizard,date_start:0 |
302 | +msgid "Date Start" |
303 | +msgstr "Fecha Inicial" |
304 | + |
305 | +#. module: ins_csv_generator |
306 | +#: field:hr.ins.csv.generator.generator.wizard,salary_rule_id:0 |
307 | +msgid "Salary Rule" |
308 | +msgstr "Regla de Salario" |
309 | + |
310 | |
311 | === added file 'l10n_cr_hr_ins_csv_generator/l10n_cr_hr_ins_csv_generator.py' |
312 | --- l10n_cr_hr_ins_csv_generator/l10n_cr_hr_ins_csv_generator.py 1970-01-01 00:00:00 +0000 |
313 | +++ l10n_cr_hr_ins_csv_generator/l10n_cr_hr_ins_csv_generator.py 2013-10-15 19:06:07 +0000 |
314 | @@ -0,0 +1,55 @@ |
315 | +# -*- coding: utf-8 -*- |
316 | +############################################################################## |
317 | +# |
318 | +# OpenERP, Open Source Management Solution |
319 | +# Addons modules by CLEARCORP S.A. |
320 | +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). |
321 | +# |
322 | +# This program is free software: you can redistribute it and/or modify |
323 | +# it under the terms of the GNU Affero General Public License as |
324 | +# published by the Free Software Foundation, either version 3 of the |
325 | +# License, or (at your option) any later version. |
326 | +# |
327 | +# This program is distributed in the hope that it will be useful, |
328 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
329 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
330 | +# GNU Affero General Public License for more details. |
331 | +# |
332 | +# You should have received a copy of the GNU Affero General Public License |
333 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
334 | +# |
335 | +############################################################################## |
336 | + |
337 | +from openerp.osv import osv, fields |
338 | + |
339 | +class hrEmployee(osv.Model): |
340 | + _inherit = 'hr.employee' |
341 | + |
342 | + _defaults = { |
343 | + 'ins_exportable': True, |
344 | + 'ins_working_day': 'Tiempo completo', |
345 | + 'ins_paid_days': 30, |
346 | + 'ins_paid_hours': 240, |
347 | + } |
348 | + |
349 | + _columns = { |
350 | + 'ins_exportable': fields.boolean('Export?'), |
351 | + 'ins_id_type': fields.selection([ |
352 | + ('CN','Cédula Nacional'), |
353 | + ('CR','Cédula Residencia'), |
354 | + ('NP', 'Número Pasaporte'), |
355 | + ('PT','Permiso Trabajo'), |
356 | + ('SD','Sin Documentos'), |
357 | + ], 'Id Type'), |
358 | + 'ins_name': fields.char('Name', size=128), |
359 | + 'ins_last_name1': fields.char('First Last Name', size=128), |
360 | + 'ins_last_name2': fields.char('Second Last Name', size=128), |
361 | + 'ins_working_day': fields.selection([('Tiempo completo','Tiempo completo'), |
362 | + ('Medio tiempo','Medio tiempo'), |
363 | + ('Ocasional','Ocasional'), |
364 | + ('Por jornales','Por jornales'), |
365 | + ],'Working Day'), |
366 | + 'ins_paid_days': fields.integer('Paid Days'), |
367 | + 'ins_paid_hours': fields.integer('Paid Hours'), |
368 | + 'ins_job_code': fields.char('Job Code'), |
369 | + } |
370 | \ No newline at end of file |
371 | |
372 | === added directory 'l10n_cr_hr_ins_csv_generator/tools' |
373 | === added file 'l10n_cr_hr_ins_csv_generator/tools/__init__.py' |
374 | --- l10n_cr_hr_ins_csv_generator/tools/__init__.py 1970-01-01 00:00:00 +0000 |
375 | +++ l10n_cr_hr_ins_csv_generator/tools/__init__.py 2013-10-15 19:06:07 +0000 |
376 | @@ -0,0 +1,23 @@ |
377 | +# -*- coding: utf-8 -*- |
378 | +############################################################################## |
379 | +# |
380 | +# OpenERP, Open Source Management Solution |
381 | +# Addons modules by CLEARCORP S.A. |
382 | +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). |
383 | +# |
384 | +# This program is free software: you can redistribute it and/or modify |
385 | +# it under the terms of the GNU Affero General Public License as |
386 | +# published by the Free Software Foundation, either version 3 of the |
387 | +# License, or (at your option) any later version. |
388 | +# |
389 | +# This program is distributed in the hope that it will be useful, |
390 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
391 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
392 | +# GNU Affero General Public License for more details. |
393 | +# |
394 | +# You should have received a copy of the GNU Affero General Public License |
395 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
396 | +# |
397 | +############################################################################## |
398 | + |
399 | +import custom_encoder |
400 | \ No newline at end of file |
401 | |
402 | === added file 'l10n_cr_hr_ins_csv_generator/tools/custom_encoder.py' |
403 | --- l10n_cr_hr_ins_csv_generator/tools/custom_encoder.py 1970-01-01 00:00:00 +0000 |
404 | +++ l10n_cr_hr_ins_csv_generator/tools/custom_encoder.py 2013-10-15 19:06:07 +0000 |
405 | @@ -0,0 +1,87 @@ |
406 | +# -*- coding: utf-8 -*- |
407 | +############################################################################## |
408 | +# |
409 | +# OpenERP, Open Source Management Solution |
410 | +# Addons modules by CLEARCORP S.A. |
411 | +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). |
412 | +# |
413 | +# This program is free software: you can redistribute it and/or modify |
414 | +# it under the terms of the GNU Affero General Public License as |
415 | +# published by the Free Software Foundation, either version 3 of the |
416 | +# License, or (at your option) any later version. |
417 | +# |
418 | +# This program is distributed in the hope that it will be useful, |
419 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
420 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
421 | +# GNU Affero General Public License for more details. |
422 | +# |
423 | +# You should have received a copy of the GNU Affero General Public License |
424 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
425 | +# |
426 | +############################################################################## |
427 | + |
428 | +import base64 |
429 | +import cStringIO |
430 | +import csv |
431 | + |
432 | +import openerp.pooler as pooler |
433 | + |
434 | +def encodeInsCsv(cr, uid, date_start, date_end, code, context=None): |
435 | + def _information_export(buffer, cr, uid, code, context): |
436 | + def _get_user_wage(cr, uid, pool, date_start, date_end, code, id, context): |
437 | + payslip_obj = pool.get('hr.payslip') |
438 | + payslip_ids = payslip_obj.search(cr, uid, [('employee_id','=',id),('date_to','>=',date_start),('date_to','<=',date_end)], context=context) |
439 | + payslips = payslip_obj.browse(cr, uid, payslip_ids, context=context) |
440 | + wage_sum = 0 |
441 | + for payslip in payslips: |
442 | + for line in payslip.line_ids: |
443 | + if line.salary_rule_id.code == code: |
444 | + wage_sum+= line.total |
445 | + return int(wage_sum) |
446 | + |
447 | + def _encode(s): |
448 | + if isinstance(s, unicode): |
449 | + return s.encode('utf8') |
450 | + else: |
451 | + if isinstance(s,bool): |
452 | + return "" |
453 | + return str(s) |
454 | + |
455 | + def _process(employees, buffer): |
456 | + writer = csv.writer(buffer, 'excel', delimiter=';') |
457 | + # write header first |
458 | + writer.writerow(("TI","NA","N° Cedula","N° Asegurado","Nombre", |
459 | + "Apellido1","Apellido2","Tipo Jornada","Dias", |
460 | + "Horas","Salario","Observaciones","Ocupacion")) |
461 | + for tuple in employees: |
462 | + employee = tuple[0] |
463 | + writer.writerow((_encode(employee.ins_id_type), |
464 | + _encode(employee.country_id.code), |
465 | + _encode(employee.identification_id), |
466 | + _encode(employee.sinid), |
467 | + _encode(employee.ins_name), |
468 | + _encode(employee.ins_last_name1), |
469 | + _encode(employee.ins_last_name2), |
470 | + _encode(employee.ins_working_day), |
471 | + _encode(employee.ins_paid_days), |
472 | + _encode(employee.ins_paid_hours), |
473 | + _encode(tuple[1]), |
474 | + "",#Observations are not added automatically |
475 | + _encode(employee.ins_job_code))) |
476 | + |
477 | + dbname = cr.dbname |
478 | + pool = pooler.get_pool(dbname) |
479 | + employee_obj = pool.get('hr.employee') |
480 | + employee_ids = employee_obj.search(cr, uid, [('ins_exportable','=',True)], context=context) |
481 | + employees = employee_obj.browse(cr, uid, employee_ids, context=context) |
482 | + tmp_employees = [] |
483 | + for employee in employees: |
484 | + ins_wage = _get_user_wage(cr,uid,pool,date_start,date_end,code,employee.id,context) |
485 | + tmp_employees.append((employee,ins_wage)) |
486 | + _process(tmp_employees, buffer) |
487 | + |
488 | + buffer = cStringIO.StringIO() |
489 | + _information_export(buffer,cr,uid,code,context) |
490 | + out = base64.encodestring(buffer.getvalue()) |
491 | + buffer.close() |
492 | + return out |
493 | \ No newline at end of file |
494 | |
495 | === added directory 'l10n_cr_hr_ins_csv_generator/view' |
496 | === added file 'l10n_cr_hr_ins_csv_generator/view/l10n_cr_hr_ins_csv_generator_view.xml' |
497 | --- l10n_cr_hr_ins_csv_generator/view/l10n_cr_hr_ins_csv_generator_view.xml 1970-01-01 00:00:00 +0000 |
498 | +++ l10n_cr_hr_ins_csv_generator/view/l10n_cr_hr_ins_csv_generator_view.xml 2013-10-15 19:06:07 +0000 |
499 | @@ -0,0 +1,43 @@ |
500 | +<?xml version="1.0" encoding="UTF-8"?> |
501 | + |
502 | +<openerp> |
503 | + <data> |
504 | + <!-- Views --> |
505 | + <record model="ir.ui.view" id ="ins_csv_generator_employee_form_view"> |
506 | + <field name="name">ins.csv.generator.employee.form.view</field> |
507 | + <field name="model">hr.employee</field> |
508 | + <field name="priority" eval="16"/> |
509 | + <field name="inherit_id" ref="hr.view_employee_form"/> |
510 | + <field name="arch" type="xml"> |
511 | + <xpath expr="//page[@string='HR Settings']" position="after"> |
512 | + <page string="INS Information"> |
513 | + <group name="ins_information_group" colspan="4" col="2"> |
514 | + <group colspan="1" col="2"> |
515 | + <separator string="Identification Information" colspan="2"/> |
516 | + <field name="ins_id_type"/> |
517 | + <field name="sinid"/> |
518 | + </group> |
519 | + <group colspan="1" col="2"> |
520 | + <separator string="Full Name Configuration" colspan="2"/> |
521 | + <field name="ins_name"/> |
522 | + <field name="ins_last_name1"/> |
523 | + <field name="ins_last_name2"/> |
524 | + </group> |
525 | + <group colspan="1" col="2"> |
526 | + <separator string="Working Information" colspan="2"/> |
527 | + <field name="ins_working_day"/> |
528 | + <field name="ins_paid_days"/> |
529 | + <field name="ins_paid_hours"/> |
530 | + <field name="ins_job_code"/> |
531 | + </group> |
532 | + <group colspan="1" col="2"> |
533 | + <separator string="Others" colspan="2"/> |
534 | + <field name="ins_exportable"/> |
535 | + </group> |
536 | + </group> |
537 | + </page> |
538 | + </xpath> |
539 | + </field> |
540 | + </record> |
541 | + </data> |
542 | +</openerp> |
543 | \ No newline at end of file |
544 | |
545 | === added directory 'l10n_cr_hr_ins_csv_generator/wizard' |
546 | === added file 'l10n_cr_hr_ins_csv_generator/wizard/__init__.py' |
547 | --- l10n_cr_hr_ins_csv_generator/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
548 | +++ l10n_cr_hr_ins_csv_generator/wizard/__init__.py 2013-10-15 19:06:07 +0000 |
549 | @@ -0,0 +1,23 @@ |
550 | +# -*- coding: utf-8 -*- |
551 | +############################################################################## |
552 | +# |
553 | +# OpenERP, Open Source Management Solution |
554 | +# Addons modules by CLEARCORP S.A. |
555 | +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). |
556 | +# |
557 | +# This program is free software: you can redistribute it and/or modify |
558 | +# it under the terms of the GNU Affero General Public License as |
559 | +# published by the Free Software Foundation, either version 3 of the |
560 | +# License, or (at your option) any later version. |
561 | +# |
562 | +# This program is distributed in the hope that it will be useful, |
563 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
564 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
565 | +# GNU Affero General Public License for more details. |
566 | +# |
567 | +# You should have received a copy of the GNU Affero General Public License |
568 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
569 | +# |
570 | +############################################################################## |
571 | + |
572 | +import l10n_cr_hr_ins_csv_generator_wizard |
573 | \ No newline at end of file |
574 | |
575 | === added file 'l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard.py' |
576 | --- l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard.py 1970-01-01 00:00:00 +0000 |
577 | +++ l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard.py 2013-10-15 19:06:07 +0000 |
578 | @@ -0,0 +1,65 @@ |
579 | +# -*- coding: utf-8 -*- |
580 | +############################################################################## |
581 | +# |
582 | +# OpenERP, Open Source Management Solution |
583 | +# Addons modules by CLEARCORP S.A. |
584 | +# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>). |
585 | +# |
586 | +# This program is free software: you can redistribute it and/or modify |
587 | +# it under the terms of the GNU Affero General Public License as |
588 | +# published by the Free Software Foundation, either version 3 of the |
589 | +# License, or (at your option) any later version. |
590 | +# |
591 | +# This program is distributed in the hope that it will be useful, |
592 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
593 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
594 | +# GNU Affero General Public License for more details. |
595 | +# |
596 | +# You should have received a copy of the GNU Affero General Public License |
597 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
598 | +# |
599 | +############################################################################## |
600 | +import base64 |
601 | +import cStringIO |
602 | + |
603 | +from openerp.osv import osv, fields |
604 | +from ..tools import custom_encoder |
605 | + |
606 | +class generatorWizardCreate(osv.TransientModel): |
607 | + |
608 | + _name = "hr.ins.csv.generator.generator.wizard" |
609 | + |
610 | + _columns = { |
611 | + 'name': fields.char('Name', size=128), |
612 | + 'salary_rule_id':fields.many2one('hr.salary.rule','Salary Rule', required=True), |
613 | + 'date_start': fields.date('Date Start', required=True), |
614 | + 'date_end': fields.date('Date End', required=True), |
615 | + 'data': fields.binary('File', readonly=True), |
616 | + 'state': fields.selection([('generate','generate'), # generate file |
617 | + ('get','get')], string="State"), # get the file |
618 | + } |
619 | + |
620 | + _defaults = { |
621 | + 'state': 'generate', |
622 | + } |
623 | + |
624 | + def generate_csv(self, cr, uid, ids, context=None): |
625 | + this = self.browse(cr, uid, ids)[0] |
626 | + this.name = 'ins_generated_file.csv' |
627 | + out = custom_encoder.encodeInsCsv(cr, uid, this.date_start,this.date_end, |
628 | + this.salary_rule_id.code, context) |
629 | + self.write(cr, uid, ids, { |
630 | + 'state': 'get', |
631 | + 'data': out, |
632 | + 'name':this.name}, context=context) |
633 | + return { |
634 | + 'type': 'ir.actions.act_window', |
635 | + 'res_model': 'hr.ins.csv.generator.generator.wizard', |
636 | + 'view_mode': 'form', |
637 | + 'view_type': 'form', |
638 | + 'res_id': this.id, |
639 | + 'views': [(False, 'form')], |
640 | + 'target': 'new', |
641 | + } |
642 | + |
643 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
644 | \ No newline at end of file |
645 | |
646 | === added file 'l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml' |
647 | --- l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml 1970-01-01 00:00:00 +0000 |
648 | +++ l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml 2013-10-15 19:06:07 +0000 |
649 | @@ -0,0 +1,11 @@ |
650 | +<?xml version="1.0" encoding="UTF-8"?> |
651 | + |
652 | +<openerp> |
653 | + <data> |
654 | + <menuitem id="menu_generator" |
655 | + parent="hr.menu_hr_main" |
656 | + name="Generate INS File" |
657 | + sequence="100" |
658 | + action="action_generator_wizard_create"/> |
659 | + </data> |
660 | +</openerp> |
661 | \ No newline at end of file |
662 | |
663 | === added file 'l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml' |
664 | --- l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml 1970-01-01 00:00:00 +0000 |
665 | +++ l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml 2013-10-15 19:06:07 +0000 |
666 | @@ -0,0 +1,41 @@ |
667 | +<?xml version="1.0" encoding="UTF-8"?> |
668 | + |
669 | +<openerp> |
670 | + <data> |
671 | + <!-- Views --> |
672 | + <record model="ir.ui.view" id ="ins_csv_generator_generator_wizard_create_form"> |
673 | + <field name="name">ins.csv.generator.generator.wizard.create.form</field> |
674 | + <field name="model">hr.ins.csv.generator.generator.wizard</field> |
675 | + <field name="priority" eval="16"/> |
676 | + <field name="arch" type="xml"> |
677 | + <form string="Wizard" version="7.0"> |
678 | + <sheet> |
679 | + <field invisible="1" name="state"/> |
680 | + <group states="get"> |
681 | + <p>Encoded text file: <field name="data" readonly="1" filename="name"/></p> |
682 | + </group> |
683 | + <group states="generate" colspan="4" col="2"> |
684 | + <separator string="Fill the required fields" colspan="2"/> |
685 | + <field name="salary_rule_id"/> |
686 | + <field name="date_start"/> |
687 | + <field name="date_end"/> |
688 | + </group> |
689 | + </sheet> |
690 | + <footer states="generate"> |
691 | + <button type="object" name="generate_csv" string="Generate csv File" icon="gtk-ok" |
692 | + confirm="Are you sure you want to generate the csv file?" class="oe_highlight" /> |
693 | + <button type="special" special="cancel" string="Cancel" class="oe_link" /> |
694 | + </footer> |
695 | + </form> |
696 | + </field> |
697 | + </record> |
698 | + |
699 | + <!-- Actions --> |
700 | + <act_window id="action_generator_wizard_create" |
701 | + name="INS csv Generator" |
702 | + res_model="hr.ins.csv.generator.generator.wizard" |
703 | + view_mode="form" |
704 | + target="new" |
705 | + /> |
706 | + </data> |
707 | +</openerp> |
708 | \ No newline at end of file |