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

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
Reviewer Review Type Date Requested Status
ClearCorp drivers Pending
Review via email: mp+191276@code.launchpad.net

Description of the change

Module l10n_cr_hr_ins_csv_generator creado

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
=== added directory 'l10n_cr_hr_ins_csv_generator'
=== added file 'l10n_cr_hr_ins_csv_generator/__init__.py'
--- l10n_cr_hr_ins_csv_generator/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/__init__.py 2013-10-15 19:06:07 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Addons modules by CLEARCORP S.A.
6# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import l10n_cr_hr_ins_csv_generator
24import wizard
0\ No newline at end of file25\ No newline at end of file
126
=== added file 'l10n_cr_hr_ins_csv_generator/__openerp__.py'
--- l10n_cr_hr_ins_csv_generator/__openerp__.py 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/__openerp__.py 2013-10-15 19:06:07 +0000
@@ -0,0 +1,52 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Addons modules by CLEARCORP S.A.
6# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 "name" : 'Costa Rica INS csv Generator',
25 "version" : '1.0',
26 "author" : 'CLEARCORP S.A.',
27 'complexity': 'normal',
28 "description": """
29Module build for the generation of custom files to upload information to the INS systems
30 """,
31 "category": 'Human Resources',
32 "sequence": 4,
33 "website" : "http://clearcorp.co.cr",
34 "images" : [],
35 "icon" : False,
36 "depends" : [
37 'hr_payroll',
38 ],
39 "data" : [
40 'wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml',
41 'wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml',
42 'view/l10n_cr_hr_ins_csv_generator_view.xml',
43 ],
44 "init_xml" : [],
45 "demo_xml" : [],
46 "update_xml" : [],
47 "test" : [],
48 "auto_install": False,
49 "application": False,
50 "installable": True,
51 'license': 'AGPL-3',
52}
0\ No newline at end of file53\ No newline at end of file
154
=== added directory 'l10n_cr_hr_ins_csv_generator/i18n'
=== added symlink 'l10n_cr_hr_ins_csv_generator/i18n/es.po'
=== target is u'es_CR.po'
=== added file 'l10n_cr_hr_ins_csv_generator/i18n/es_CR.po'
--- l10n_cr_hr_ins_csv_generator/i18n/es_CR.po 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/i18n/es_CR.po 2013-10-15 19:06:07 +0000
@@ -0,0 +1,213 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * ins_csv_generator
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-10-14 18:12+0000\n"
10"PO-Revision-Date: 2013-10-14 18:12+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: ins_csv_generator
19#: field:hr.employee,ins_working_day:0
20msgid "Working Day"
21msgstr "Jornada Laboral"
22
23#. module: ins_csv_generator
24#: view:hr.ins.csv.generator.generator.wizard:0
25msgid "Encoded text file:"
26msgstr "Archivo de texto codificado"
27
28#. module: ins_csv_generator
29#: field:hr.employee,ins_id_type:0
30msgid "Id Type"
31msgstr "Tipo de Indentificación"
32
33#. module: ins_csv_generator
34#: model:ir.ui.menu,name:ins_csv_generator.menu_generator
35msgid "Generate INS File"
36msgstr "Generar Archivo INS"
37
38#. module: ins_csv_generator
39#: selection:hr.employee,ins_id_type:0
40msgid "Cédula Residencia"
41msgstr "Cédula Residencia"
42
43#. module: ins_csv_generator
44#: view:hr.ins.csv.generator.generator.wizard:0
45msgid "Wizard"
46msgstr "Asistente"
47
48#. module: ins_csv_generator
49#: selection:hr.employee,ins_working_day:0
50msgid "Tiempo completo"
51msgstr "Tiempo Completo"
52
53#. module: ins_csv_generator
54#: selection:hr.employee,ins_id_type:0
55msgid "Cédula Nacional"
56msgstr "Cédula Nacional"
57
58#. module: ins_csv_generator
59#: model:ir.model,name:ins_csv_generator.model_hr_employee
60msgid "Employee"
61msgstr "Empleado"
62
63#. module: ins_csv_generator
64#: view:hr.employee:0
65msgid "Identification Information"
66msgstr "Información de Identificación"
67
68#. module: ins_csv_generator
69#: view:hr.ins.csv.generator.generator.wizard:0
70msgid "Generate csv File"
71msgstr "Generar Archivos csv"
72
73#. module: ins_csv_generator
74#: view:hr.employee:0
75msgid "Working Information"
76msgstr "Información Laboral"
77
78#. module: ins_csv_generator
79#: field:hr.employee,ins_paid_days:0
80msgid "Paid Days"
81msgstr "Días Pagados"
82
83#. module: ins_csv_generator
84#: field:hr.employee,ins_last_name1:0
85msgid "First Last Name"
86msgstr "Primer Apellido"
87
88#. module: ins_csv_generator
89#: field:hr.ins.csv.generator.generator.wizard,state:0
90msgid "State"
91msgstr "Estado"
92
93#. module: ins_csv_generator
94#: selection:hr.employee,ins_working_day:0
95msgid "Medio tiempo"
96msgstr "Medio Tiempo"
97
98#. module: ins_csv_generator
99#: selection:hr.ins.csv.generator.generator.wizard,state:0
100msgid "get"
101msgstr "Obtener"
102
103#. module: ins_csv_generator
104#: view:hr.ins.csv.generator.generator.wizard:0
105msgid "Fill the required fields"
106msgstr "Llenar los campos requeridos"
107
108#. module: ins_csv_generator
109#: view:hr.employee:0
110msgid "Others"
111msgstr "Others"
112
113#. module: ins_csv_generator
114#: field:hr.employee,ins_job_code:0
115msgid "Job Code"
116msgstr "Código de Trabajo"
117
118#. module: ins_csv_generator
119#: field:hr.employee,ins_last_name2:0
120msgid "Second Last Name"
121msgstr "Segundo Apellido"
122
123#. module: ins_csv_generator
124#: selection:hr.employee,ins_working_day:0
125msgid "Ocasional"
126msgstr "Ocasional"
127
128#. module: ins_csv_generator
129#: view:hr.ins.csv.generator.generator.wizard:0
130msgid "Are you sure you want to generate the csv file?"
131msgstr "¿Estás seguro que deseas generar el archivo csv?"
132
133#. module: ins_csv_generator
134#: field:hr.employee,ins_name:0
135#: field:hr.ins.csv.generator.generator.wizard,name:0
136msgid "Name"
137msgstr "Nombre"
138
139#. module: ins_csv_generator
140#: field:hr.employee,ins_paid_hours:0
141msgid "Paid Hours"
142msgstr "Horas Pagadas"
143
144#. module: ins_csv_generator
145#: selection:hr.employee,ins_working_day:0
146msgid "Por jornales"
147msgstr "Por Jornales"
148
149#. module: ins_csv_generator
150#: view:hr.employee:0
151msgid "Full Name Configuration"
152msgstr "Configuración de Nombre Completo"
153
154#. module: ins_csv_generator
155#: selection:hr.employee,ins_id_type:0
156msgid "Permiso Trabajo"
157msgstr "Permiso de Trabajo"
158
159#. module: ins_csv_generator
160#: selection:hr.ins.csv.generator.generator.wizard,state:0
161msgid "generate"
162msgstr "Generar"
163
164#. module: ins_csv_generator
165#: selection:hr.employee,ins_id_type:0
166msgid "Número Pasaporte"
167msgstr "Número de Pasaporte"
168
169#. module: ins_csv_generator
170#: view:hr.employee:0
171msgid "INS Information"
172msgstr "Información INS"
173
174#. module: ins_csv_generator
175#: field:hr.ins.csv.generator.generator.wizard,date_end:0
176msgid "Date End"
177msgstr "Fecha Final"
178
179#. module: ins_csv_generator
180#: model:ir.actions.act_window,name:ins_csv_generator.action_generator_wizard_create
181msgid "INS csv Generator"
182msgstr "Generador de csv INS"
183
184#. module: ins_csv_generator
185#: field:hr.employee,ins_exportable:0
186msgid "Export?"
187msgstr "Exportar?"
188
189#. module: ins_csv_generator
190#: field:hr.ins.csv.generator.generator.wizard,data:0
191msgid "File"
192msgstr "Archivo"
193
194#. module: ins_csv_generator
195#: view:hr.ins.csv.generator.generator.wizard:0
196msgid "Cancel"
197msgstr "Cancelar"
198
199#. module: ins_csv_generator
200#: selection:hr.employee,ins_id_type:0
201msgid "Sin Documentos"
202msgstr "Sin Documentos"
203
204#. module: ins_csv_generator
205#: field:hr.ins.csv.generator.generator.wizard,date_start:0
206msgid "Date Start"
207msgstr "Fecha Inicial"
208
209#. module: ins_csv_generator
210#: field:hr.ins.csv.generator.generator.wizard,salary_rule_id:0
211msgid "Salary Rule"
212msgstr "Regla de Salario"
213
0214
=== added file 'l10n_cr_hr_ins_csv_generator/l10n_cr_hr_ins_csv_generator.py'
--- l10n_cr_hr_ins_csv_generator/l10n_cr_hr_ins_csv_generator.py 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/l10n_cr_hr_ins_csv_generator.py 2013-10-15 19:06:07 +0000
@@ -0,0 +1,55 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Addons modules by CLEARCORP S.A.
6# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import osv, fields
24
25class hrEmployee(osv.Model):
26 _inherit = 'hr.employee'
27
28 _defaults = {
29 'ins_exportable': True,
30 'ins_working_day': 'Tiempo completo',
31 'ins_paid_days': 30,
32 'ins_paid_hours': 240,
33 }
34
35 _columns = {
36 'ins_exportable': fields.boolean('Export?'),
37 'ins_id_type': fields.selection([
38 ('CN','Cédula Nacional'),
39 ('CR','Cédula Residencia'),
40 ('NP', 'Número Pasaporte'),
41 ('PT','Permiso Trabajo'),
42 ('SD','Sin Documentos'),
43 ], 'Id Type'),
44 'ins_name': fields.char('Name', size=128),
45 'ins_last_name1': fields.char('First Last Name', size=128),
46 'ins_last_name2': fields.char('Second Last Name', size=128),
47 'ins_working_day': fields.selection([('Tiempo completo','Tiempo completo'),
48 ('Medio tiempo','Medio tiempo'),
49 ('Ocasional','Ocasional'),
50 ('Por jornales','Por jornales'),
51 ],'Working Day'),
52 'ins_paid_days': fields.integer('Paid Days'),
53 'ins_paid_hours': fields.integer('Paid Hours'),
54 'ins_job_code': fields.char('Job Code'),
55 }
0\ No newline at end of file56\ No newline at end of file
157
=== added directory 'l10n_cr_hr_ins_csv_generator/tools'
=== added file 'l10n_cr_hr_ins_csv_generator/tools/__init__.py'
--- l10n_cr_hr_ins_csv_generator/tools/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/tools/__init__.py 2013-10-15 19:06:07 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Addons modules by CLEARCORP S.A.
6# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import custom_encoder
0\ No newline at end of file24\ No newline at end of file
125
=== added file 'l10n_cr_hr_ins_csv_generator/tools/custom_encoder.py'
--- l10n_cr_hr_ins_csv_generator/tools/custom_encoder.py 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/tools/custom_encoder.py 2013-10-15 19:06:07 +0000
@@ -0,0 +1,87 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Addons modules by CLEARCORP S.A.
6# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import base64
24import cStringIO
25import csv
26
27import openerp.pooler as pooler
28
29def encodeInsCsv(cr, uid, date_start, date_end, code, context=None):
30 def _information_export(buffer, cr, uid, code, context):
31 def _get_user_wage(cr, uid, pool, date_start, date_end, code, id, context):
32 payslip_obj = pool.get('hr.payslip')
33 payslip_ids = payslip_obj.search(cr, uid, [('employee_id','=',id),('date_to','>=',date_start),('date_to','<=',date_end)], context=context)
34 payslips = payslip_obj.browse(cr, uid, payslip_ids, context=context)
35 wage_sum = 0
36 for payslip in payslips:
37 for line in payslip.line_ids:
38 if line.salary_rule_id.code == code:
39 wage_sum+= line.total
40 return int(wage_sum)
41
42 def _encode(s):
43 if isinstance(s, unicode):
44 return s.encode('utf8')
45 else:
46 if isinstance(s,bool):
47 return ""
48 return str(s)
49
50 def _process(employees, buffer):
51 writer = csv.writer(buffer, 'excel', delimiter=';')
52 # write header first
53 writer.writerow(("TI","NA","N° Cedula","N° Asegurado","Nombre",
54 "Apellido1","Apellido2","Tipo Jornada","Dias",
55 "Horas","Salario","Observaciones","Ocupacion"))
56 for tuple in employees:
57 employee = tuple[0]
58 writer.writerow((_encode(employee.ins_id_type),
59 _encode(employee.country_id.code),
60 _encode(employee.identification_id),
61 _encode(employee.sinid),
62 _encode(employee.ins_name),
63 _encode(employee.ins_last_name1),
64 _encode(employee.ins_last_name2),
65 _encode(employee.ins_working_day),
66 _encode(employee.ins_paid_days),
67 _encode(employee.ins_paid_hours),
68 _encode(tuple[1]),
69 "",#Observations are not added automatically
70 _encode(employee.ins_job_code)))
71
72 dbname = cr.dbname
73 pool = pooler.get_pool(dbname)
74 employee_obj = pool.get('hr.employee')
75 employee_ids = employee_obj.search(cr, uid, [('ins_exportable','=',True)], context=context)
76 employees = employee_obj.browse(cr, uid, employee_ids, context=context)
77 tmp_employees = []
78 for employee in employees:
79 ins_wage = _get_user_wage(cr,uid,pool,date_start,date_end,code,employee.id,context)
80 tmp_employees.append((employee,ins_wage))
81 _process(tmp_employees, buffer)
82
83 buffer = cStringIO.StringIO()
84 _information_export(buffer,cr,uid,code,context)
85 out = base64.encodestring(buffer.getvalue())
86 buffer.close()
87 return out
0\ No newline at end of file88\ No newline at end of file
189
=== added directory 'l10n_cr_hr_ins_csv_generator/view'
=== added file 'l10n_cr_hr_ins_csv_generator/view/l10n_cr_hr_ins_csv_generator_view.xml'
--- l10n_cr_hr_ins_csv_generator/view/l10n_cr_hr_ins_csv_generator_view.xml 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/view/l10n_cr_hr_ins_csv_generator_view.xml 2013-10-15 19:06:07 +0000
@@ -0,0 +1,43 @@
1<?xml version="1.0" encoding="UTF-8"?>
2
3<openerp>
4 <data>
5 <!-- Views -->
6 <record model="ir.ui.view" id ="ins_csv_generator_employee_form_view">
7 <field name="name">ins.csv.generator.employee.form.view</field>
8 <field name="model">hr.employee</field>
9 <field name="priority" eval="16"/>
10 <field name="inherit_id" ref="hr.view_employee_form"/>
11 <field name="arch" type="xml">
12 <xpath expr="//page[@string='HR Settings']" position="after">
13 <page string="INS Information">
14 <group name="ins_information_group" colspan="4" col="2">
15 <group colspan="1" col="2">
16 <separator string="Identification Information" colspan="2"/>
17 <field name="ins_id_type"/>
18 <field name="sinid"/>
19 </group>
20 <group colspan="1" col="2">
21 <separator string="Full Name Configuration" colspan="2"/>
22 <field name="ins_name"/>
23 <field name="ins_last_name1"/>
24 <field name="ins_last_name2"/>
25 </group>
26 <group colspan="1" col="2">
27 <separator string="Working Information" colspan="2"/>
28 <field name="ins_working_day"/>
29 <field name="ins_paid_days"/>
30 <field name="ins_paid_hours"/>
31 <field name="ins_job_code"/>
32 </group>
33 <group colspan="1" col="2">
34 <separator string="Others" colspan="2"/>
35 <field name="ins_exportable"/>
36 </group>
37 </group>
38 </page>
39 </xpath>
40 </field>
41 </record>
42 </data>
43</openerp>
0\ No newline at end of file44\ No newline at end of file
145
=== added directory 'l10n_cr_hr_ins_csv_generator/wizard'
=== added file 'l10n_cr_hr_ins_csv_generator/wizard/__init__.py'
--- l10n_cr_hr_ins_csv_generator/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/wizard/__init__.py 2013-10-15 19:06:07 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Addons modules by CLEARCORP S.A.
6# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import l10n_cr_hr_ins_csv_generator_wizard
0\ No newline at end of file24\ No newline at end of file
125
=== added file 'l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard.py'
--- l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard.py 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard.py 2013-10-15 19:06:07 +0000
@@ -0,0 +1,65 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Addons modules by CLEARCORP S.A.
6# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22import base64
23import cStringIO
24
25from openerp.osv import osv, fields
26from ..tools import custom_encoder
27
28class generatorWizardCreate(osv.TransientModel):
29
30 _name = "hr.ins.csv.generator.generator.wizard"
31
32 _columns = {
33 'name': fields.char('Name', size=128),
34 'salary_rule_id':fields.many2one('hr.salary.rule','Salary Rule', required=True),
35 'date_start': fields.date('Date Start', required=True),
36 'date_end': fields.date('Date End', required=True),
37 'data': fields.binary('File', readonly=True),
38 'state': fields.selection([('generate','generate'), # generate file
39 ('get','get')], string="State"), # get the file
40 }
41
42 _defaults = {
43 'state': 'generate',
44 }
45
46 def generate_csv(self, cr, uid, ids, context=None):
47 this = self.browse(cr, uid, ids)[0]
48 this.name = 'ins_generated_file.csv'
49 out = custom_encoder.encodeInsCsv(cr, uid, this.date_start,this.date_end,
50 this.salary_rule_id.code, context)
51 self.write(cr, uid, ids, {
52 'state': 'get',
53 'data': out,
54 'name':this.name}, context=context)
55 return {
56 'type': 'ir.actions.act_window',
57 'res_model': 'hr.ins.csv.generator.generator.wizard',
58 'view_mode': 'form',
59 'view_type': 'form',
60 'res_id': this.id,
61 'views': [(False, 'form')],
62 'target': 'new',
63 }
64
65# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file66\ No newline at end of file
167
=== added file 'l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml'
--- l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_menu.xml 2013-10-15 19:06:07 +0000
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="UTF-8"?>
2
3<openerp>
4 <data>
5 <menuitem id="menu_generator"
6 parent="hr.menu_hr_main"
7 name="Generate INS File"
8 sequence="100"
9 action="action_generator_wizard_create"/>
10 </data>
11</openerp>
0\ No newline at end of file12\ No newline at end of file
113
=== added file 'l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml'
--- l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml 1970-01-01 00:00:00 +0000
+++ l10n_cr_hr_ins_csv_generator/wizard/l10n_cr_hr_ins_csv_generator_wizard_view.xml 2013-10-15 19:06:07 +0000
@@ -0,0 +1,41 @@
1<?xml version="1.0" encoding="UTF-8"?>
2
3<openerp>
4 <data>
5 <!-- Views -->
6 <record model="ir.ui.view" id ="ins_csv_generator_generator_wizard_create_form">
7 <field name="name">ins.csv.generator.generator.wizard.create.form</field>
8 <field name="model">hr.ins.csv.generator.generator.wizard</field>
9 <field name="priority" eval="16"/>
10 <field name="arch" type="xml">
11 <form string="Wizard" version="7.0">
12 <sheet>
13 <field invisible="1" name="state"/>
14 <group states="get">
15 <p>Encoded text file: <field name="data" readonly="1" filename="name"/></p>
16 </group>
17 <group states="generate" colspan="4" col="2">
18 <separator string="Fill the required fields" colspan="2"/>
19 <field name="salary_rule_id"/>
20 <field name="date_start"/>
21 <field name="date_end"/>
22 </group>
23 </sheet>
24 <footer states="generate">
25 <button type="object" name="generate_csv" string="Generate csv File" icon="gtk-ok"
26 confirm="Are you sure you want to generate the csv file?" class="oe_highlight" />
27 <button type="special" special="cancel" string="Cancel" class="oe_link" />
28 </footer>
29 </form>
30 </field>
31 </record>
32
33 <!-- Actions -->
34 <act_window id="action_generator_wizard_create"
35 name="INS csv Generator"
36 res_model="hr.ins.csv.generator.generator.wizard"
37 view_mode="form"
38 target="new"
39 />
40 </data>
41</openerp>
0\ No newline at end of file42\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: