Merge lp:~inddiana/diana-addons/imp_he_biostar into lp:diana-addons/6.0
- imp_he_biostar
- Merge into trunk-2
Proposed by
Aristóbulo Meneses
Status: | Merged |
---|---|
Merged at revision: | 15 |
Proposed branch: | lp:~inddiana/diana-addons/imp_he_biostar |
Merge into: | lp:diana-addons/6.0 |
Diff against target: |
3822 lines (+3662/-0) 31 files modified
diana_integracion_biostar/__init__.py (+3/-0) diana_integracion_biostar/__openerp__.py (+32/-0) diana_integracion_biostar/data/horas_extras_tipos.xml (+67/-0) diana_integracion_biostar/horas_extras_seq.xml (+26/-0) diana_integracion_biostar/model/__init__.py (+3/-0) diana_integracion_biostar/model/biostar.py (+183/-0) diana_integracion_biostar/model/horas_extras.py (+706/-0) diana_integracion_biostar/model/hr_employee.py (+16/-0) diana_integracion_biostar/report/__init__.py (+7/-0) diana_integracion_biostar/report/horas_extras_planificacion.py (+37/-0) diana_integracion_biostar/report/horas_extras_planificacion.rml (+525/-0) diana_integracion_biostar/report/horas_extras_planificacion.xml (+23/-0) diana_integracion_biostar/report/horas_marcaje_report.py (+44/-0) diana_integracion_biostar/report/horas_marcaje_report.rml (+246/-0) diana_integracion_biostar/view/__init__.py (+1/-0) diana_integracion_biostar/view/biostar_view.xml (+86/-0) diana_integracion_biostar/view/horas_extras_view.xml (+298/-0) diana_integracion_biostar/view/hr_employee_view.xml (+22/-0) diana_integracion_biostar/wizard/__init__.py (+6/-0) diana_integracion_biostar/wizard/consultar_retardos_view.xml (+70/-0) diana_integracion_biostar/wizard/consultar_retardos_wizard.py (+270/-0) diana_integracion_biostar/wizard/export_biostar.py (+108/-0) diana_integracion_biostar/wizard/export_biostar_view.xml (+28/-0) diana_integracion_biostar/wizard/horas_extras_excepcion_view.xml (+39/-0) diana_integracion_biostar/wizard/horas_extras_execpcion_wizard.py (+101/-0) diana_integracion_biostar/wizard/horas_extras_planificacion_view.xml (+30/-0) diana_integracion_biostar/wizard/horas_extras_wizard.py (+69/-0) diana_integracion_biostar/wizard/horas_marcaje_view.xml (+71/-0) diana_integracion_biostar/wizard/horas_marcaje_wizard.py (+199/-0) diana_integracion_biostar/wizard/horas_retardo_wizard.py (+318/-0) diana_integracion_biostar/wizard/horas_retardo_wizard.xml (+28/-0) |
To merge this branch: | bzr merge lp:~inddiana/diana-addons/imp_he_biostar |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Industrias Diana | Pending | ||
Review via email: mp+169937@code.launchpad.net |
Commit message
Description of the change
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 'diana_integracion_biostar' |
2 | === added file 'diana_integracion_biostar/__init__.py' |
3 | --- diana_integracion_biostar/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ diana_integracion_biostar/__init__.py 2013-06-17 20:23:29 +0000 |
5 | @@ -0,0 +1,3 @@ |
6 | +import model |
7 | +import wizard |
8 | +import report |
9 | |
10 | === added file 'diana_integracion_biostar/__openerp__.py' |
11 | --- diana_integracion_biostar/__openerp__.py 1970-01-01 00:00:00 +0000 |
12 | +++ diana_integracion_biostar/__openerp__.py 2013-06-17 20:23:29 +0000 |
13 | @@ -0,0 +1,32 @@ |
14 | + { |
15 | + "name" : "Diana Horas Extra", |
16 | + "version" : "1.0", |
17 | + 'category': 'Human Resources', |
18 | + "author" : "Industrias Diana C.A.", |
19 | + "category" : "", |
20 | + "website" : "http://www.industriasdiana.gob.ve", |
21 | + "depends" : ["sisb_nomina"], |
22 | + "description": """ Modulo para calculo y verificacion de horas extra |
23 | + contra sistema de marcaje biometrico Suprema Biostar |
24 | + """, |
25 | + "update_xml" : [ |
26 | + 'wizard/horas_extras_excepcion_view.xml', |
27 | + 'wizard/horas_extras_planificacion_view.xml', |
28 | + 'wizard/horas_retardo_wizard.xml', |
29 | + 'wizard/horas_marcaje_view.xml', |
30 | + 'wizard/export_biostar_view.xml', |
31 | + 'wizard/consultar_retardos_view.xml', |
32 | + 'view/horas_extras_view.xml', |
33 | + 'view/biostar_view.xml', |
34 | + 'view/hr_employee_view.xml', |
35 | + 'data/horas_extras_tipos.xml', |
36 | + 'horas_extras_seq.xml', |
37 | + 'report/horas_extras_planificacion.xml' |
38 | + ], |
39 | + "active": False, |
40 | + "installable": True, |
41 | + 'external_dependencies': { |
42 | + 'python': ['pyodbc','pip',], |
43 | + 'bin': ['odbcinst', 'isql', 'tsql',], |
44 | + }, |
45 | + } |
46 | |
47 | === added directory 'diana_integracion_biostar/data' |
48 | === added file 'diana_integracion_biostar/data/horas_extras_tipos.xml' |
49 | --- diana_integracion_biostar/data/horas_extras_tipos.xml 1970-01-01 00:00:00 +0000 |
50 | +++ diana_integracion_biostar/data/horas_extras_tipos.xml 2013-06-17 20:23:29 +0000 |
51 | @@ -0,0 +1,67 @@ |
52 | +<?xml version="1.0" encoding="utf-8"?> |
53 | +<openerp> |
54 | +<data noupdate="1"> |
55 | + |
56 | + <record id="tipo1" model="horas.extras.planificacion.tipos"> |
57 | + <field name="name">PE</field> |
58 | + <field name="descripcion">PERMISO</field> |
59 | + </record> |
60 | + <record id="tipo2" model="horas.extras.planificacion.tipos"> |
61 | + <field name="name">RE</field> |
62 | + <field name="descripcion">REPOSO</field> |
63 | + </record> |
64 | + <record id="tipo3" model="horas.extras.planificacion.tipos"> |
65 | + <field name="name">DC</field> |
66 | + <field name="descripcion">DESCANSO</field> |
67 | + </record> |
68 | + <record id="tipo4" model="horas.extras.planificacion.tipos"> |
69 | + <field name="name">VA</field> |
70 | + <field name="descripcion">VACACIONES</field> |
71 | + </record> |
72 | + <record id="tipo5" model="horas.extras.planificacion.tipos"> |
73 | + <field name="name">AC</field> |
74 | + <field name="descripcion">ADIESTRAMIENTO/CURSO</field> |
75 | + </record> |
76 | + <record id="tipo6" model="horas.extras.planificacion.tipos"> |
77 | + <field name="name">MC</field> |
78 | + <field name="descripcion">MANTENIMIENTO</field> |
79 | + </record> |
80 | + <record id="tipo7" model="horas.extras.planificacion.tipos"> |
81 | + <field name="name">MP</field> |
82 | + <field name="descripcion">MANTENIMIENTO PROGRAMADO</field> |
83 | + </record> |
84 | + <record id="tipo8" model="horas.extras.planificacion.tipos"> |
85 | + <field name="name">EJ</field> |
86 | + <field name="descripcion">EJECUCION DE PROYECTOS</field> |
87 | + </record> |
88 | + |
89 | + <record id="tipo9" model="horas.extras.planificacion.tipos"> |
90 | + <field name="name">PD</field> |
91 | + <field name="descripcion">PLANIFICACION DE DESPACHO</field> |
92 | + </record> |
93 | + <record id="tipo10" model="horas.extras.planificacion.tipos"> |
94 | + <field name="name">RM</field> |
95 | + <field name="descripcion">RECEPCION DE MATERIALES</field> |
96 | + </record> |
97 | + <record id="tipo11" model="horas.extras.planificacion.tipos"> |
98 | + <field name="name">OL</field> |
99 | + <field name="descripcion">OPERATIVO DE LIMPIEZA</field> |
100 | + </record> |
101 | + <record id="tipo12" model="horas.extras.planificacion.tipos"> |
102 | + <field name="name">PT</field> |
103 | + <field name="descripcion">PROCESO DE TRANSACCIONES</field> |
104 | + </record> |
105 | + <record id="tipo13" model="horas.extras.planificacion.tipos"> |
106 | + <field name="name">IV</field> |
107 | + <field name="descripcion">INVENTARIO</field> |
108 | + </record> |
109 | + <record id="tipo14" model="horas.extras.planificacion.tipos"> |
110 | + <field name="name">PA</field> |
111 | + <field name="descripcion">PARADA DE PLANTA</field> |
112 | + </record> |
113 | + <record id="tipo15" model="horas.extras.planificacion.tipos"> |
114 | + <field name="name">OT</field> |
115 | + <field name="descripcion">OTRO ESPECIFIQUE</field> |
116 | + </record> |
117 | +</data> |
118 | +</openerp> |
119 | |
120 | === added file 'diana_integracion_biostar/horas_extras_seq.xml' |
121 | --- diana_integracion_biostar/horas_extras_seq.xml 1970-01-01 00:00:00 +0000 |
122 | +++ diana_integracion_biostar/horas_extras_seq.xml 2013-06-17 20:23:29 +0000 |
123 | @@ -0,0 +1,26 @@ |
124 | +<?xml version="1.0" encoding="utf-8"?> |
125 | +<openerp> |
126 | + <data noupdate="1"> |
127 | + <!-- |
128 | + Tipo de secuencia para horas extras |
129 | + --> |
130 | + |
131 | + <record id="seq_type_romana" model="ir.sequence.type"> |
132 | + <field name="name">horas_extras</field> |
133 | + <field name="code">horas_extras_tseq</field> |
134 | + </record> |
135 | + |
136 | + |
137 | + <!-- |
138 | + Secuencia para horas extras |
139 | + --> |
140 | + |
141 | + <record id="seq_horas_extras" model="ir.sequence"> |
142 | + <field name="name">horas_extras</field> |
143 | + <field name="code">horas_extras_tseq</field> |
144 | + <field name="prefix">hr/</field> |
145 | + <field name="padding">9</field> |
146 | + </record> |
147 | + |
148 | + </data> |
149 | +</openerp> |
150 | |
151 | === added directory 'diana_integracion_biostar/model' |
152 | === added file 'diana_integracion_biostar/model/__init__.py' |
153 | --- diana_integracion_biostar/model/__init__.py 1970-01-01 00:00:00 +0000 |
154 | +++ diana_integracion_biostar/model/__init__.py 2013-06-17 20:23:29 +0000 |
155 | @@ -0,0 +1,3 @@ |
156 | +import biostar |
157 | +import horas_extras |
158 | +import hr_employee |
159 | |
160 | === added file 'diana_integracion_biostar/model/biostar.py' |
161 | --- diana_integracion_biostar/model/biostar.py 1970-01-01 00:00:00 +0000 |
162 | +++ diana_integracion_biostar/model/biostar.py 2013-06-17 20:23:29 +0000 |
163 | @@ -0,0 +1,183 @@ |
164 | +#!/usr/bin/env python |
165 | +# -*- coding: utf-8 -*- |
166 | + |
167 | +import pyodbc |
168 | +import os |
169 | +import shutil |
170 | +import commands |
171 | +from osv import fields, osv |
172 | + |
173 | + |
174 | +from osv import osv, fields |
175 | + |
176 | +class biostar_settings(osv.osv): |
177 | + _name='biostar.settings' |
178 | + _description = 'modulo de configuracion para la conexcion de odbc' |
179 | + _columns = { |
180 | + 'ip': fields.char('Direccion ip', size=16, required=True), |
181 | + 'data_base': fields.char('Base de datos', size=60, required=True), |
182 | + 'port': fields.integer('Puerto', size=5, required=True), |
183 | + 'user': fields.char('Usuario', size=64, required=True), |
184 | + 'password': fields.char('Contraseña', size=64, required=True), |
185 | + 'active': fields.boolean('Activo'), |
186 | + 'state': fields.selection([('draft','Borrardor'), ('confirmed','Confirmado')],'Estado',required=True,readonly=True), |
187 | + } |
188 | + _defaults = { |
189 | + 'state': lambda *a: 'draft', |
190 | + 'active': lambda *a: True, |
191 | + 'port': lambda *a: '1433', |
192 | + 'data_base': lambda *a: 'BioStar' |
193 | + } |
194 | + |
195 | + def _check_active(self,cr, uid, ids): |
196 | + n = self.search(cr, uid, [('active', '=', 'True')]) |
197 | + if len(n) > 1: |
198 | + return False |
199 | + |
200 | + return True |
201 | + |
202 | + _constraints = [(_check_active,'Usted no puede guardar otra conexion si ya una esta activa!', ['active'])] |
203 | + |
204 | + |
205 | + def create(self, cr, uid, values, context=None): |
206 | + super(biostar_settings, self).create(cr, uid, values, context=None) |
207 | + self.settings_odbc(cr, uid, context) |
208 | + return True |
209 | + |
210 | + |
211 | + |
212 | + def settings_odbc(self, cr, uid, context = None): |
213 | + |
214 | + """ |
215 | + metodo para configurar los archivos /etc/odbc.ini, /etc/odbcinst.ini , |
216 | + /etc/freetds/freetds.conf para conexión unixODBC |
217 | + """ |
218 | + arq = commands.getoutput('arch') |
219 | + |
220 | + if arq == 'i686' or arq == 'i386': |
221 | + driv = "Driver=/usr/lib/i386-linux-gnu/odbc/libtdsodbc.so" |
222 | + setup = "Setup=/usr/lib/i386-linux-gnu/odbc/libtdsS.so" |
223 | + else: |
224 | + driv = "Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so" |
225 | + setup = "Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so" |
226 | + |
227 | + home = os.environ['HOME'] |
228 | + homeodbc = os.path.join(home, '.odbc.ini') |
229 | + |
230 | + if os.path.isfile(homeodbc): |
231 | + f = open(homeodbc, 'w') |
232 | + f.writelines('\n[FreeTDS]') |
233 | + f.writelines('\nDescription = TDS driver (Sybase/MS SQL)') |
234 | + f.writelines('\n'+driv) |
235 | + f.writelines('\n'+setup) |
236 | + f.writelines('\nUsageCount = 1') |
237 | + f.close() |
238 | + else: |
239 | + f = open(homeodbc, 'w') |
240 | + f.writelines('[FreeTDS]') |
241 | + f.writelines('\nDescription = TDS driver (Sybase/MS SQL)') |
242 | + f.writelines('\n'+driv) |
243 | + f.writelines('\n'+setup) |
244 | + f.writelines('\nUsageCount = 1') |
245 | + f.close() |
246 | + |
247 | + |
248 | + |
249 | + def test_connection(self, cr, uid, ids, context=None): |
250 | + |
251 | + home = os.environ['HOME'] |
252 | + parans_brw = self.browse(cr, uid, ids) |
253 | + for i in parans_brw: |
254 | + user = i.user |
255 | + passwd = i.password |
256 | + db = i.data_base |
257 | + host = i.ip |
258 | + port = i.port |
259 | + data = i.id |
260 | + |
261 | + conex = "UID=%s;PWD=%s;DRIVER={FreeTDS};SERVER=%s;PORT=%s;DATABASE=%s" %(user, passwd, host, port, db) |
262 | + try: |
263 | + cnx = pyodbc.connect(conex) |
264 | + self.write(cr, uid, data, {'state': 'confirmed', }) |
265 | + except pyodbc.DatabaseError, err: |
266 | + raise osv.except_osv('ERROR', err) |
267 | + except pyodbc.DataError, err: |
268 | + raise osv.except_osv('ERROR', err) |
269 | + except pyodbc.Error, err: |
270 | + raise osv.except_osv('ERROR', 'Antes de comprobar la conexión por primera vez ejecute este comadno "sudo odbcinst -i -d -f %s/.odbc.ini"' %home ) |
271 | + raise osv.except_osv('ERROR', err ) |
272 | + except pyodbc.InternalError, err: |
273 | + raise osv.except_osv('ERROR', err) |
274 | + except pyodbc.InterfaceError, err: |
275 | + raise osv.except_osv('ERROR', err) |
276 | + except pyodbc.DatabaseError, err: |
277 | + raise osv.except_osv('ERROR', err) |
278 | + except pyodbc.IntegrityError, err: |
279 | + raise osv.except_osv('ERROR', err) |
280 | + return True |
281 | + |
282 | + def fingerprint(self, cr, uid, ids, context = None): |
283 | + parans_brw = self.browse(cr, uid, ids) |
284 | + for i in parans_brw: |
285 | + user = i.user |
286 | + passwd = i.password |
287 | + db = i.data_base |
288 | + host = i.ip |
289 | + port = i.port |
290 | + data = i.id |
291 | + |
292 | + |
293 | + try: |
294 | + conex = "UID=%s;PWD=%s;DRIVER={FreeTDS};SERVER=%s;PORT=%s;DATABASE=%s" %(user, passwd, host, port, db) |
295 | + cnx = pyodbc.connect(conex) |
296 | + cursor = cnx.cursor() |
297 | + cursor.execute('select nReaderIdn, sName, sIP from TB_READER') |
298 | + rows = cursor.fetchall() |
299 | + d = {} |
300 | + for row in rows: |
301 | + d['nombre'] = row[1] |
302 | + d['reader_id'] = row[0] |
303 | + d['ip'] = row[2] |
304 | + self.check_fingerprint(cr, uid, ids, row[0], d, context = None) |
305 | + except pyodbc.Error, err: |
306 | + raise osv.except_osv('ERROR', "Fallo de conexión") |
307 | + |
308 | + def check_fingerprint(self, cr, uid, ids, vid, valor, context = None): |
309 | + obj = self.pool.get('biostar.fingerprint') |
310 | + s = obj.search(cr, uid, [('reader_id', '=', vid )]) |
311 | + if len(s) == 1: |
312 | + obj.write(cr, uid, ids, valor) |
313 | + else: |
314 | + obj.create(cr, uid, valor, context=None) |
315 | + |
316 | + return True |
317 | + |
318 | + |
319 | + |
320 | + |
321 | + |
322 | +biostar_settings() |
323 | + |
324 | + |
325 | +class biostar_fingerprint(osv.osv): |
326 | + |
327 | + _name = 'biostar.fingerprint' |
328 | + _description = 'modulo para definir capta huellas' |
329 | + _rec_name = 'nombre' |
330 | + _columns = { |
331 | + 'nombre': fields.char('Nombre', size=64, required=True, readonly=True), |
332 | + 'reader_id': fields.integer('Id', size=5, required=True, readonly=True), |
333 | + 'ip': fields.char('Direccion ip', size=16, required=True, readonly=True), |
334 | + 'valido': fields.boolean('Valido'), |
335 | + } |
336 | + |
337 | + _defaults = { |
338 | + 'valido': lambda *a: False, |
339 | + } |
340 | + |
341 | +biostar_fingerprint() |
342 | + |
343 | + |
344 | + |
345 | + |
346 | + |
347 | |
348 | === added file 'diana_integracion_biostar/model/horas_extras.py' |
349 | --- diana_integracion_biostar/model/horas_extras.py 1970-01-01 00:00:00 +0000 |
350 | +++ diana_integracion_biostar/model/horas_extras.py 2013-06-17 20:23:29 +0000 |
351 | @@ -0,0 +1,706 @@ |
352 | +#!/usr/bin/env python |
353 | +# -*- coding: utf-8 -*- |
354 | + |
355 | +from osv import fields, osv |
356 | +import pyodbc |
357 | +import datetime |
358 | + |
359 | + |
360 | + |
361 | +class horas_extras_planificacion_tipos(osv.osv): |
362 | + |
363 | + _name = 'horas.extras.planificacion.tipos' |
364 | + _description = 'tipos de planificacion de sobretiempo' |
365 | + _rec_name = 'descripcion' |
366 | + _columns = { |
367 | + 'name': fields.char('Tipo', size=60), |
368 | + 'descripcion': fields.char('Descripcion', size=60), |
369 | + 'parent_id': fields.many2one('horas.extras.planificacion.tipos', 'Padre Tipos', select=True), |
370 | + 'child_ids': fields.one2many('horas.extras.planificacion.tipos', 'parent_id', 'tipos hijos'), |
371 | + } |
372 | +horas_extras_planificacion_tipos() |
373 | + |
374 | + |
375 | +class horas_extras_planificacion(osv.osv): |
376 | + |
377 | + _name = 'horas.extras.planificacion' |
378 | + _description = 'formato de horas extras' |
379 | + _columns = { |
380 | + 'name': fields.char('name', size=64), |
381 | + 'fecha': fields.date('Fecha', required=True, readonly=True), |
382 | + 'departamento_id': fields.many2one('hr.department', 'Departamento', required=True), |
383 | + 'fecha_sobre_tiempo': fields.date('Fecha de Sobretiempo', required=True,), |
384 | + 'referencia': fields.char('Referencia', size=64, required=True, readonly=True), |
385 | + 'state': fields.selection([('draft','Borrardor'), ('confirmed','Confirmado'), ('done','Aprobado'), ('cancel','Cancelado')],'Estado',required=True,readonly=True), |
386 | + } |
387 | + |
388 | + |
389 | + |
390 | + _defaults = { |
391 | + 'fecha': lambda *a : datetime.datetime.now().strftime("%Y-%m-%d"), |
392 | + 'state': lambda *a : 'draft', |
393 | + 'referencia': lambda *a: '/' |
394 | + |
395 | + } |
396 | + |
397 | + |
398 | + |
399 | + |
400 | + def onchange_departamento(self, cr, uid, ids, campo, context=None): |
401 | + if len(campo) >= 1: |
402 | + data = self.read(cr, uid, ids, ['departamento_id'],context=context)[0] |
403 | + return {'value': {'departamento_id':data['departamento_id'][0]},'warning': {'message': 'Debe borrar las lineas si desea cambiar el departamento.'}} |
404 | + return True |
405 | + |
406 | + |
407 | + |
408 | + |
409 | + |
410 | +horas_extras_planificacion() |
411 | + |
412 | + |
413 | +class horas_extras_planificacion_lineas(osv.osv): |
414 | + |
415 | + _name = 'horas.extras.planificacion.lineas' |
416 | + _description = 'formato de horas extras' |
417 | + _columns = { |
418 | + 'name': fields.char('Lineas de horas extras', size=64), |
419 | + 'empleado_id': fields.many2one('hr.employee', 'Trabajador', required=True), |
420 | + 'hora_desde': fields.time('Hora desde', required=True), |
421 | + 'hora_hasta': fields.time('Hora hasta', required=True), |
422 | + 'observacion': fields.text('Observacion', required=True), |
423 | + 'serv_comida': fields.boolean('Servicio de comida'), |
424 | + |
425 | + 'horas_extras_planificacion_id': fields.many2one('horas.extras.planificacion', 'Planificacion de horas extras', readonly=True), |
426 | + 'tipo': fields.many2one('horas.extras.planificacion.tipos', 'Tipo', required=True), |
427 | + } |
428 | + |
429 | + def _check_hora(self, cr, uid, ids, conetxt=None): |
430 | + hel_brw = self.browse(cr, uid, ids) |
431 | + for i in hel_brw: |
432 | + if datetime.datetime.strptime(i.hora_hasta, "%H:%M:%S") <= datetime.datetime.strptime(i.hora_desde, "%H:%M:%S"): |
433 | + return False |
434 | + return True |
435 | + |
436 | + _constraints = [(_check_hora,'La Hora final del sobre tiempo no puede ser menor que la hora de inicio', ['hora_hasta'])] |
437 | + |
438 | +horas_extras_planificacion_lineas() |
439 | + |
440 | + |
441 | +class horas_extras_planificacion(osv.osv): |
442 | + _inherit = 'horas.extras.planificacion' |
443 | + _columns = { |
444 | + 'planificacion_lineas_ids': fields.one2many('horas.extras.planificacion.lineas', 'horas_extras_planificacion_id', 'Lineas de planificacion de horas extras'), |
445 | + |
446 | + } |
447 | + |
448 | + def _check_fecha(self, cr, uid, ids, context=None): |
449 | + hel_brw = self.browse(cr, uid, ids) |
450 | + for i in hel_brw: |
451 | + if datetime.datetime.strptime(i.fecha_sobre_tiempo, "%Y-%m-%d") >= datetime.datetime.strptime(i.fecha, "%Y-%m-%d"): |
452 | + return True |
453 | + |
454 | + return False |
455 | + |
456 | + _constraints = [(_check_fecha,'La fecha de sobretiempo no puede ser menor a la fecha actual', ['fecha_sobre_tiempo'])] |
457 | + |
458 | + def confirmed(self, cr, uid, ids, contex = None): |
459 | + self.write(cr, uid, ids, {'state': 'confirmed', }) |
460 | + return True |
461 | + |
462 | + def cancel(self, cr, uid, ids, contex = None): |
463 | + self.write(cr, uid, ids, {'state': 'cancel', }) |
464 | + return True |
465 | + |
466 | + def create(self, cr, uid, vals, context=None): |
467 | + if ('referencia' not in vals) or (vals.get('referencia') == '/'): |
468 | + vals['referencia'] = self.pool.get('ir.sequence').get(cr, uid, 'horas_extras_tseq') |
469 | + return super(horas_extras_planificacion, self).create(cr, uid, vals, context) |
470 | + |
471 | + |
472 | +horas_extras_planificacion() |
473 | + |
474 | +class horas_extras(osv.osv): |
475 | + |
476 | + _name = 'horas.extras' |
477 | + _description = 'horas extras' |
478 | + _rec_name='referencia' |
479 | + _columns = { |
480 | + 'referencia': fields.char('Referencia', size=60, required=True), |
481 | + 'concepto_id': fields.many2one('hr.variable.concepts', 'Concepto', required=True), |
482 | + 'planificacion_id': fields.many2one('horas.extras.planificacion', 'hora extra planificacion', readonly=True), |
483 | + 'state': fields.selection([('draft','Borrardor'), ('confirmed','Confirmado'),('revised','Revisado'), ('exception','Excepcion'), ('done','Listo')],'Estado',required=True,readonly=True), |
484 | + } |
485 | + _defaults = { |
486 | + 'state': lambda *a : 'draft', |
487 | + 'referencia': lambda *a : '/' |
488 | + } |
489 | + |
490 | + |
491 | +horas_extras() |
492 | + |
493 | +class horas_extras_lineas(osv.osv): |
494 | + |
495 | + _name = 'horas.extras.lineas' |
496 | + _description = 'horas_extra' |
497 | + _columns = { |
498 | + 'empleado_id': fields.many2one('hr.employee', 'Trabajador', required=True), |
499 | + 'fecha': fields.date('Fecha', required=True,), |
500 | + 'state': fields.selection([('draft','Borrardor'), ('confirmed','Confirmado'),('revised','Revisado'), ('exception','Excepcion'), ('done','Listo'), ('cancel','Cancelado')],'Estado', readonly=True), |
501 | + 'hora_desde': fields.time('Hora desde', required=False, readonly=True, states={'draft':[('readonly',False)]}), |
502 | + 'hora_hasta': fields.time('Hora hasta', required=True, readonly=True, states={'draft':[('readonly',False)]}), |
503 | + 'horas_extras_id': fields.many2one('horas.extras', 'Horas extra',readonly=True, required=True), |
504 | + 'hora_marcaje_entrada': fields.time('Hora de marcaje entrada', readonly=True), |
505 | + 'hora_marcaje': fields.time('Hora de marcaje', readonly=True), |
506 | + 'create_uid': fields.integer('create uid'), |
507 | + 'observacion': fields.text('Observacion', readonly=True), |
508 | + } |
509 | + |
510 | + |
511 | + _defaults = { |
512 | + 'state': lambda *a : 'draft' |
513 | + } |
514 | + |
515 | + |
516 | + |
517 | + def _check_fecha(self, cr, uid, ids, context=None): |
518 | + hel_brw = self.browse(cr, uid, ids)[0] |
519 | + periodos_brw = hel_brw.horas_extras_id.concepto_id.hr_process_id.hr_period_ids |
520 | + payment_calendar_id = hel_brw.empleado_id.hr_payroll_id.hr_payment_calendar_id.id |
521 | + periodos = [p for p in periodos_brw if p.hr_payment_calendar_id.id == payment_calendar_id] |
522 | + for i in periodos: |
523 | + perid_obj = self.pool.get('hr.period') |
524 | + brw = perid_obj.browse(cr, uid, i.id-1) |
525 | + if hel_brw.fecha <= brw.date_end and hel_brw.fecha >= brw.date_start: |
526 | + return True |
527 | + |
528 | + return False |
529 | + |
530 | + def _check_hora(self, cr, uid, ids, conetxt=None): |
531 | + hel_brw = self.browse(cr, uid, ids) |
532 | + for i in hel_brw: |
533 | + if i.hora_desde: |
534 | + if datetime.datetime.strptime(i.hora_hasta, "%H:%M:%S") <= datetime.datetime.strptime(i.hora_desde, "%H:%M:%S"): |
535 | + return False |
536 | + return True |
537 | + |
538 | + _constraints = [(_check_fecha,'La fecha no pertenece al anterior periodo', ['fecha'])] |
539 | + _constraints = [(_check_hora,'La hora desde no puede ser mayor que la hora hasta', ['hora_desde'])] |
540 | + |
541 | + |
542 | + |
543 | + |
544 | +horas_extras_lineas() |
545 | + |
546 | +class horas_extras(osv.osv): |
547 | + _inherit = 'horas.extras' |
548 | + _columns = { |
549 | + 'lineas_ids': fields.one2many('horas.extras.lineas', 'horas_extras_id', 'Lineas de horas extra'), |
550 | + } |
551 | + |
552 | + |
553 | + |
554 | + def confirmed(self, cr, uid, ids, contex = None): |
555 | + |
556 | + """ |
557 | + Función para confirmar el estado a confirmado |
558 | + """ |
559 | + self.write(cr, uid, ids, {'state': 'confirmed', }) |
560 | + hel_obj = self.pool.get('horas.extras.lineas') |
561 | + hl= hel_obj.search(cr, uid, [('horas_extras_id', 'in', ids)], context = None) |
562 | + hel_obj.write(cr, uid, hl, {'state': 'confirmed', }) |
563 | + return True |
564 | + |
565 | + |
566 | + |
567 | + |
568 | + def revised(self, cr, uid, ids, contex = None): |
569 | + |
570 | + """ |
571 | + funcion para cambiar el estado de confirmado a listo o excepcion |
572 | + haciendo la comparacion de las horas contra el biostart |
573 | + esta funcion depende de las funciones 'query', 'conexion', |
574 | + 'add_overtime', 'unlike_hours' |
575 | + """ |
576 | + |
577 | + dev_obj = self.pool.get('biostar.fingerprint') |
578 | + dev_id = dev_obj.search(cr, uid, [('valido', '=', True)]) |
579 | + dev_brw = dev_obj.browse(cr, uid, dev_id) |
580 | + t = tuple([n.reader_id for n in dev_brw]) |
581 | + |
582 | + tobj = self.pool.get('horas.extras.lineas') |
583 | + t_serh = tobj.search(cr, uid, [('horas_extras_id', 'in', ids)]) |
584 | + t_brw = tobj.browse(cr, uid, t_serh) |
585 | + ih = ids |
586 | + |
587 | + for i in t_brw: |
588 | + fh = i.fecha |
589 | + ha = i.hora_hasta |
590 | + hd = i.hora_desde |
591 | + cod = i.empleado_id.cod_number |
592 | + |
593 | + if hd: |
594 | + self.query2(cr, uid, i.id, cod, fh, hd, ha, t, ih, context = None) |
595 | + |
596 | + else: |
597 | + self.query(cr, uid, i.id, cod, fh, ha, t, ih, context = None) |
598 | + |
599 | + self.review(cr, uid, ids, context = None) |
600 | + |
601 | + |
602 | + return True |
603 | + |
604 | + def conexion(self, cr, uid, ids, context = None): |
605 | + |
606 | + """ |
607 | + Funcion para conectarse al biostar y retornar la conexion |
608 | + para formar el cursor |
609 | + @return cnx: conexion con sql server |
610 | + """ |
611 | + |
612 | + obj = self.pool.get('biostar.settings') |
613 | + ids = obj.search(cr, uid, [('active', '=', True)]) |
614 | + for i in obj.browse(cr, uid, ids): |
615 | + user = i.user |
616 | + passwd = i.password |
617 | + db = i.data_base |
618 | + host = i.ip |
619 | + port = i.port |
620 | + |
621 | + conex = "UID=%s;PWD=%s;DRIVER={FreeTDS};SERVER=%s;PORT=%s;DATABASE=%s" %(user, passwd, host, port, db) |
622 | + try: |
623 | + cnx = pyodbc.connect(conex) |
624 | + return cnx |
625 | + except pyodbc.DatabaseError, err: |
626 | + raise osv.except_osv('ERROR', "Fallo de conexión") |
627 | + |
628 | + |
629 | + |
630 | + def query(self, cr, uid, ids, cod, fh, hora_hasta, t, ids_horas_extras, context = None): |
631 | + |
632 | + """ |
633 | + Funcion para ejecutar la consulta en el BioStar |
634 | + y realisar la comparacion |
635 | + @param cod: codigo del trabajador |
636 | + @param fh: Fecha |
637 | + @param hora_hasta: hora hasta a buscar |
638 | + @param t: Tupla con los ads de los captahuellas |
639 | + @param ids_horas_extras: id de la tabla horas extras |
640 | + @return True |
641 | + """ |
642 | + |
643 | + sql = """ |
644 | + SELECT MAX(CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108)) As hour |
645 | + FROM TB_EVENT_LOG AS EVENT |
646 | + JOIN TB_USER AS U ON EVENT.nUserID = U.sUserId |
647 | + JOIN TB_READER AS READER ON EVENT.nReaderIdn = READER.nReaderIdn JOIN TB_EVENT_DATA AS E_DATA ON EVENT.nEventIdn = E_DATA.nEventIdn |
648 | + JOIN TB_USER_CUSTOMINFO As C ON C.nUserIdn = U.nUserIdn |
649 | + WHERE E_DATA.nEventIdn = 55 |
650 | + AND CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) = '%s' |
651 | + AND READER.nReaderIdn IN %s |
652 | + AND C.sFieldValue5 = %s |
653 | + """ %(fh, t, cod) |
654 | + |
655 | + |
656 | + cnx = self.conexion(cr, uid, ids, context = None) |
657 | + try: |
658 | + cursor = cnx.cursor() |
659 | + except pyodbc.DatabaseError, err: |
660 | + raise osv.except_osv('ERROR', "Error al crear cursor") |
661 | + |
662 | + try: |
663 | + cursor.execute(sql) |
664 | + rows = cursor.fetchall() |
665 | + except pyodbc.DatabaseError, err: |
666 | + raise osv.except_osv('ERROR',err) |
667 | + |
668 | + for row in rows: |
669 | + over = self.add_overtime(cr, uid, ids, row[0], hora_hasta, context = None) |
670 | + |
671 | + self.write(cr, uid, ids_horas_extras, {'state': 'revised', }) |
672 | + return True |
673 | + |
674 | + |
675 | + # sql nueva Funcion fue agregada para poder hacer validaciones |
676 | + # contra el biometrico cuando existe informacion del campo hora_desde |
677 | + |
678 | + def query2(self, cr, uid, ids, cod, fecha, hora_desde, hora_hasta, t, ih, context = None): |
679 | + |
680 | + """ |
681 | + Funcion para ejecutar la consulta en el BioStar si ahi una hora desde |
682 | + y realisar la comparacion |
683 | + @param cod: codigo del trabajador |
684 | + @param fecha: Fecha |
685 | + @param hora_desde: hora desde donde buscar |
686 | + @param hora_hasta: hora hasta a donde buscar |
687 | + @param t: Tupla con los ids de los captahuellas |
688 | + @param ids_horas_extras: id de la tabla horas extras |
689 | + @return True |
690 | + |
691 | + """ |
692 | + |
693 | + sql = """ |
694 | + SELECT MIN(CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108)) As hour, MAX(CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108)) As hour |
695 | + FROM TB_EVENT_LOG AS EVENT |
696 | + JOIN TB_USER AS U ON EVENT.nUserID = U.sUserId |
697 | + JOIN TB_READER AS READER ON EVENT.nReaderIdn = READER.nReaderIdn JOIN TB_EVENT_DATA AS E_DATA ON EVENT.nEventIdn = E_DATA.nEventIdn |
698 | + JOIN TB_USER_CUSTOMINFO As C ON C.nUserIdn = U.nUserIdn |
699 | + WHERE E_DATA.nEventIdn = 55 |
700 | + AND CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) = '%s' |
701 | + AND READER.nReaderIdn IN %s |
702 | + AND C.sFieldValue5 = %s |
703 | + """ %(fecha, t, cod) |
704 | + |
705 | + |
706 | + cnx = self.conexion(cr, uid, ids, context = None) |
707 | + try: |
708 | + cursor = cnx.cursor() |
709 | + except pyodbc.DatabaseError, err: |
710 | + raise osv.except_osv('ERROR', "Error al crear cursor") |
711 | + |
712 | + try: |
713 | + cursor.execute(sql) |
714 | + rows = cursor.fetchall() |
715 | + except pyodbc.DatabaseError, err: |
716 | + raise osv.except_osv('ERROR',err) |
717 | + |
718 | + for row in rows: |
719 | + validar = self.validar_horas(cr, uid, ids, row, hora_desde, hora_hasta, context=None) |
720 | + |
721 | + self.write(cr, uid, ih, {'state': 'revised', }) |
722 | + |
723 | + |
724 | + #Esta funcion fue agregada el 09/05/2013 para hacer comparacion de horas |
725 | + #si el campo hora_hasta posee datos |
726 | + |
727 | + def validar_horas(self, cr, uid, ids, h_sql, h_desde, h_hasta, context = None): |
728 | + |
729 | + """ |
730 | + Función que valida si las horas del biostar son nulas, si la |
731 | + diferencia de horas no sale del rango y cambio los estados |
732 | + a listo (ready) o excepción (exception) |
733 | + @param h_sql: tupla que contiene hora real del biostar |
734 | + @param ha: hora hasta es un string que contiene una hora |
735 | + @return False: si unlike_hours retorna False o si la hora es None |
736 | + @return True: si unlike_hours retorna True sino esta en ninguna condicion y realiza el write a done |
737 | + |
738 | + """ |
739 | + |
740 | + |
741 | + objhl = self.pool.get('horas.extras.lineas') |
742 | + obhl_read = objhl.read(cr, uid, ids) |
743 | + sts_now = obhl_read.get('state') |
744 | + |
745 | + |
746 | + if sts_now != 'cancel' and sts_now != 'done': |
747 | + |
748 | + |
749 | + if h_sql[0] == None or h_sql[1] == None: |
750 | + objhl.write(cr, uid, ids, {'state': 'exception',}) |
751 | + return False |
752 | + |
753 | + elif self.unlike_hours(cr, uid, h_sql[0], h_desde) == False: |
754 | + objhl.write(cr, uid, ids, {'hora_marcaje_entrada': h_sql[0], 'hora_marcaje': h_sql[1], 'state': 'exception',}) |
755 | + return False |
756 | + |
757 | + elif self.unlike_hours(cr, uid, h_sql[1], h_hasta) == False: |
758 | + objhl.write(cr, uid, ids, {'hora_marcaje_entrada': h_sql[0], 'hora_marcaje': h_sql[1], 'state': 'exception',}) |
759 | + return False |
760 | + |
761 | + else: |
762 | + objhl.write(cr, uid, ids, {'hora_marcaje_entrada': h_sql[0], 'hora_marcaje': h_sql[1], 'state': 'done',}) |
763 | + return True |
764 | + |
765 | + return True |
766 | + |
767 | + |
768 | + |
769 | + |
770 | + def add_overtime(self, cr, uid, ids, hr, ha, context = None): |
771 | + """ |
772 | + Función que valida si las horas del biostar son nulas, si la |
773 | + diferencia de horas no sale del rango y cambio los estados |
774 | + a listo (ready) o excepción (exception) |
775 | + @param hr: hora real del biostar |
776 | + @param ha: hora hasta es un string que contiene una hora |
777 | + @return False: si unlike_hours retorna False o si la hora es None |
778 | + @return True: si unlike_hours retorna True sino esta en ninguna condicion y realiza el write a done |
779 | + |
780 | + """ |
781 | + objhl = self.pool.get('horas.extras.lineas') |
782 | + obhl_read = objhl.read(cr, uid, ids) |
783 | + sts_now = obhl_read.get('state') |
784 | + |
785 | + if sts_now != 'cancel' and sts_now != 'done': |
786 | + |
787 | + if hr == None: |
788 | + objhl.write(cr, uid, ids, {'state': 'exception',}) |
789 | + return False |
790 | + |
791 | + elif self.unlike_hours(cr, uid, hr, ha) == False: |
792 | + objhl.write(cr, uid, ids, {'hora_marcaje': hr, 'state': 'exception',}) |
793 | + return False |
794 | + |
795 | + else: |
796 | + objhl.write(cr, uid, ids, {'hora_marcaje': hr, 'state': 'done',}) |
797 | + return True |
798 | + |
799 | + def unlike_hours(self, cr, uid, hr, ha): |
800 | + """ |
801 | + Función para realizar la conversión de las horas que |
802 | + inicialmente son unos string y pasarlas al formato fecha realisar |
803 | + su diferencia y retornar True si se mantiene en el rango |
804 | + @param hr: es un string con formato de hora |
805 | + @param ha: es un string con formato de hora |
806 | + @return True: si la diferencia es o igual al criterio |
807 | + @return False: en caso contrario |
808 | + |
809 | + """ |
810 | + minutes = self.subtract_hours(hr, ha, 60) |
811 | + #~ criterio_obj = self.pool.get('hr.parameters') |
812 | + #~ criterio_id = criterio_obj.search(cr,uid, []) |
813 | + #~ |
814 | + #~ for i in criterio_obj.browse(cr, uid, criterio_id): |
815 | + #~ criterio = i.criterio_overtime |
816 | + |
817 | + criterio = 15 |
818 | + |
819 | + if float(minutes) <= criterio: |
820 | + return True |
821 | + else: |
822 | + return False |
823 | + |
824 | + def subtract_hours(self, hr, ha, criterio): |
825 | + |
826 | + r1 = datetime.datetime.strptime(hr, '%H:%M:%S') |
827 | + r2 = datetime.datetime.strptime(ha, '%H:%M:%S') |
828 | + dif = r2 - r1 |
829 | + ab = abs(dif) |
830 | + time = float(ab.seconds / float(criterio)) |
831 | + time = round(time, 2) |
832 | + return time |
833 | + |
834 | + |
835 | + def get_date_year(self, fecha, period): |
836 | + |
837 | + dia_id = {1:'monday', 2:'tuesday', 3:'wednesday', 4:'thursday', 5:'friday', 6:'saturday', 7:'sunday'} |
838 | + dia = datetime.datetime.strptime(fecha, '%Y-%m-%d').isoweekday() |
839 | + func = getattr(period, dia_id[dia]+'_hours_day_id') |
840 | + func = getattr(func, dia_id[dia]+'_hours_id') |
841 | + l = [func.hour_start, func.hour_end] |
842 | + return l |
843 | + |
844 | + def convert_hours(self, hours): |
845 | + return datetime.datetime.strptime(hours, '%H:%M:%S') |
846 | + |
847 | + def turn_validate(self, date, h): |
848 | + """ |
849 | + Funcion que valida si estas dentro de tu horario |
850 | + @param date: lista que contiene el horario por dia del trabajador |
851 | + @param h: hora de marcaje ingresada en las lineas |
852 | + @return True: si estas detro de tu turno |
853 | + @return False: si estas Fuera de tu turno |
854 | + """ |
855 | + hr = self.convert_hours(h) |
856 | + hr0 = self.convert_hours(date[0]) |
857 | + hr1 = self.convert_hours(date[1]) |
858 | + if hr1 > hr0: |
859 | + if hr >= hr0 and hr <= hr1: |
860 | + return True |
861 | + else: |
862 | + if hr >= hr1 and hr >= hr0: |
863 | + return True |
864 | + if hr <= hr0 and hr <= hr1: |
865 | + return True |
866 | + return False |
867 | + |
868 | + def dif_hours(self, hs, he, criterio): |
869 | + if self.convert_hours(he) >= self.convert_hours(hs): |
870 | + dif = self.subtract_hours(hs, he, criterio) |
871 | + return dif |
872 | + else: |
873 | + hour_extra = self.convert_hours(he) |
874 | + hour_exit = self.convert_hours(hs) |
875 | + hour_end = self.convert_hours('00:00:00') |
876 | + hour_nithg = self.convert_hours('23:59:59') |
877 | + total_nithg = hour_nithg - hour_exit |
878 | + dif = abs(hour_extra - hour_end) |
879 | + extra_total = round(dif.seconds / float(criterio), 2) |
880 | + total = round(total_nithg.seconds / float(criterio), 2) + extra_total |
881 | + return total |
882 | + |
883 | + |
884 | + |
885 | + |
886 | + |
887 | + def review(self, cr, uid, ids, context = None): |
888 | + horas_extras = self.browse(cr, uid, ids) |
889 | + exect_obj = self.pool.get('horas.extras.lineas') |
890 | + |
891 | + horas_extras_lineas = horas_extras[0].lineas_ids |
892 | + |
893 | + for i in horas_extras_lineas: |
894 | + fh = i.fecha |
895 | + ha = i.hora_hasta |
896 | + cod = i.empleado_id.cod_number |
897 | + date = self.get_date_year(fh, i.empleado_id.shift_id) |
898 | + |
899 | + |
900 | + if self.turn_validate(date, ha): |
901 | + exect_obj.write(cr, uid, [i.id],{'state': 'exception'}) |
902 | + return False |
903 | + |
904 | + if self.subtract_hours(date[1], ha, 60) < 30: |
905 | + exect_obj.write(cr, uid, [i.id],{'state': 'exception'}) |
906 | + return False |
907 | + |
908 | + |
909 | + |
910 | + |
911 | + def ready(self, cr, uid, ids, context = None): |
912 | + horas_extras = self.browse(cr, uid, ids) |
913 | + turn_obj = self.pool.get('horas.extras.parametros') |
914 | + concept_obj = self.pool.get('hr.variable.concept.line') |
915 | + exect_obj = self.pool.get('horas.extras.lineas') |
916 | + |
917 | + horas_extras_lineas = horas_extras[0].lineas_ids |
918 | + variable_id = horas_extras[0].concepto_id.id |
919 | + |
920 | + |
921 | + |
922 | + for i in horas_extras_lineas: |
923 | + fh = i.fecha |
924 | + ha = i.hora_hasta |
925 | + hd = i.hora_desde |
926 | + cod = i.empleado_id.cod_number |
927 | + employee_id = i.empleado_id.id |
928 | + date = self.get_date_year(fh, i.empleado_id.shift_id) |
929 | + |
930 | + |
931 | + if i.state == 'exception': |
932 | + raise osv.except_osv('ERROR', "No puedes insertar la linea si tienes lineas en execepcion") |
933 | + |
934 | + |
935 | + hora_markaje = self.convert_hours(ha) |
936 | + tur_id = turn_obj.search(cr, uid, ['&', ('hour_start','<=', date[1]) , ('hour_end','>=', date[1])]) |
937 | + tur_brw = turn_obj.browse(cr, uid, tur_id) |
938 | + hora_ext_id = turn_obj.search(cr, uid, ['&', ('hour_start','<=', ha) , ('hour_end','>=', ha)]) |
939 | + hora_ext_brw = turn_obj.browse(cr, uid, hora_ext_id) |
940 | + |
941 | + if hd: |
942 | + hora_markaje_entrada = self.convert_hours(hd) |
943 | + hora_entrada_antes_id = turn_obj.search(cr, uid, ['&', ('hour_start','<=', hd) , ('hour_end','>=', hd)]) |
944 | + hora_entrada_antes_brw = turn_obj.browse(cr, uid, hora_entrada_antes_id) |
945 | + if hora_markaje_entrada < self.convert_hours(date[0]): |
946 | + dif = self.subtract_hours(hd, date[0], 3600) |
947 | + if dif > 0: |
948 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_entrada_antes_brw[0].concepto_id.id} , context=None) |
949 | + |
950 | + if not self.turn_validate(date, ha): #Valida que estes fuera de tu horario de trabajo |
951 | + |
952 | + if hora_markaje > self.convert_hours(tur_brw[0].hour_end): |
953 | + dif1 = self.subtract_hours(tur_brw[0].hour_end, date[1], 3600) |
954 | + dif2 = self.subtract_hours(ha, tur_brw[0].hour_end, 3600) |
955 | + if dif1 > 0: |
956 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif1, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': tur_brw[0].concepto_id.id} , context=None) |
957 | + if dif2 > 0: |
958 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif2, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_ext_brw[0].concepto_id.id} , context=None) |
959 | + #~ return True |
960 | + |
961 | + elif hora_markaje > self.convert_hours(date[1]) and hora_markaje < self.convert_hours(tur_brw[0].hour_end): |
962 | + dif = self.subtract_hours(ha, date[1], 3600) |
963 | + if dif > 0: |
964 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_ext_brw[0].concepto_id.id} , context=None) |
965 | + #~ return True |
966 | + |
967 | + elif hora_markaje < self.convert_hours(date[0]) : |
968 | + dif1 = self.subtract_hours(tur_brw[0].hour_end, date[1], 3600) |
969 | + dif2 = self.subtract_hours(tur_brw[0].hour_end, '23:59:59', 3600) |
970 | + dif3 = self.subtract_hours(ha, '00:00:00', 3600) |
971 | + if dif1 > 0: |
972 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif1, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': tur_brw[0].concepto_id.id} , context=None) |
973 | + if dif2 > 0: |
974 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif2, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_ext_brw[0].concepto_id.id} , context=None) |
975 | + if dif3 > 0: |
976 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif3, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_ext_brw[0].concepto_id.id} , context=None) |
977 | + #~ return True |
978 | + |
979 | + |
980 | + |
981 | + else: |
982 | + if self.convert_hours(date[1]) > self.convert_hours(date[0]): |
983 | + dif1 = self.subtract_hours(tur_brw[0].hour_end, date[1], 3600) |
984 | + dif2 = self.subtract_hours(tur_brw[0].hour_end, '23:59:59', 3600) |
985 | + dif3 = self.subtract_hours(date[0], '00:00:00', 3600) |
986 | + if dif1 > 0: |
987 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif1, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': tur_brw[0].concepto_id.id} , context=None) |
988 | + if dif2 > 0: |
989 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif2, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_ext_brw[0].concepto_id.id} , context=None) |
990 | + if dif3 > 0: |
991 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif3, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_ext_brw[0].concepto_id.id} , context=None) |
992 | + #~ return True |
993 | + else: |
994 | + tur_hourn_id = turn_obj.search(cr, uid, ['&', ('hour_start','>=', date[1]) , ('hour_end','<=', date[0])]) |
995 | + tur_hourn_brw = turn_obj.browse(cr, uid, tur_hourn_id)[0] |
996 | + dif1 = self.subtract_hours(tur_hourn_brw.hour_end, date[1], 3600) |
997 | + dif2 = self.subtract_hours(tur_hourn_brw.hour_end, date[0], 3600) |
998 | + if dif1 > 0: |
999 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif1, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': tur_hourn_brw[0].concepto_id.id} , context=None) |
1000 | + if dif2 > 0: |
1001 | + concept_obj.create(cr, uid, {'employee_id': employee_id, 'value': dif2, 'payroll_id': False, 'variable_concept_id': variable_id , 'type': 'qty', 'concept_id': hora_ext_brw[0].concepto_id.id} , context=None) |
1002 | + #~ return True |
1003 | + |
1004 | + self.write(cr, uid, ids, {'state': 'done', }) |
1005 | + return True |
1006 | + |
1007 | + |
1008 | + |
1009 | + |
1010 | + def create(self, cr, uid, vals, context=None): |
1011 | + if ('referencia' not in vals) or (vals.get('referencia') == '/'): |
1012 | + vals['referencia'] = self.pool.get('ir.sequence').get(cr, uid, 'horas_extras_tseq') |
1013 | + return super(horas_extras, self).create(cr, uid, vals, context) |
1014 | + |
1015 | + |
1016 | + |
1017 | +horas_extras() |
1018 | + |
1019 | + |
1020 | + |
1021 | + |
1022 | +class horas_extras_parametros(osv.osv): |
1023 | + |
1024 | + _name = 'horas.extras.parametros' |
1025 | + _description = 'parametros de horas extras' |
1026 | + _columns = { |
1027 | + 'name': fields.char('Nombre', size=60), |
1028 | + #~ 'criterio': fields.integer('Criterio' , required=True), |
1029 | + 'concepto_id': fields.many2one('hr.concept', 'Concepto', required=True), |
1030 | + 'hour_start': fields.time('hora inicial', required=True), |
1031 | + 'hour_end': fields.time('hora final', required=True), |
1032 | + |
1033 | + } |
1034 | + |
1035 | + def create(self, cr, uid, values, context=None): |
1036 | + |
1037 | + param_id = self.search(cr, uid, ['&', ('hour_start','<=', values['hour_start']), ('hour_end','>=', values['hour_start'])]) |
1038 | + param_id2 = self.search(cr, uid, ['&',('hour_start','<=', values['hour_end']), ('hour_end','>=', values['hour_end'])]) |
1039 | + |
1040 | + |
1041 | + if datetime.datetime.strptime(values['hour_end'], '%H:%M:%S') < datetime.datetime.strptime(values['hour_start'], '%H:%M:%S'): |
1042 | + raise osv.except_osv('ERROR', "No se puede crear un nuevo parametro si la hora final es menor a la inicial") |
1043 | + |
1044 | + elif len(param_id) >= 1 : |
1045 | + raise osv.except_osv('ERROR', "No se puede crear un nuevo parametro si los rangos de horas coinciden con los anteriores") |
1046 | + |
1047 | + elif len(param_id2) >= 1 : |
1048 | + raise osv.except_osv('ERROR', "No se puede crear un nuevo parametro si los rangos de horas coinciden con los anteriores") |
1049 | + |
1050 | + else: |
1051 | + super(horas_extras_parametros, self).create(cr, uid, values, context=None) |
1052 | + return True |
1053 | + |
1054 | +horas_extras_parametros() |
1055 | + |
1056 | + |
1057 | + |
1058 | |
1059 | === added file 'diana_integracion_biostar/model/hr_employee.py' |
1060 | --- diana_integracion_biostar/model/hr_employee.py 1970-01-01 00:00:00 +0000 |
1061 | +++ diana_integracion_biostar/model/hr_employee.py 2013-06-17 20:23:29 +0000 |
1062 | @@ -0,0 +1,16 @@ |
1063 | +#!/usr/bin/env python |
1064 | +# -*- coding: utf-8 -*- |
1065 | + |
1066 | +from osv import fields, osv |
1067 | +import datetime |
1068 | + |
1069 | +class hr_employee(osv.osv): |
1070 | + |
1071 | + _inherit = 'hr.employee' |
1072 | + _description = 'Employee' |
1073 | + |
1074 | + _columns = { |
1075 | + 'no_sujeto_marcaje': fields.boolean("No sujeto a marcaje"), |
1076 | + } |
1077 | + |
1078 | +hr_employee() |
1079 | |
1080 | === added directory 'diana_integracion_biostar/report' |
1081 | === added file 'diana_integracion_biostar/report/__init__.py' |
1082 | --- diana_integracion_biostar/report/__init__.py 1970-01-01 00:00:00 +0000 |
1083 | +++ diana_integracion_biostar/report/__init__.py 2013-06-17 20:23:29 +0000 |
1084 | @@ -0,0 +1,7 @@ |
1085 | +import horas_extras_planificacion |
1086 | +import horas_marcaje_report |
1087 | +#~ import num2word |
1088 | +#~ import num2word_base |
1089 | +#~ import num2word_EU |
1090 | +#~ import num2word_ES |
1091 | +#~ import orderedmapping |
1092 | |
1093 | === added file 'diana_integracion_biostar/report/horas_extras_planificacion.py' |
1094 | --- diana_integracion_biostar/report/horas_extras_planificacion.py 1970-01-01 00:00:00 +0000 |
1095 | +++ diana_integracion_biostar/report/horas_extras_planificacion.py 2013-06-17 20:23:29 +0000 |
1096 | @@ -0,0 +1,37 @@ |
1097 | +from report import report_sxw |
1098 | + |
1099 | +class horas_extras_planificacion(report_sxw.rml_parse): |
1100 | + _name = 'horas.extras.planificacion' |
1101 | + |
1102 | + def __init__(self, cr, uid, name, context): |
1103 | + super(horas_extras_planificacion, self).__init__(cr, uid, name, context) |
1104 | + self.localcontext.update({ |
1105 | + 'get_empresa':self.get_empresa, |
1106 | + }) |
1107 | + self.context = context |
1108 | + |
1109 | + def get_empresa(self, partner_id): |
1110 | + obj_addr = self.pool.get('res.partner.address') |
1111 | + addr_id =obj_addr.search(self.cr, self.uid, [('type','=','invoice'),('partner_id','=',partner_id)]) |
1112 | + res = {} |
1113 | + for row in obj_addr.browse(self.cr, self.uid, addr_id): |
1114 | + res = { |
1115 | + 'street':row.street, |
1116 | + 'phone':row.phone, |
1117 | + 'fax':row.fax, |
1118 | + 'email':row.email, |
1119 | + 'city':row.city, |
1120 | + 'name':row.name, |
1121 | + 'country':row.country_id.name, |
1122 | + } |
1123 | + return res |
1124 | + |
1125 | + |
1126 | + |
1127 | + |
1128 | +report_sxw.report_sxw( |
1129 | + 'report.horas.extras.planificacion', |
1130 | + 'horas.extras.planificacion', |
1131 | + 'diana_integracion_biostar/report/horas_extras_planificacion.rml', |
1132 | + parser=horas_extras_planificacion, header=False) |
1133 | + |
1134 | |
1135 | === added file 'diana_integracion_biostar/report/horas_extras_planificacion.rml' |
1136 | --- diana_integracion_biostar/report/horas_extras_planificacion.rml 1970-01-01 00:00:00 +0000 |
1137 | +++ diana_integracion_biostar/report/horas_extras_planificacion.rml 2013-06-17 20:23:29 +0000 |
1138 | @@ -0,0 +1,525 @@ |
1139 | +<?xml version="1.0"?> |
1140 | +<!DOCTYPE document SYSTEM "rml.dtd" > |
1141 | +<document filename="General Ledger_01.pdf"> |
1142 | + <header x="10cm" y="10cm"> |
1143 | + <template pageSize="(27cm,30cm)" title="Formato de Sobretiempo" author="Industrias Diana, C.A. " allowSplitting="20"> |
1144 | + <pageTemplate id="cabecera"> |
1145 | +<!-- |
1146 | + <frame id="reporte" x1="05.0mm" y1="10.0mm" width="253.0mm" height="180mm" /> |
1147 | +--> |
1148 | +<!-- |
1149 | + <frame id="reporte" x1="6cm" y1="6.1cm" width="20cm" height="22.6cm" /> |
1150 | +--> |
1151 | + <frame id="reporte" x1="0.5cm" y1="6.1cm" width="253.0mm" height="210mm" /> |
1152 | + <pageGraphics> |
1153 | + <drawCentredString x="700" y="800"> |
1154 | + Pag. |
1155 | + <pageNumber style="estilo2" /> |
1156 | + </drawCentredString> |
1157 | +<!-- |
1158 | + <setFont name="DejaVu Sans" size="8" /> |
1159 | + <drawString x="1.0cm" y="5.8cm">Despachado Por: </drawString> |
1160 | + <drawString x="1.0cm" y="5.3cm">C.I:</drawString> |
1161 | + <drawString x="1.0cm" y="4.3cm">Salida:</drawString> |
1162 | + <drawString x="1.0cm" y="4.8cm">Firma y Sello:</drawString> |
1163 | + <drawString x="7.0cm" y="4.8cm">Firma y Huella:</drawString> |
1164 | + <drawString x="13.0cm" y="4.8cm">Firma:</drawString> |
1165 | + <drawString x="18.0cm" y="4.8cm">Fecha y Hora:</drawString> |
1166 | + |
1167 | + <drawString x="13.0cm" y="3.8cm">Llegada:</drawString> |
1168 | + <drawString x="1.0cm" y="3.3cm">Fecha:</drawString> |
1169 | + <drawString x="8.0cm" y="3.3cm">Hora de LLegada:</drawString> |
1170 | + <drawString x="1.0cm" y="2.8cm">Firma Autorizada:</drawString> |
1171 | + <drawString x="13.0cm" y="2.8cm">Fecha:</drawString> |
1172 | + <drawString x="18.0cm" y="2.8cm">Hora de Descarga:</drawString> |
1173 | +--> |
1174 | + </pageGraphics> |
1175 | + </pageTemplate > |
1176 | + </template> |
1177 | + </header> |
1178 | + <stylesheet> |
1179 | + <paraStyle name="estilo1_a" fontName="Helvetica" alignment="JUSTIFY" fontSize="8.0" /> |
1180 | + <paraStyle name="estilo1" fontName="Helvetica" alignment="JUSTIFY" /> |
1181 | + <paraStyle name="estilo2" fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0" /> |
1182 | + <paraStyle name="estilo3" fontName="Helvetica" alignment="CENTER" fontSize="8.0" /> |
1183 | + <paraStyle name="estilo3_a" fontName="Helvetica-bold" alignment="CENTER" fontSize="8.0" /> |
1184 | + <paraStyle name="estilo4" fontName="Helvetica" alignment="CENTER" fontSize="6.0" leading="8.0" /> |
1185 | + <paraStyle name="estilo5" fontName="Helvetica" alignment="CENTER" fontSize="6.0" leading="8.0" /> |
1186 | + <paraStyle name="estilo6" fontName="Helvetica-bold" alignment="LEFT" fontSize="8.0" leading="8.0" /> |
1187 | + <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" /> |
1188 | + <paraStyle name="terp_default_Centre_7" fontName="Helvetica" fontSize="7.0" leading="9" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" /> |
1189 | + <blockTableStyle id="Standard_Outline"> |
1190 | + <blockAlignment value="LEFT" /> |
1191 | + <blockValign value="TOP" /> |
1192 | + </blockTableStyle> |
1193 | + <blockTableStyle id="Table1"> |
1194 | + <blockAlignment value="LEFT" /> |
1195 | + <blockValign value="TOP" /> |
1196 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1" /> |
1197 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0" /> |
1198 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1" /> |
1199 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1" /> |
1200 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0" /> |
1201 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1" /> |
1202 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1" /> |
1203 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0" /> |
1204 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1" /> |
1205 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1" /> |
1206 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0" /> |
1207 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1" /> |
1208 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1" /> |
1209 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0" /> |
1210 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1" /> |
1211 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1" /> |
1212 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0" /> |
1213 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1" /> |
1214 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1" /> |
1215 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="6,0" stop="6,-1" /> |
1216 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0" /> |
1217 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1" /> |
1218 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0" /> |
1219 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="6,0" stop="7,-1" /> |
1220 | + </blockTableStyle> |
1221 | + <blockTableStyle id="Table2"> |
1222 | + <blockAlignment value="LEFT" /> |
1223 | + <blockValign value="TOP" /> |
1224 | + <lineStyle kind="GRID" colorName="#000000" /> |
1225 | + </blockTableStyle> |
1226 | + <blockTableStyle id="Tabla11_b"> |
1227 | + <blockAlignment value="LEFT" /> |
1228 | + <blockValign value="TOP" /> |
1229 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="11,0" /> |
1230 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="11,1" /> |
1231 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1" /> |
1232 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1" /> |
1233 | + </blockTableStyle> |
1234 | + <blockTableStyle id="Tabla12"> |
1235 | + <blockAlignment value="LEFT" /> |
1236 | + <blockValign value="TOP" /> |
1237 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0" /> |
1238 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1" /> |
1239 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1" /> |
1240 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1" /> |
1241 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="1,0" stop="1,-1" /> |
1242 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0" /> |
1243 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="2,0" stop="2,-1" /> |
1244 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1" /> |
1245 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0" /> |
1246 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1" /> |
1247 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0" /> |
1248 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1" /> |
1249 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="4,0" stop="4,-1" /> |
1250 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0" /> |
1251 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1" /> |
1252 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="5,0" stop="5,-1" /> |
1253 | + <setNextTemplate name="first" /> |
1254 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0" /> |
1255 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="5,-1" /> |
1256 | + </blockTableStyle> |
1257 | +<!-- |
1258 | + <condPageBreak/> |
1259 | +--> |
1260 | + </stylesheet> |
1261 | + <story> |
1262 | + <pto> |
1263 | + <pto_header> |
1264 | + <para>[[repeatIn(objects,'o')]]</para> |
1265 | + <blockTable colWidths="750"> |
1266 | + <tr> |
1267 | + <td> |
1268 | + <para style="terp_header_Centre">Formato de Sobretiempo</para> |
1269 | + </td> |
1270 | + </tr> |
1271 | + </blockTable> |
1272 | + <spacer length="0.5cm" /> |
1273 | + <blockTable colWidths="214.0,214.0,214.0" style="Table1"> |
1274 | + <tr> |
1275 | + <td> |
1276 | + <para style="estilo6" alignment="CENTER">INDUSTRIAS DIANA, C.A.</para> |
1277 | + <para style="estilo6" alignment="CENTER">GERENCIA DE RECURSOS HUMANOS</para> |
1278 | + <para style="estilo6" alignment="CENTER">DPTO.ADMINISTRACION DE PERSONAL</para> |
1279 | + </td> |
1280 | + <td> |
1281 | + <para style="estilo6" alignment="CENTER">AUTORIZACION DE SOBRETIEMPO</para> |
1282 | + </td> |
1283 | + <td> |
1284 | + <para style="estilo6" alignment="CENTER">FECHA: [[o.fecha]]</para> |
1285 | + </td> |
1286 | + </tr> |
1287 | + </blockTable> |
1288 | + <blockTable colWidths="321, 321" style="Table1"> |
1289 | + <tr> |
1290 | + <td> |
1291 | + <para style="estilo6">DEPARTAMENTO:</para> |
1292 | + <spacer length="0.1cm" /> |
1293 | + <para style="estilo1_a">[[o.departamento_id.name]]</para> |
1294 | + </td> |
1295 | + <td> |
1296 | + <para style="estilo6">FECHA DE SOBRETIEMPO: [[o.fecha_sobre_tiempo]]</para> |
1297 | + </td> |
1298 | + </tr> |
1299 | + </blockTable> |
1300 | + <spacer length="0.5cm" /> |
1301 | + <blockTable colWidths="460.9, 180.1" style="Table1"> |
1302 | + <tr> |
1303 | + <td> |
1304 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">DEPARTAMENTO SOLICITANTE</para> |
1305 | + </td> |
1306 | + <td> |
1307 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">PROTECCION DE PLANTA</para> |
1308 | + </td> |
1309 | + </tr> |
1310 | + </blockTable> |
1311 | + <blockTable colWidths="50,64.29,64.29,64.29,20,74.24,64.29,60, 60, 60, 60" style="Table2"> |
1312 | + <tr> |
1313 | + <td> |
1314 | + <para style="estilo3_a">CODIGO</para> |
1315 | + </td> |
1316 | + <td> |
1317 | + <para style="estilo3_a">NOMBRE Y APELLIDO</para> |
1318 | + </td> |
1319 | + <td> |
1320 | + <para style="estilo3_a">DESDE</para> |
1321 | + <para style="estilo3_a">(HORA)</para> |
1322 | + </td> |
1323 | + <td> |
1324 | + <para style="estilo3_a">HASTA</para> |
1325 | + <para style="estilo3_a">(HORA)</para> |
1326 | + </td> |
1327 | + <td> |
1328 | + <para style="estilo3_a">TIPO</para> |
1329 | + </td> |
1330 | + <td> |
1331 | + <para style="estilo3_a">OBSERVACION</para> |
1332 | + </td> |
1333 | + <td> |
1334 | + <para style="estilo3_a">SERVICIO DE COMIDA</para> |
1335 | + </td> |
1336 | + <td> |
1337 | + <para style="estilo3_a">FIRMA DEL</para> |
1338 | + <para style="estilo3_a">TRABAJADOR</para> |
1339 | + </td> |
1340 | + <td> |
1341 | + <para style="estilo3_a">DESDE HORA</para> |
1342 | + </td> |
1343 | + <td> |
1344 | + <para style="estilo3_a">HASTA HORA</para> |
1345 | + </td> |
1346 | + <td> |
1347 | + <para style="estilo3_a">FIRMA DEL</para> |
1348 | + <para style="estilo3_a">TRABAJADOR</para> |
1349 | + </td> |
1350 | + </tr> |
1351 | + </blockTable> |
1352 | + </pto_header> |
1353 | + <pto_trailer> |
1354 | + <blockTable colWidths="114.29, 222.87, 124.9, 180" style="Table1"> |
1355 | + <tr> |
1356 | + <td> |
1357 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">SUPERVISOR INMEDIATO</para> |
1358 | + </td> |
1359 | + <td> |
1360 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">GERENTE DE AREA</para> |
1361 | + </td> |
1362 | + <td> |
1363 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">ADMINISTRACION DE PERSONAL</para> |
1364 | + </td> |
1365 | + <td> |
1366 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">INSPECTOR DE GUARDIA</para> |
1367 | + </td> |
1368 | + </tr> |
1369 | + </blockTable> |
1370 | + <blockTable colWidths="114.29, 222.87, 124.9, 180" style="Table1"> |
1371 | + <tr> |
1372 | + <td> |
1373 | + <spacer length="0.6cm" /> |
1374 | + <para style="estilo3" /> |
1375 | + </td> |
1376 | + <td> |
1377 | + <para style="estilo3" /> |
1378 | + </td> |
1379 | + <td> |
1380 | + <para style="estilo3" /> |
1381 | + </td> |
1382 | + <td> |
1383 | + <para style="estilo3" /> |
1384 | + </td> |
1385 | + </tr> |
1386 | + </blockTable> |
1387 | + <spacer length="0.5cm" /> |
1388 | +<!-- |
1389 | + </pto_trailer> |
1390 | + <spacer length="0.5cm" /> |
1391 | + <pto_trailer> |
1392 | +--> |
1393 | + <blockTable colWidths="642.06" style="Tabla12"> |
1394 | + <tr> |
1395 | + <td> |
1396 | + <para fontSize="10.0" alignment="CENTER" fontName="Helvetica-bold">TIPOS</para> |
1397 | + </td> |
1398 | + </tr> |
1399 | + </blockTable> |
1400 | + |
1401 | + <blockTable colWidths="214.02,214.02,214.02" style="Tabla11_b"> |
1402 | + <tr> |
1403 | + <td> |
1404 | + <para style="estilo1_a">(PE) PERMISO</para> |
1405 | + <para style="estilo1_a">(RE) REPOSO</para> |
1406 | + <para style="estilo1_a">(DC) DESCANSO COMPENSATORIO</para> |
1407 | + <para style="estilo1_a">(VA) VACACIONES</para> |
1408 | + <para style="estilo1_a">(AC) ADIESTRAMIENTO / CURSO</para> |
1409 | + <para style="estilo1_a">(FI) FALTA INJUSTIFICADA</para> |
1410 | + </td> |
1411 | + <td> |
1412 | + <para style="estilo1_a">(CP) CUMPLIMIENTO PLANES DE PROD</para> |
1413 | + <para style="estilo1_a">(MC) MANTENIMIENTO</para> |
1414 | + <para style="estilo1_a">(MP) MANTENIMIENTO PROGRAMADO</para> |
1415 | + <para style="estilo1_a">(EP) EJECUSION DE PROYECTOS</para> |
1416 | + <para style="estilo1_a">(PD) PLANIFICACION DE DESPACHOS</para> |
1417 | + <para style="estilo1_a">(RM) RECEPCION DE MATERIALES</para> |
1418 | + </td> |
1419 | + <td> |
1420 | + <para style="estilo1_a">(OL) OPERATIVO LIMPIEZA</para> |
1421 | + <para style="estilo1_a">(PT) PROCESO DE TRANSACCIONES</para> |
1422 | + <para style="estilo1_a">(IV) INVENTARIO</para> |
1423 | + <para style="estilo1_a">(PA) PARADA DE PLANTA</para> |
1424 | + <para style="estilo1_a">(OT) OTRO (ESPECIFIQUE)</para> |
1425 | + </td> |
1426 | + </tr> |
1427 | + </blockTable> |
1428 | + |
1429 | + <blockTable colWidths="642.06" style="Tabla12"> |
1430 | + <tr> |
1431 | + <td> |
1432 | + <para fontSize="10.0" alignment="LEFT" fontName="Helvetica-bold">Observaciones:</para> |
1433 | + <spacer length="1cm" /> |
1434 | + </td> |
1435 | + </tr> |
1436 | + </blockTable> |
1437 | + |
1438 | + |
1439 | +</pto_trailer> |
1440 | + |
1441 | + |
1442 | + |
1443 | + |
1444 | + <para>[[repeatIn(objects,'o')]]</para> |
1445 | + <blockTable colWidths="750"> |
1446 | + <tr> |
1447 | + <td> |
1448 | + <para style="terp_header_Centre">Formato de Sobretiempo</para> |
1449 | + </td> |
1450 | + </tr> |
1451 | + </blockTable> |
1452 | + <spacer length="0.5cm" /> |
1453 | + <blockTable colWidths="214.0,214.0,214.0" style="Table1"> |
1454 | + <tr> |
1455 | + <td> |
1456 | + <para style="estilo6" alignment="CENTER">INDUSTRIAS DIANA, C.A.</para> |
1457 | + <para style="estilo6" alignment="CENTER">GERENCIA DE RECURSOS HUMANOS</para> |
1458 | + <para style="estilo6" alignment="CENTER">DPTO.ADMINISTRACION DE PERSONAL</para> |
1459 | + </td> |
1460 | + <td> |
1461 | + <para style="estilo6" alignment="CENTER">AUTORIZACION DE SOBRETIEMPO</para> |
1462 | + </td> |
1463 | + <td> |
1464 | + <para style="estilo6" alignment="CENTER">FECHA: [[o.fecha]]</para> |
1465 | + </td> |
1466 | + </tr> |
1467 | + </blockTable> |
1468 | + <blockTable colWidths="321, 321" style="Table1"> |
1469 | + <tr> |
1470 | + <td> |
1471 | + <para style="estilo6">DEPARTAMENTO:</para> |
1472 | + <spacer length="0.1cm" /> |
1473 | + <para style="estilo1_a">[[o.departamento_id.name]]</para> |
1474 | + </td> |
1475 | + <td> |
1476 | + <para style="estilo6">FECHA DE SOBRETIEMPO: [[o.fecha_sobre_tiempo]]</para> |
1477 | + </td> |
1478 | + </tr> |
1479 | + </blockTable> |
1480 | + <spacer length="0.5cm" /> |
1481 | + <blockTable colWidths="460.9, 180.1" style="Table1"> |
1482 | + <tr> |
1483 | + <td> |
1484 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">DEPARTAMENTO SOLICITANTE</para> |
1485 | + </td> |
1486 | + <td> |
1487 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">PROTECCION DE PLANTA</para> |
1488 | + </td> |
1489 | + </tr> |
1490 | + </blockTable> |
1491 | + <blockTable colWidths="50,64.29,64.29,64.29,20,74.24,64.29,60, 60, 60, 60" style="Table2"> |
1492 | + <tr> |
1493 | + <td> |
1494 | + <para style="estilo3_a">CODIGO</para> |
1495 | + </td> |
1496 | + <td> |
1497 | + <para style="estilo3_a">NOMBRE Y APELLIDO</para> |
1498 | + </td> |
1499 | + <td> |
1500 | + <para style="estilo3_a">DESDE</para> |
1501 | + <para style="estilo3_a">(HORA)</para> |
1502 | + </td> |
1503 | + <td> |
1504 | + <para style="estilo3_a">HASTA</para> |
1505 | + <para style="estilo3_a">(HORA)</para> |
1506 | + </td> |
1507 | + <td> |
1508 | + <para style="estilo3_a">TIPO</para> |
1509 | + </td> |
1510 | + <td> |
1511 | + <para style="estilo3_a">OBSERVACION</para> |
1512 | + </td> |
1513 | + <td> |
1514 | + <para style="estilo3_a">SERVICIO DE COMIDA</para> |
1515 | + </td> |
1516 | + <td> |
1517 | + <para style="estilo3_a">FIRMA DEL</para> |
1518 | + <para style="estilo3_a">TRABAJADOR</para> |
1519 | + </td> |
1520 | + <td> |
1521 | + <para style="estilo3_a">DESDE HORA</para> |
1522 | + </td> |
1523 | + <td> |
1524 | + <para style="estilo3_a">HASTA HORA</para> |
1525 | + </td> |
1526 | + <td> |
1527 | + <para style="estilo3_a">FIRMA DEL</para> |
1528 | + <para style="estilo3_a">TRABAJADOR</para> |
1529 | + </td> |
1530 | + </tr> |
1531 | + </blockTable> |
1532 | + <blockTable colWidths="50,64.29,64.29,64.29,20,74.24,64.29,60, 60, 60, 60" style="Table2"> |
1533 | + <tr> |
1534 | + <para>[[repeatIn(o.planificacion_lineas_ids,'linea')]]</para> |
1535 | + <td> |
1536 | + <para style="estilo3">[[linea.empleado_id.cod_number]]</para> |
1537 | + </td> |
1538 | + <td> |
1539 | + <para style="estilo3">[[linea.empleado_id.name]]</para> |
1540 | + </td> |
1541 | + <td> |
1542 | + <para style="estilo3">[[linea.hora_desde]]</para> |
1543 | + </td> |
1544 | + <td> |
1545 | + <para style="estilo3">[[linea.hora_hasta]]</para> |
1546 | + </td> |
1547 | + <td> |
1548 | + <para style="estilo3">[[linea.tipo.name]]</para> |
1549 | + </td> |
1550 | + <td> |
1551 | + <para style="estilo3">[[linea.observacion]]</para> |
1552 | + </td> |
1553 | + <td> |
1554 | + <para style="estilo3">[[linea.serv_comida==True and 'SI']]</para> |
1555 | + <para style="estilo3">[[linea.serv_comida==False and 'NO']]</para> |
1556 | + </td> |
1557 | + <td> |
1558 | + <para style="estilo3" /> |
1559 | + </td> |
1560 | + <td> |
1561 | + <para style="estilo3" /> |
1562 | + </td> |
1563 | + <td> |
1564 | + <para style="estilo3" /> |
1565 | + </td> |
1566 | + <td> |
1567 | + <para style="estilo3" /> |
1568 | + <para style="estilo3" /> |
1569 | + </td> |
1570 | + </tr> |
1571 | + </blockTable> |
1572 | + |
1573 | + <blockTable colWidths="114.29, 222.87, 124.9, 180" style="Table1"> |
1574 | + <tr> |
1575 | + <td> |
1576 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">SUPERVISOR INMEDIATO</para> |
1577 | + </td> |
1578 | + <td> |
1579 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">GERENTE DE AREA</para> |
1580 | + </td> |
1581 | + <td> |
1582 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">ADMINISTRACION DE PERSONAL</para> |
1583 | + </td> |
1584 | + <td> |
1585 | + <para fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0">INSPECTOR DE GUARDIA</para> |
1586 | + </td> |
1587 | + </tr> |
1588 | + </blockTable> |
1589 | + <blockTable colWidths="114.29, 222.87, 124.9, 180" style="Table1"> |
1590 | + <tr> |
1591 | + <td> |
1592 | + <spacer length="0.6cm" /> |
1593 | + <para style="estilo3" /> |
1594 | + </td> |
1595 | + <td> |
1596 | + <para style="estilo3" /> |
1597 | + </td> |
1598 | + <td> |
1599 | + <para style="estilo3" /> |
1600 | + </td> |
1601 | + <td> |
1602 | + <para style="estilo3" /> |
1603 | + </td> |
1604 | + </tr> |
1605 | + </blockTable> |
1606 | + <!-- |
1607 | + <spacer length="0.5cm" /> |
1608 | + --> |
1609 | + |
1610 | + |
1611 | + <spacer length="0.5cm" /> |
1612 | + |
1613 | + <blockTable colWidths="642.06" style="Tabla12"> |
1614 | + <tr> |
1615 | + <td> |
1616 | + <para fontSize="10.0" alignment="CENTER" fontName="Helvetica-bold">TIPOS</para> |
1617 | + </td> |
1618 | + </tr> |
1619 | + </blockTable> |
1620 | + |
1621 | + <blockTable colWidths="214.02,214.02,214.02" style="Tabla11_b"> |
1622 | + <tr> |
1623 | + <td> |
1624 | + <para style="estilo1_a">(PE) PERMISO</para> |
1625 | + <para style="estilo1_a">(RE) REPOSO</para> |
1626 | + <para style="estilo1_a">(DC) DESCANSO COMPENSATORIO</para> |
1627 | + <para style="estilo1_a">(VA) VACACIONES</para> |
1628 | + <para style="estilo1_a">(AC) ADIESTRAMIENTO / CURSO</para> |
1629 | + <para style="estilo1_a">(FI) FALTA INJUSTIFICADA</para> |
1630 | + </td> |
1631 | + <td> |
1632 | + <para style="estilo1_a">(CP) CUMPLIMIENTO PLANES DE PROD</para> |
1633 | + <para style="estilo1_a">(MC) MANTENIMIENTO</para> |
1634 | + <para style="estilo1_a">(MP) MANTENIMIENTO PROGRAMADO</para> |
1635 | + <para style="estilo1_a">(EP) EJECUSION DE PROYECTOS</para> |
1636 | + <para style="estilo1_a">(PD) PLANIFICACION DE DESPACHOS</para> |
1637 | + <para style="estilo1_a">(RM) RECEPCION DE MATERIALES</para> |
1638 | + </td> |
1639 | + <td> |
1640 | + <para style="estilo1_a">(OL) OPERATIVO LIMPIEZA</para> |
1641 | + <para style="estilo1_a">(PT) PROCESO DE TRANSACCIONES</para> |
1642 | + <para style="estilo1_a">(IV) INVENTARIO</para> |
1643 | + <para style="estilo1_a">(PA) PARADA DE PLANTA</para> |
1644 | + <para style="estilo1_a">(OT) OTRO (ESPECIFIQUE)</para> |
1645 | + </td> |
1646 | + </tr> |
1647 | + </blockTable> |
1648 | + |
1649 | + |
1650 | + |
1651 | + <blockTable colWidths="642.06" style="Tabla12"> |
1652 | + <tr> |
1653 | + <td> |
1654 | + <para fontSize="10.0" alignment="LEFT" fontName="Helvetica-bold">Observaciones:</para> |
1655 | + <spacer length="1cm" /> |
1656 | + </td> |
1657 | + </tr> |
1658 | + </blockTable> |
1659 | + |
1660 | + |
1661 | +</pto> |
1662 | + </story> |
1663 | +</document> |
1664 | |
1665 | === added file 'diana_integracion_biostar/report/horas_extras_planificacion.xml' |
1666 | --- diana_integracion_biostar/report/horas_extras_planificacion.xml 1970-01-01 00:00:00 +0000 |
1667 | +++ diana_integracion_biostar/report/horas_extras_planificacion.xml 2013-06-17 20:23:29 +0000 |
1668 | @@ -0,0 +1,23 @@ |
1669 | +<?xml version="1.0" encoding="utf-8"?> |
1670 | +<openerp> |
1671 | + <data> |
1672 | + <report |
1673 | + auto="False" |
1674 | + id="report_horas_extras_planificacion" |
1675 | + model="horas.extras.planificacion" |
1676 | + name="horas.extras.planificacion" |
1677 | + rml="diana_integracion_biostar/report/horas_extras_planificacion.rml" |
1678 | + string="Formato de Sobretiempo" |
1679 | + |
1680 | + |
1681 | + /> |
1682 | + <report |
1683 | + auto="False" |
1684 | + id="report_horas_marcaje" |
1685 | + model="horas.marcaje.wizard" |
1686 | + name="horas.marcaje" |
1687 | + rml="diana_integracion_biostar/report/horas_marcaje_report.rml" |
1688 | + string="Reporte de marcajes" |
1689 | + /> |
1690 | + </data> |
1691 | +</openerp> |
1692 | |
1693 | === added file 'diana_integracion_biostar/report/horas_marcaje_report.py' |
1694 | --- diana_integracion_biostar/report/horas_marcaje_report.py 1970-01-01 00:00:00 +0000 |
1695 | +++ diana_integracion_biostar/report/horas_marcaje_report.py 2013-06-17 20:23:29 +0000 |
1696 | @@ -0,0 +1,44 @@ |
1697 | +from report import report_sxw |
1698 | +import datetime |
1699 | +from datetime import datetime |
1700 | + |
1701 | +class horas_marcaje_report(report_sxw.rml_parse): |
1702 | + _name = 'horas.marcaje.report' |
1703 | + |
1704 | + def __init__(self, cr, uid, name, context): |
1705 | + super(horas_marcaje_report, self).__init__(cr, uid, name, context) |
1706 | + self.localcontext.update({ |
1707 | + 'get_empresa':self.get_empresa, |
1708 | + 'get_final_date':self.get_final_date, |
1709 | + |
1710 | + }) |
1711 | + self.context = context |
1712 | + |
1713 | + def get_empresa(self, partner_id): |
1714 | + obj_addr = self.pool.get('res.partner.address') |
1715 | + addr_id =obj_addr.search(self.cr, self.uid, [('type','=','invoice'),('partner_id','=',partner_id)]) |
1716 | + res = {} |
1717 | + for row in obj_addr.browse(self.cr, self.uid, addr_id): |
1718 | + res = { |
1719 | + 'street':row.street, |
1720 | + 'phone':row.phone, |
1721 | + 'fax':row.fax, |
1722 | + 'email':row.email, |
1723 | + 'city':row.city, |
1724 | + 'name':row.name, |
1725 | + 'country':row.country_id.name, |
1726 | + } |
1727 | + return res |
1728 | + |
1729 | + def get_final_date(self): |
1730 | + return datetime.now().strftime('%d/%m/%Y %H:%M') |
1731 | + |
1732 | + |
1733 | + |
1734 | + |
1735 | +report_sxw.report_sxw( |
1736 | + 'report.horas.marcaje', |
1737 | + 'horas.marcaje.wizard', |
1738 | + 'diana_integracion_biostar/report/horas_marcaje_report.rml', |
1739 | + parser=horas_marcaje_report, header=False) |
1740 | + |
1741 | |
1742 | === added file 'diana_integracion_biostar/report/horas_marcaje_report.rml' |
1743 | --- diana_integracion_biostar/report/horas_marcaje_report.rml 1970-01-01 00:00:00 +0000 |
1744 | +++ diana_integracion_biostar/report/horas_marcaje_report.rml 2013-06-17 20:23:29 +0000 |
1745 | @@ -0,0 +1,246 @@ |
1746 | +<?xml version="1.0"?> |
1747 | +<!DOCTYPE document SYSTEM "rml.dtd" > |
1748 | +<document filename="General Ledger_01.pdf"> |
1749 | + <header x="10cm" y="10cm"> |
1750 | + <template pageSize="(27cm,30cm)" title="REPORTE DE MARCAJE" author="Industrias Diana, C.A. " allowSplitting="20"> |
1751 | + <pageTemplate id="cabecera"> |
1752 | + <!-- |
1753 | + <frame id="reporte" x1="05.0mm" y1="10.0mm" width="253.0mm" height="180mm" /> |
1754 | + --> |
1755 | + <!-- |
1756 | + <frame id="reporte" x1="6cm" y1="6.1cm" width="20cm" height="22.6cm" /> |
1757 | + --> |
1758 | + <frame id="reporte" x1="0.5cm" y1="6.1cm" width="253.0mm" height="210mm" /> |
1759 | + <pageGraphics> |
1760 | +<!-- |
1761 | + <image x="100" y="750" width="21.06mm" height="21.06mm">[[ company.logo or removeParentNode('image') ]]</image> |
1762 | +--> |
1763 | + <setFont name="Helvetica-Bold" size="10"/> |
1764 | + <stroke color="black" /> |
1765 | + <drawString x="100" y="780">[[ company.partner_id.name ]]</drawString> |
1766 | + <drawString x="100" y="765">[[ company.partner_id.vat[2:] or '']]</drawString> |
1767 | + <drawString x="630" y="780">Valencia, [[ get_final_date() ]]</drawString> |
1768 | + <drawCentredString x="700" y="800"> |
1769 | + Pag. |
1770 | + <pageNumber style="estilo2" /> |
1771 | + </drawCentredString> |
1772 | + |
1773 | + </pageGraphics> |
1774 | + </pageTemplate > |
1775 | + </template> |
1776 | + </header> |
1777 | + <stylesheet> |
1778 | + <paraStyle name="estilo1_a" fontName="Helvetica" alignment="JUSTIFY" fontSize="8.0" /> |
1779 | + <paraStyle name="estilo1" fontName="Helvetica" alignment="JUSTIFY" /> |
1780 | + <paraStyle name="estilo2" fontName="Helvetica-bold" alignment="CENTER" fontSize="10.0" /> |
1781 | + <paraStyle name="estilo3" fontName="Helvetica" alignment="CENTER" fontSize="8.0" /> |
1782 | + <paraStyle name="estilo3_a" fontName="Helvetica-bold" alignment="CENTER" fontSize="8.0" /> |
1783 | + <paraStyle name="estilo4" fontName="Helvetica" alignment="CENTER" fontSize="6.0" leading="8.0" /> |
1784 | + <paraStyle name="estilo5" fontName="Helvetica" alignment="CENTER" fontSize="6.0" leading="8.0" /> |
1785 | + <paraStyle name="estilo6" fontName="Helvetica-bold" alignment="LEFT" fontSize="8.0" leading="8.0" /> |
1786 | + <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" /> |
1787 | + <paraStyle name="terp_default_Centre_7" fontName="Helvetica" fontSize="7.0" leading="9" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0" /> |
1788 | + <blockTableStyle id="Standard_Outline"> |
1789 | + <blockAlignment value="LEFT" /> |
1790 | + <blockValign value="TOP" /> |
1791 | + </blockTableStyle> |
1792 | + <blockTableStyle id="Table1"> |
1793 | + <blockAlignment value="LEFT" /> |
1794 | + <blockValign value="TOP" /> |
1795 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1" /> |
1796 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0" /> |
1797 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1" /> |
1798 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1" /> |
1799 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0" /> |
1800 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1" /> |
1801 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1" /> |
1802 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0" /> |
1803 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1" /> |
1804 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1" /> |
1805 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0" /> |
1806 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1" /> |
1807 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1" /> |
1808 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0" /> |
1809 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1" /> |
1810 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1" /> |
1811 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0" /> |
1812 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1" /> |
1813 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1" /> |
1814 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="6,0" stop="6,-1" /> |
1815 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0" /> |
1816 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1" /> |
1817 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0" /> |
1818 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="6,0" stop="7,-1" /> |
1819 | + </blockTableStyle> |
1820 | + <blockTableStyle id="Table2"> |
1821 | + <blockAlignment value="LEFT" /> |
1822 | + <blockValign value="TOP" /> |
1823 | + <lineStyle kind="GRID" colorName="#000000" /> |
1824 | + </blockTableStyle> |
1825 | + <blockTableStyle id="Tabla11_b"> |
1826 | + <blockAlignment value="LEFT" /> |
1827 | + <blockValign value="TOP" /> |
1828 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="11,0" /> |
1829 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="11,1" /> |
1830 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1" /> |
1831 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1" /> |
1832 | + </blockTableStyle> |
1833 | + <blockTableStyle id="Tabla12"> |
1834 | + <blockAlignment value="LEFT" /> |
1835 | + <blockValign value="TOP" /> |
1836 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0" /> |
1837 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1" /> |
1838 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1" /> |
1839 | + <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1" /> |
1840 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="1,0" stop="1,-1" /> |
1841 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0" /> |
1842 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="2,0" stop="2,-1" /> |
1843 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1" /> |
1844 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0" /> |
1845 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1" /> |
1846 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0" /> |
1847 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1" /> |
1848 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="4,0" stop="4,-1" /> |
1849 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0" /> |
1850 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1" /> |
1851 | + <lineStyle kind="LINEAFTER" colorName="#000000" start="5,0" stop="5,-1" /> |
1852 | + <setNextTemplate name="first" /> |
1853 | + <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0" /> |
1854 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="5,-1" /> |
1855 | + </blockTableStyle> |
1856 | + <!-- |
1857 | + <condPageBreak/> |
1858 | + --> |
1859 | + </stylesheet> |
1860 | + <story> |
1861 | + <pto> |
1862 | + <pto_header> |
1863 | + <para>[[repeatIn(objects,'o')]]</para> |
1864 | + <blockTable colWidths="750"> |
1865 | + <tr> |
1866 | + <td> |
1867 | + <para style="terp_header_Centre">REPORTE DE MARCAJE</para> |
1868 | + </td> |
1869 | + </tr> |
1870 | + </blockTable> |
1871 | + <spacer length="0.5cm" /> |
1872 | + <blockTable colWidths="287.5, 287.5" style="Table1"> |
1873 | + <tr> |
1874 | + <td> |
1875 | + <para style="estilo6" alignment="CENTER">FECHA DESDE:</para> |
1876 | + </td> |
1877 | + <td> |
1878 | + <para style="estilo6" alignment="CENTER">FECHA HASTA:</para> |
1879 | + </td> |
1880 | + </tr> |
1881 | + </blockTable> |
1882 | + <blockTable colWidths="287.5, 287.5" style="Table1"> |
1883 | + <tr> |
1884 | + <td> |
1885 | + <para style="estilo6" alignment="CENTER">[[formatLang(o.fecha_desde, date=True)]]</para> |
1886 | + </td> |
1887 | + <td> |
1888 | + <para style="estilo6" alignment="CENTER">[[formatLang(o.fecha_hasta, date=True)]]</para> |
1889 | + </td> |
1890 | + </tr> |
1891 | + </blockTable> |
1892 | + |
1893 | + <spacer length="0.5cm" /> |
1894 | + <blockTable colWidths="115, 115, 115, 115, 115" style="Table2"> |
1895 | + <tr> |
1896 | + <td> |
1897 | + <para style="estilo3_a">HORA</para> |
1898 | + </td> |
1899 | + <td> |
1900 | + <para style="estilo3_a">FECHA</para> |
1901 | + </td> |
1902 | + <td> |
1903 | + <para style="estilo3_a">CODIGO</para> |
1904 | + </td> |
1905 | + <td> |
1906 | + <para style="estilo3_a">NOMBRE y APELLIDO</para> |
1907 | + </td> |
1908 | + <td> |
1909 | + <para style="estilo3_a">CAPTAHUELLAS</para> |
1910 | + </td> |
1911 | + </tr> |
1912 | + </blockTable> |
1913 | + </pto_header> |
1914 | + <para>[[repeatIn(objects,'o')]]</para> |
1915 | + <blockTable colWidths="750"> |
1916 | + <tr> |
1917 | + <td> |
1918 | + <para style="terp_header_Centre">REPORTE DE MARCAJE</para> |
1919 | + </td> |
1920 | + </tr> |
1921 | + </blockTable> |
1922 | + |
1923 | + <spacer length="0.5cm" /> |
1924 | + <blockTable colWidths="287.5, 287.5" style="Table1"> |
1925 | + <tr> |
1926 | + <td> |
1927 | + <para style="estilo6" alignment="CENTER">FECHA DESDE</para> |
1928 | + </td> |
1929 | + <td> |
1930 | + <para style="estilo6" alignment="CENTER">FECHA HASTA</para> |
1931 | + </td> |
1932 | + </tr> |
1933 | + </blockTable> |
1934 | + <blockTable colWidths="287.5, 287.5" style="Table1"> |
1935 | + <tr> |
1936 | + <td> |
1937 | + <para style="estilo6" alignment="CENTER">[[formatLang(o.fecha_desde, date=True)]]</para> |
1938 | + </td> |
1939 | + <td> |
1940 | + <para style="estilo6" alignment="CENTER">[[formatLang(o.fecha_hasta, date=True)]]</para> |
1941 | + </td> |
1942 | + </tr> |
1943 | + </blockTable> |
1944 | + |
1945 | + <spacer length="0.5cm" /> |
1946 | + <blockTable colWidths="115, 115, 115, 115, 115" style="Table2"> |
1947 | + <tr> |
1948 | + <td> |
1949 | + <para style="estilo3_a">HORA</para> |
1950 | + </td> |
1951 | + <td> |
1952 | + <para style="estilo3_a">FECHA</para> |
1953 | + </td> |
1954 | + <td> |
1955 | + <para style="estilo3_a">CODIGO</para> |
1956 | + </td> |
1957 | + <td> |
1958 | + <para style="estilo3_a">NOMBRE y APELLIDO</para> |
1959 | + </td> |
1960 | + <td> |
1961 | + <para style="estilo3_a">CAPTAHUELLAS</para> |
1962 | + </td> |
1963 | + </tr> |
1964 | + </blockTable> |
1965 | + <blockTable colWidths="115, 115, 115, 115, 115" style="Table2"> |
1966 | + <tr> |
1967 | + <para>[[repeatIn(o.h_line_ids,'linea')]]</para> |
1968 | + <td> |
1969 | + <para style="estilo3_a">[[linea.hora]]</para> |
1970 | + </td> |
1971 | + <td> |
1972 | + <para style="estilo3_a">[[formatLang(linea.fecha, date=True)]]</para> |
1973 | + </td> |
1974 | + <td> |
1975 | + <para style="estilo3_a">[[linea.codigo]]</para> |
1976 | + </td> |
1977 | + <td> |
1978 | + <para style="estilo3_a">[[linea.nombre]]</para> |
1979 | + </td> |
1980 | + <td> |
1981 | + <para style="estilo3_a">[[linea.capta_huella]]</para> |
1982 | + </td> |
1983 | + </tr> |
1984 | + </blockTable> |
1985 | + <!-- |
1986 | + <spacer length="0.5cm" /> |
1987 | + --> |
1988 | + <spacer length="0.5cm" /> |
1989 | + </pto> |
1990 | + </story> |
1991 | +</document> |
1992 | |
1993 | === added directory 'diana_integracion_biostar/view' |
1994 | === added file 'diana_integracion_biostar/view/__init__.py' |
1995 | --- diana_integracion_biostar/view/__init__.py 1970-01-01 00:00:00 +0000 |
1996 | +++ diana_integracion_biostar/view/__init__.py 2013-06-17 20:23:29 +0000 |
1997 | @@ -0,0 +1,1 @@ |
1998 | +import horas_extras_planificacion_wizar |
1999 | |
2000 | === added file 'diana_integracion_biostar/view/biostar_view.xml' |
2001 | --- diana_integracion_biostar/view/biostar_view.xml 1970-01-01 00:00:00 +0000 |
2002 | +++ diana_integracion_biostar/view/biostar_view.xml 2013-06-17 20:23:29 +0000 |
2003 | @@ -0,0 +1,86 @@ |
2004 | +<?xml version="1.0"?> |
2005 | +<openerp> |
2006 | + <data> |
2007 | + <record model="ir.ui.view" id="biostar_setting"> |
2008 | + <field name="name">biostar.settings.form</field> |
2009 | + <field name="model">biostar.settings</field> |
2010 | + <field name="type">form</field> |
2011 | + <field name="arch" type="xml"> |
2012 | + <form string="Configurar Conexion"> |
2013 | + <field name="user" select="1" /> |
2014 | + <field name="password" select="1" password='True' /> |
2015 | + <field name="ip" select="1" /> |
2016 | + <field name="data_base" select="1" /> |
2017 | + <field name="port" select="1" /> |
2018 | + <field name="active" select="1" /> |
2019 | + <separator /> |
2020 | + <group colspan='4'> |
2021 | + <field name="state" select="4" colspan='1' /> |
2022 | +<!-- |
2023 | + <label colspan='1' /> |
2024 | +--> |
2025 | + <button string="Comprobar conexión" name="test_connection" type="object" icon="gtk-ok" colspan='1' states='draft'/> |
2026 | + <button string="Leer Biometrico" name="fingerprint" type="object" icon="gtk-ok" colspan='1' states='confirmed' /> |
2027 | + </group> |
2028 | + </form> |
2029 | + </field> |
2030 | + </record> |
2031 | + <record model="ir.ui.view" id="biostar_settings_tree"> |
2032 | + <field name="name">biostar.settings.tree</field> |
2033 | + <field name="model">biostar.settings</field> |
2034 | + <field name="type">tree</field> |
2035 | + <field name="arch" type="xml"> |
2036 | + <tree string="Configurar Conexion"> |
2037 | + <field name="user" select="1" /> |
2038 | + <field name="ip" select="1" /> |
2039 | + <field name="port" select="1" /> |
2040 | + <field name="data_base" select="1" /> |
2041 | + <field name="active" select="1" /> |
2042 | + <field name="state" select="1" /> |
2043 | + </tree> |
2044 | + </field> |
2045 | + </record> |
2046 | + <record model="ir.actions.act_window" id="action_biostar_settings"> |
2047 | + <field name="name">Configurar Conexión</field> |
2048 | + <field name="view_id" ref="biostar_settings_tree" /> |
2049 | + <field name="res_model">biostar.settings</field> |
2050 | + <field name="view_type">form</field> |
2051 | + <field name="view_mode">form,tree</field> |
2052 | + </record> |
2053 | + <record model="ir.ui.view" id="biostar_fingerprint"> |
2054 | + <field name="name">biostar.fingerprint.form</field> |
2055 | + <field name="model">biostar.fingerprint</field> |
2056 | + <field name="type">form</field> |
2057 | + <field name="arch" type="xml"> |
2058 | + <form string="Configurar Lectores Biometricios"> |
2059 | + <field name="nombre" select="1" /> |
2060 | + <field name="reader_id" select="1" /> |
2061 | + <field name="ip" select="1" /> |
2062 | + <field name="valido" select="1" /> |
2063 | + </form> |
2064 | + </field> |
2065 | + </record> |
2066 | + <record model="ir.ui.view" id="biostar_fingerprint_tree"> |
2067 | + <field name="name">biostar.fingerprint.tree</field> |
2068 | + <field name="model">biostar.fingerprint</field> |
2069 | + <field name="type">tree</field> |
2070 | + <field name="arch" type="xml"> |
2071 | + <tree string="Configurar Dispositivo"> |
2072 | + <field name="nombre" select="1" /> |
2073 | + <field name="reader_id" select="1" /> |
2074 | + <field name="ip" select="1" /> |
2075 | + <field name="valido" select="1" /> |
2076 | + </tree> |
2077 | + </field> |
2078 | + </record> |
2079 | + <record model="ir.actions.act_window" id="action_biostar_fingerprint"> |
2080 | + <field name="name">Configurar Dispositivo</field> |
2081 | + <field name="view_id" ref="biostar_fingerprint_tree" /> |
2082 | + <field name="res_model">biostar.fingerprint</field> |
2083 | + <field name="view_type">form</field> |
2084 | + <field name="view_mode">form,tree</field> |
2085 | + </record> |
2086 | + <menuitem name="Configurar Conexión ODBC" id="biostart" action="action_biostar_settings" parent="hr.menu_hr_configuration" sequence="15" /> |
2087 | + <menuitem name="Lectores Biometricos " id="fingerprint" action="action_biostar_fingerprint" parent="biostart" sequence="15" /> |
2088 | + </data> |
2089 | +</openerp> |
2090 | |
2091 | === added file 'diana_integracion_biostar/view/horas_extras_view.xml' |
2092 | --- diana_integracion_biostar/view/horas_extras_view.xml 1970-01-01 00:00:00 +0000 |
2093 | +++ diana_integracion_biostar/view/horas_extras_view.xml 2013-06-17 20:23:29 +0000 |
2094 | @@ -0,0 +1,298 @@ |
2095 | +<?xml version="1.0"?> |
2096 | +<openerp> |
2097 | + <data> |
2098 | + <record model="ir.ui.view" id="horas_extras"> |
2099 | + <field name="name">horas.extras.form</field> |
2100 | + <field name="model">horas.extras</field> |
2101 | + <field name="type">form</field> |
2102 | + <field name="arch" type="xml"> |
2103 | + <form string="Horas Extras"> |
2104 | +<!-- |
2105 | + <field name="referencia" select="1" attrs= "{'readonly':[('state','!=', 'draft')]}"/> |
2106 | +--> |
2107 | + <field name="referencia" readonly='True'/> |
2108 | + <field name="concepto_id" select="2" domain="[('state', 'in', ['load', 'review'])]" attrs= "{'readonly':[('state','!=', 'draft')]}"/> |
2109 | + <field name="lineas_ids" nolabel="1" colspan='4' attrs= "{'readonly':[('state','!=', 'draft')]}" > |
2110 | + <tree editable='top'> |
2111 | + <field name='empleado_id' domain="[('state', 'not in', ['borrador', 'egresado'])]" /> |
2112 | + <field name='fecha' /> |
2113 | + <field name='hora_desde'/> |
2114 | + <field name='hora_hasta'/> |
2115 | + <field name='hora_marcaje_entrada' /> |
2116 | + <field name='hora_marcaje' /> |
2117 | + <field name='observacion' /> |
2118 | + <field name='state' /> |
2119 | + <button string="Confirmar" name="%(horas_extras_excepcion_action)d" type="action" icon="gtk-ok" colspan='1' states='exception' /> |
2120 | + </tree> |
2121 | + </field> |
2122 | + <group colspan="4"> |
2123 | + <field name='state' /> |
2124 | + <button string="Confirmar" name="confirmed" type="object" icon="gtk-ok" colspan='1' states='draft' /> |
2125 | + <button string="Revisar" name="revised" type="object" icon="gtk-ok" colspan='1' states='confirmed'/> |
2126 | + |
2127 | + </group> |
2128 | + <group colspan="4"> |
2129 | + <label colspan="1" /> |
2130 | + <button string="Revisar" name="revised" type="object" icon="gtk-ok" states='revised'/> |
2131 | + <button string="Listo" name="ready" type="object" icon="gtk-ok" colspan='1' states='revised' /> |
2132 | + </group> |
2133 | + |
2134 | + </form> |
2135 | + </field> |
2136 | + </record> |
2137 | + <record model="ir.ui.view" id="horas_extras_tree"> |
2138 | + <field name="name">horas.extras.tree</field> |
2139 | + <field name="model">horas.extras</field> |
2140 | + <field name="type">tree</field> |
2141 | + <field name="arch" type="xml"> |
2142 | + <tree string="Horas Extras"> |
2143 | + <field name="referencia" select="1" /> |
2144 | + <field name="concepto_id" select="2" domain="[('state', '=', 'draft')]" /> |
2145 | + <field name="lineas_ids" nolabel="1" colspan='4' /> |
2146 | + </tree> |
2147 | + </field> |
2148 | + </record> |
2149 | + <record model="ir.ui.view" id="horas_extras_lineas"> |
2150 | + <field name="name">horas.extras.lineas.form</field> |
2151 | + <field name="model">horas.extras.lineas</field> |
2152 | + <field name="type">form</field> |
2153 | + <field name="arch" type="xml"> |
2154 | + <form string="Lineas del las horas extra"> |
2155 | + <field name="empleado_id" select="1" /> |
2156 | + <field name="fecha" select="2" /> |
2157 | + <field name="hora_desde" attrs= "{'readonly':[('state','!=', 'draft')]}" /> |
2158 | + <field name="hora_hasta" attrs= "{'readonly':[('state','!=', 'draft')]}" /> |
2159 | + <field name='state' /> |
2160 | +<!-- |
2161 | + <field name="horas_extras_id" /> |
2162 | +--> |
2163 | + </form> |
2164 | + </field> |
2165 | + </record> |
2166 | + <record model="ir.ui.view" id="horas_extras_lineas_tree"> |
2167 | + <field name="name">horas.extras.lineas.tree</field> |
2168 | + <field name="model">horas.extras.lineas</field> |
2169 | + <field name="type">tree</field> |
2170 | + <field name="arch" type="xml"> |
2171 | + <tree string="Lineas del las horas extra"> |
2172 | + <field name="empleado_id" select="1" /> |
2173 | + <field name="fecha" select="2" /> |
2174 | + <field name="hora_hasta" /> |
2175 | + <field name='state' /> |
2176 | + </tree> |
2177 | + </field> |
2178 | + </record> |
2179 | + <record model="ir.ui.view" id="horas_extras_parametros"> |
2180 | + <field name="name">horas.extras.parametros.form</field> |
2181 | + <field name="model">horas.extras.parametros</field> |
2182 | + <field name="type">form</field> |
2183 | + <field name="arch" type="xml"> |
2184 | + <form string="Configuracion de horas extras"> |
2185 | +<!-- |
2186 | + <field name="criterio" /> |
2187 | +--> |
2188 | + <field name="concepto_id" /> |
2189 | + <field name="hour_start" /> |
2190 | + <field name="hour_end" /> |
2191 | + </form> |
2192 | + </field> |
2193 | + </record> |
2194 | + <record model="ir.ui.view" id="horas_extras_parametros_tree"> |
2195 | + <field name="name">horas.extras.parametros.tree</field> |
2196 | + <field name="model">horas.extras.parametros</field> |
2197 | + <field name="type">tree</field> |
2198 | + <field name="arch" type="xml"> |
2199 | + <tree string="Configuracion de horas extras"> |
2200 | +<!-- |
2201 | + <field name="criterio" /> |
2202 | +--> |
2203 | + <field name="concepto_id" /> |
2204 | + <field name="hour_start" /> |
2205 | + <field name="hour_end" /> |
2206 | + </tree> |
2207 | + </field> |
2208 | + </record> |
2209 | + <!-- |
2210 | + Horas extras planificacion lineas |
2211 | + inicio de la vista |
2212 | + --> |
2213 | + <record model="ir.ui.view" id="horas_extras_planificacion_lineas"> |
2214 | + <field name="name">horas.extras.planificacion.lineas.form</field> |
2215 | + <field name="model">horas.extras.planificacion.lineas</field> |
2216 | + <field name="type">form</field> |
2217 | + <field name="arch" type="xml"> |
2218 | + <form string="Planificacion de horas Extras"> |
2219 | + <field name="empleado_id" select="1" /> |
2220 | + <field name="tipo" /> |
2221 | + <field name="hora_desde" /> |
2222 | + <field name="hora_hasta" /> |
2223 | + <field name="serv_comida" /> |
2224 | + <separator /> |
2225 | + <group colspan="4"> |
2226 | + <field name="observacion" colspan="2" /> |
2227 | + </group> |
2228 | + </form> |
2229 | + </field> |
2230 | + </record> |
2231 | + <record model="ir.ui.view" id="horas_extras_planificacion_lineas_tree"> |
2232 | + <field name="name">horas.extras.planificacion.lineas.tree</field> |
2233 | + <field name="model">horas.extras.planificacion.lineas</field> |
2234 | + <field name="type">tree</field> |
2235 | + <field name="arch" type="xml"> |
2236 | + <tree string="Planificacion de horas Extras"> |
2237 | + <field name="empleado_id" select="1" /> |
2238 | + <field name="tipo" /> |
2239 | + <field name="observacion" /> |
2240 | + <field name="hora_desde" /> |
2241 | + <field name="hora_hasta" /> |
2242 | + <field name="serv_comida" /> |
2243 | + </tree> |
2244 | + </field> |
2245 | + </record> |
2246 | + <!-- |
2247 | + fin de la vista |
2248 | + --> |
2249 | + <!-- |
2250 | + inicio de vista de horas extras planificacion |
2251 | + --> |
2252 | + <record model="ir.ui.view" id="horas_extras_planificacion"> |
2253 | + <field name="name">horas.extras.planificacion.form</field> |
2254 | + <field name="model">horas.extras.planificacion</field> |
2255 | + <field name="type">form</field> |
2256 | + <field name="arch" type="xml"> |
2257 | + <form string="Planificacion de Sobretiempo"> |
2258 | + <field name="referencia" select="1" /> |
2259 | + <field name="departamento_id" select="1" attrs= "{'readonly':[('state','!=', 'draft')]}" on_change="onchange_departamento(planificacion_lineas_ids)"/> |
2260 | + <field name="fecha" select="2"/> |
2261 | + <field name="fecha_sobre_tiempo" select="3" attrs= "{'readonly':[('state','!=', 'draft')]}"/> |
2262 | + <separator /> |
2263 | + <field name="planificacion_lineas_ids" nolabel="1" colspan="4" attrs= "{'readonly':[('state','!=', 'draft')]}"> |
2264 | + <tree editable='top'> |
2265 | + <field name="empleado_id" select="1" domain="[('department_id.id', '=', parent.departamento_id ) , ('state', 'not in', ['borrador', 'egresado'])]" /> |
2266 | + <field name="tipo" /> |
2267 | + <field name="observacion" /> |
2268 | + <field name="hora_desde" /> |
2269 | + <field name="hora_hasta" /> |
2270 | + <field name="serv_comida" /> |
2271 | + </tree> |
2272 | + </field> |
2273 | + <group colspan="4"> |
2274 | + <field name='state' /> |
2275 | + <button string="Confirmar" name="confirmed" type="object" icon="gtk-ok" colspan='1' states='draft' /> |
2276 | + </group> |
2277 | + <group colspan="4"> |
2278 | + <button string="Aprobar" name="%(horas_extras_wizard_action)d" type="action" icon="gtk-ok" colspan='1' states='confirmed' /> |
2279 | + <button string="Cancelar" name="cancel" type="object" icon="gtk-cancel" colspan='1' states='confirmed' /> |
2280 | + </group> |
2281 | + </form> |
2282 | + </field> |
2283 | +</record> |
2284 | +<record model="ir.ui.view" id="horas_extras_planificacion_tree"> |
2285 | + <field name="name">horas.extras.planificacion.tree</field> |
2286 | + <field name="model">horas.extras.planificacion</field> |
2287 | + <field name="type">tree</field> |
2288 | + <field name="arch" type="xml"> |
2289 | + <tree string="Planificacion de horas Extras"> |
2290 | + <field name="referencia" select="1" /> |
2291 | + <field name="departamento_id" select="1" /> |
2292 | + <field name="fecha" select="1" /> |
2293 | + <field name="fecha_sobre_tiempo" select="1" /> |
2294 | + <field name="planificacion_lineas_ids" select="1" /> |
2295 | + </tree> |
2296 | + </field> |
2297 | +</record> |
2298 | +<!-- |
2299 | + fin de horas extras parametros |
2300 | +--> |
2301 | + |
2302 | +<!-- |
2303 | +inicio de horas extras planificaion tipo |
2304 | +--> |
2305 | + <record model="ir.ui.view" id="horas_extras_planificacion_tipos"> |
2306 | + <field name="name">horas.extras.planificacion.tipos.form</field> |
2307 | + <field name="model">horas.extras.planificacion.tipos</field> |
2308 | + <field name="type">form</field> |
2309 | + <field name="arch" type="xml"> |
2310 | + <form string="Planificacion de horas Extras"> |
2311 | + <field name="parent_id" /> |
2312 | +<!-- |
2313 | + <field name="child_ids" /> |
2314 | +--> |
2315 | + <field name="name" /> |
2316 | + <field name="descripcion" /> |
2317 | + </form> |
2318 | + </field> |
2319 | + </record> |
2320 | + <record model="ir.ui.view" id="horas_extras_planificacion_tipos_tree"> |
2321 | + <field name="name">horas.extras.planificacion.tipos.tree</field> |
2322 | + <field name="model">horas.extras.planificacion.tipos</field> |
2323 | + <field name="type">tree</field> |
2324 | + <field name="arch" type="xml"> |
2325 | + <tree string="Planificacion de horas Extras"> |
2326 | + <field name="parent_id" /> |
2327 | +<!-- |
2328 | + <field name="child_ids" /> |
2329 | +--> |
2330 | + <field name="name" /> |
2331 | + <field name="descripcion" /> |
2332 | + </tree> |
2333 | + </field> |
2334 | + </record> |
2335 | + |
2336 | +<!-- |
2337 | +fin de horas extras planificaion tipo |
2338 | +--> |
2339 | +<record model="ir.actions.act_window" id="action_horas_extras"> |
2340 | + <field name="name">Horas Extras</field> |
2341 | + <field name="res_model">horas.extras</field> |
2342 | + <field name="view_type">form</field> |
2343 | + <field name="view_mode">form,tree</field> |
2344 | +</record> |
2345 | +<record model="ir.actions.act_window" id="action_horas_extras_lineas"> |
2346 | + <field name="name">Horas extras lineas</field> |
2347 | + <field name="res_model">horas.extras.lineas</field> |
2348 | + <field name="view_type">form</field> |
2349 | + <field name="view_mode">form,tree</field> |
2350 | +</record> |
2351 | +<record model="ir.actions.act_window" id="action_horas_extras_parametros"> |
2352 | + <field name="name">Parametros de horas extras</field> |
2353 | + <field name="view_id" ref="horas_extras_parametros_tree" /> |
2354 | + <field name="res_model">horas.extras.parametros</field> |
2355 | + <field name="view_type">form</field> |
2356 | + <field name="view_mode">form,tree</field> |
2357 | +</record> |
2358 | +<record model="ir.actions.act_window" id="action_horas_extras_planificacion_lineas"> |
2359 | + <field name="name">Planificacion de sobretiempo lineas</field> |
2360 | + <field name="res_model">horas.extras.planificacion.lineas</field> |
2361 | + <field name="view_type">form</field> |
2362 | + <field name="view_mode">form,tree</field> |
2363 | +</record> |
2364 | +<record model="ir.actions.act_window" id="action_horas_extras_planificacion"> |
2365 | + <field name="name">Planificacion de sobretiempo</field> |
2366 | + <field name="res_model">horas.extras.planificacion</field> |
2367 | + <field name="view_type">form</field> |
2368 | + <field name="view_mode">form,tree</field> |
2369 | +</record> |
2370 | + |
2371 | +<record model="ir.actions.act_window" id="action_horas_extras_planificacion_tipos"> |
2372 | + <field name="name">Configuracion de tipos</field> |
2373 | + <field name="view_id" ref="horas_extras_planificacion_tipos_tree" /> |
2374 | + <field name="res_model">horas.extras.planificacion.tipos</field> |
2375 | + <field name="view_type">form</field> |
2376 | + <field name="view_mode">form,tree</field> |
2377 | +</record> |
2378 | + |
2379 | +<menuitem name="Cargar horas extras" id="menu_horextras" action="action_horas_extras" parent="sisb_nomina.menu_hr_root_process" sequence="15" /> |
2380 | +<!-- |
2381 | +<menuitem name="Horas Extras lineas" id="menu_hor_ext_line" action="action_horas_extras_lineas" parent="sisb_nomina.menu_hr_root_process" sequence="15" /> |
2382 | +--> |
2383 | +<menuitem name="Configurar horas extras" id="menu_hor_ext_paran" action="action_horas_extras_parametros" parent="sisb_nomina.payroll_configure" sequence="17" /> |
2384 | +<!-- |
2385 | +<menuitem name="Planificacion de sobretiempo lineas" id="menu_horextras_planificacion_lineas" action="action_horas_extras_planificacion_lineas" parent="sisb_nomina.menu_hr_root_process" sequence="18" /> |
2386 | +--> |
2387 | +<menuitem name="Cargar Formato Sobretiempo" id="menu_horextras_planificacion" action="action_horas_extras_planificacion" parent="sisb_nomina.menu_hr_root_process" sequence="19" /> |
2388 | +<menuitem name="Configurar de tipo de sobretiempo" id="menu_horextras_planificacion_tipos" action="action_horas_extras_planificacion_tipos" parent="sisb_nomina.payroll_configure" sequence="20" /> |
2389 | + |
2390 | + |
2391 | +</data> |
2392 | +</openerp> |
2393 | |
2394 | === added file 'diana_integracion_biostar/view/hr_employee_view.xml' |
2395 | --- diana_integracion_biostar/view/hr_employee_view.xml 1970-01-01 00:00:00 +0000 |
2396 | +++ diana_integracion_biostar/view/hr_employee_view.xml 2013-06-17 20:23:29 +0000 |
2397 | @@ -0,0 +1,22 @@ |
2398 | +<?xml version="1.0" encoding="utf-8"?> |
2399 | +<openerp> |
2400 | + <data> |
2401 | + <record model="ir.ui.view" id="view_employee_form_inherit_bi"> |
2402 | + <field name="name">view.employee.form.inherit.bi</field> |
2403 | + <field name="model">hr.employee</field> |
2404 | + <field name="type">tree</field> |
2405 | +<!-- |
2406 | + <field name="inherit_id" ref="hr.view_employee_tree" /> |
2407 | +--> |
2408 | + <field name="inherit_id" ref="sisb_nomina.view_employee_form_inherit" /> |
2409 | +<!-- |
2410 | + <field eval="14" name="priority" /> |
2411 | +--> |
2412 | + <field name="arch" type="xml"> |
2413 | + <xpath expr='/form/group/group/field[@name="cod_number"]' position='before'> |
2414 | + <field name="no_sujeto_marcaje" /> |
2415 | + </xpath> |
2416 | + </field> |
2417 | + </record> |
2418 | + </data> |
2419 | +</openerp> |
2420 | |
2421 | === added directory 'diana_integracion_biostar/wizard' |
2422 | === added file 'diana_integracion_biostar/wizard/__init__.py' |
2423 | --- diana_integracion_biostar/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
2424 | +++ diana_integracion_biostar/wizard/__init__.py 2013-06-17 20:23:29 +0000 |
2425 | @@ -0,0 +1,6 @@ |
2426 | +import horas_extras_wizard |
2427 | +import horas_extras_execpcion_wizard |
2428 | +import horas_retardo_wizard |
2429 | +import horas_marcaje_wizard |
2430 | +import export_biostar |
2431 | +import consultar_retardos_wizard |
2432 | |
2433 | === added file 'diana_integracion_biostar/wizard/consultar_retardos_view.xml' |
2434 | --- diana_integracion_biostar/wizard/consultar_retardos_view.xml 1970-01-01 00:00:00 +0000 |
2435 | +++ diana_integracion_biostar/wizard/consultar_retardos_view.xml 2013-06-17 20:23:29 +0000 |
2436 | @@ -0,0 +1,70 @@ |
2437 | +<?xml version="1.0" encoding="utf-8"?> |
2438 | +<openerp> |
2439 | + <data> |
2440 | + <record id="view_consultar_retardos_next_wizard" model="ir.ui.view"> |
2441 | + <field name="name">consultar.retardos.next.wizard.form</field> |
2442 | + <field name="model">consultar.retardos.next.wizard</field> |
2443 | + <field name="type">form</field> |
2444 | + <field name="arch" type="xml"> |
2445 | + <form string="Buscar Retardos"> |
2446 | + <field name="codigo" /> |
2447 | + <group colspan="4"> |
2448 | + <button string="BUSCAR" name="consultar" type="object" icon="gtk-ok" /> |
2449 | + <button string="SALIR" name="salir" type="object" icon="gtk-cancel" colspan="1" /> |
2450 | + </group> |
2451 | + </form> |
2452 | + </field> |
2453 | + </record> |
2454 | + <record id="consultar_marcaje_next_action" model="ir.actions.act_window"> |
2455 | + <field name="name">Buscar Retardos</field> |
2456 | + <field name="type">ir.actions.act_window</field> |
2457 | + <field name="res_model">consultar.retardos.next.wizard</field> |
2458 | + <field name="view_type">form</field> |
2459 | + <field name="view_mode">form</field> |
2460 | + <field name="target">new</field> |
2461 | + </record> |
2462 | + <menuitem name="PCP" id="consultar_marcaje" parent="hr.menu_hr_root" sequence="18" /> |
2463 | + <menuitem name="Consultar retardos" id="Consultar_marcaje_pcp" action="consultar_marcaje_next_action" parent="consultar_marcaje" sequence="18" /> |
2464 | + <record id="view_revisar_entrada_lineas_wizard" model="ir.ui.view"> |
2465 | + <field name="name">revisar.entrada.lineas.wizard.form</field> |
2466 | + <field name="model">revisar.entrada.lineas.wizard</field> |
2467 | + <field name="type">form</field> |
2468 | + <field name="arch" type="xml"> |
2469 | + <form string="Marcaje del Empleado"> |
2470 | + <field name="hora" /> |
2471 | + <field name="fecha" /> |
2472 | + <field name="codigo" /> |
2473 | + <field name="nombre" /> |
2474 | + <field name="capta_huella" /> |
2475 | + </form> |
2476 | + </field> |
2477 | + </record> |
2478 | + <record id="view_revisar_entrada_wizard" model="ir.ui.view"> |
2479 | + <field name="name">revisar.entrada.wizard.form</field> |
2480 | + <field name="model">revisar.entrada.wizard</field> |
2481 | + <field name="type">form</field> |
2482 | + <field name="arch" type="xml"> |
2483 | + <form string="Retardos del Trabajador"> |
2484 | + <field name="fecha_desde" readonly="True" /> |
2485 | + <field name="fecha_hasta" readonly="True" /> |
2486 | + <field name="revisar_line_ids" readonly="True" nolabel="1" colspan='4'> |
2487 | + <tree editable='top' colors="orange:tolerancia==2; red:tolerancia>=3"> |
2488 | + <field name="hora" readonly="True" /> |
2489 | + <field name="fecha" readonly="True" /> |
2490 | + <field name="codigo" readonly="True" /> |
2491 | + <field name="nombre" readonly="True" /> |
2492 | + <field name="capta_huella" readonly="True" /> |
2493 | + <field name="tolerancia" readonly="True" /> |
2494 | + </tree> |
2495 | + </field> |
2496 | + <group colspan="4"> |
2497 | + <field name="mensaje" readonly="True" /> |
2498 | + </group> |
2499 | + <group colspan="4"> |
2500 | + <field name="state" readonly="True" /> |
2501 | + </group> |
2502 | + </form> |
2503 | + </field> |
2504 | + </record> |
2505 | + </data> |
2506 | +</openerp> |
2507 | |
2508 | === added file 'diana_integracion_biostar/wizard/consultar_retardos_wizard.py' |
2509 | --- diana_integracion_biostar/wizard/consultar_retardos_wizard.py 1970-01-01 00:00:00 +0000 |
2510 | +++ diana_integracion_biostar/wizard/consultar_retardos_wizard.py 2013-06-17 20:23:29 +0000 |
2511 | @@ -0,0 +1,270 @@ |
2512 | +#!/usr/bin/env python |
2513 | +# -*- coding: utf-8 -*- |
2514 | + |
2515 | +from osv import fields, osv |
2516 | +import datetime |
2517 | +from datetime import timedelta |
2518 | +import time |
2519 | + |
2520 | +class revisar_entrada_wizard(osv.osv_memory): |
2521 | + _name = 'revisar.entrada.wizard' |
2522 | + _description = 'busca la hora de marcaje en el Biometrico' |
2523 | + _columns = { |
2524 | + 'fecha_desde': fields.date('Fecha desde'), |
2525 | + 'fecha_hasta': fields.date('Fecha hasta'), |
2526 | + 'state': fields.selection([('denied','Denegado'), ('accepted','Aceptado')],'Acceso'), |
2527 | + 'mensaje': fields.char('Mensaje', size=300), |
2528 | + |
2529 | + } |
2530 | + _defaults = { |
2531 | + 'state': lambda *a: 'accepted', |
2532 | + } |
2533 | + |
2534 | + |
2535 | + |
2536 | + def salir(self, cr, uid, ids, context=None): |
2537 | + return { |
2538 | + 'type': 'ir.actions.act_window_close', |
2539 | + 'active_id': ids |
2540 | + } |
2541 | + |
2542 | + |
2543 | + def default_get(self, cr, uid, fields, context=None): |
2544 | + if context != None: |
2545 | + res = {'fecha_desde':context['fecha_desde'], 'fecha_hasta': context['fecha_hasta'], 'state':context['state'], 'mensaje':context['mensaje'],'revisar_line_ids':context['revisar_line_ids']} |
2546 | + else: |
2547 | + #~ context = {} |
2548 | + res = {} |
2549 | + return res |
2550 | + |
2551 | + |
2552 | +revisar_entrada_wizard() |
2553 | + |
2554 | + |
2555 | + |
2556 | +class consultar_retardos_next_wizard(osv.osv_memory): |
2557 | + _name = 'consultar.retardos.next.wizard' |
2558 | + _description = 'busca la hora de marcaje en el Biometrico' |
2559 | + _columns = { |
2560 | + 'codigo': fields.char('Codigo', size=64, required=True), |
2561 | + |
2562 | + } |
2563 | + |
2564 | + def salir(self, cr, uid, ids, context=None): |
2565 | + return { |
2566 | + 'type': 'ir.actions.act_window_close', |
2567 | + 'active_id': ids |
2568 | + } |
2569 | + |
2570 | + def discount_case(self, period, fecha): |
2571 | + """ |
2572 | + Funcion que busca el horario de un dia del trabajador a partir de su |
2573 | + periodo y la fecha seleccionada |
2574 | + @param: period: es un interable que tiene los periodos del dia de un trabajador |
2575 | + fecha: el dia delde que se busca |
2576 | + @return: l: un lista que tiene la hora de entrada y salida del empleado |
2577 | + """ |
2578 | + |
2579 | + dia_id = {1:'monday', 2:'tuesday', 3:'wednesday', 4:'thursday', 5:'friday', 6:'saturday', 7:'sunday'} |
2580 | + dia = datetime.datetime.strptime(fecha, '%Y-%m-%d').isoweekday() |
2581 | + func = getattr(period, dia_id[dia]+'_hours_day_id') |
2582 | + func = getattr(func, dia_id[dia]+'_hours_id') |
2583 | + l = [func.hour_start, func.hour_end] |
2584 | + return l |
2585 | + |
2586 | + |
2587 | + def consultar(self, cr, uid, ids, context=None): |
2588 | + data = self.read(cr, uid, ids)[0] |
2589 | + con = self.conexion(cr, uid, ids, context=None) |
2590 | + cod = data['codigo'] |
2591 | + driver = self.reader_id(cr, uid, ids) |
2592 | + if driver: |
2593 | + pass |
2594 | + else: |
2595 | + raise osv.except_osv('ERROR', 'No existen capta huellas o no a seleccionado ninguno en la configuracion') |
2596 | + |
2597 | + cod_id = self.pool.get('hr.employee').search(cr, uid, [('cod_number', '=', cod)]) |
2598 | + cod_obj = self.pool.get('hr.employee').browse(cr, uid, cod_id) |
2599 | + |
2600 | + try: |
2601 | + cod = cod_obj[0].cod_number |
2602 | + nombre = cod_obj[0].name |
2603 | + except: |
2604 | + raise osv.except_osv('ERROR', 'El codigo ingresado no es valido') |
2605 | + |
2606 | + dia = datetime.datetime.now() |
2607 | + |
2608 | + #~ dia = datetime.datetime(2013, 04, 30) |
2609 | + |
2610 | + periodo = self.create_period(dia) |
2611 | + |
2612 | + |
2613 | + periodo = [i for i in periodo if self.discount_case(cod_obj[0].shift_id, i)[0] != '00:00:00' and self.discount_case(cod_obj[0].shift_id, i)[1] != '00:00:00'] |
2614 | + |
2615 | + |
2616 | + |
2617 | + fd = periodo[0] |
2618 | + fh = periodo[-1] |
2619 | + hmw_id = self.pool.get('revisar.entrada.wizard').create(cr, uid, {'fecha_desde': fd, 'fecha_hasta':fh}) |
2620 | + |
2621 | + conex = con.cursor() |
2622 | + tol = 0 |
2623 | + |
2624 | + dia = dia.strptime(dia.strftime( '%H:%M:%S'), '%H:%M:%S') |
2625 | + date = self.discount_case(cod_obj[0].shift_id, dia.strftime("%Y-%m-%d")) |
2626 | + print date |
2627 | + if dia < self.convert_hours(date[0]) + timedelta(minutes=15): |
2628 | + |
2629 | + h1 = self.convert_hours(date[0])+ timedelta(minutes=5) #esta es la hora normal de entrada a la que se adiciona 15 minutos |
2630 | + h2 = self.convert_hours(date[0])+ timedelta(minutes=15) #esta es la hora normal de entrada a la que se adiciona 15 minutos |
2631 | + sql = self.query(cod, fd, fh, driver) |
2632 | + conex.execute(sql) |
2633 | + rows = conex.fetchall() |
2634 | + if not rows: |
2635 | + raise osv.except_osv('ERROR', 'El codigo %s perteneciente al trabajador no existe en el BioStar'%cod ) |
2636 | + for row in rows: |
2637 | + retardos = self.search_delays(row, h1, h2) |
2638 | + if retardos: |
2639 | + tol = tol +1 |
2640 | + crl = self.pool.get('revisar.entrada.lineas.wizard').create(cr, uid, {'hora':retardos[2], 'fecha':retardos[4],'codigo':cod,'nombre':nombre, 'capta_huella':retardos[0], 'tolerancia': tol,'horas_marcaje_id':hmw_id}) |
2641 | + |
2642 | + brw = self.pool.get('revisar.entrada.wizard').read(cr, uid, ids) |
2643 | + brw_line = self.pool.get('revisar.entrada.lineas.wizard').read(cr, uid, ids) |
2644 | + |
2645 | + |
2646 | + context.update({'active_id': hmw_id, 'active_model':'revisar.entrada.wizard'}) |
2647 | + context.update({'active_model':'revisar.entrada.wizard'}) |
2648 | + context.update(brw[0]) |
2649 | + |
2650 | + if tol >= 3: |
2651 | + context.update({'state':'denied'}) |
2652 | + context.update({'mensaje':'Acceso denegado por exceder su limite de tolerancias mensual'}) |
2653 | + else: |
2654 | + context.update({'state':'accepted'}) |
2655 | + context.update({'mensaje':'usted ya posee %s tolerancia el maximo aceptado son 3 mensuales' %tol}) |
2656 | + |
2657 | + |
2658 | + try: |
2659 | + context.update(brw_line[0]) |
2660 | + except: |
2661 | + pass |
2662 | + |
2663 | + elif date[0] =='00:00:00' and date[1] =='00:00:00': |
2664 | + context.update({'fecha_desde': fd, 'fecha_hasta': fh, 'state':'denied' , 'mensaje': 'Acceso denegado este dia es no laboral para usted', 'revisar_line_ids':[]}) |
2665 | + |
2666 | + |
2667 | + else: |
2668 | + context.update({'fecha_desde': fd, 'fecha_hasta': fh, 'state':'denied' , 'mensaje': 'Acceso denegado a exedido la hora limite de entrada', 'revisar_line_ids':[]}) |
2669 | + |
2670 | + |
2671 | + conex.close() |
2672 | + return { |
2673 | + 'view_type': 'form', |
2674 | + 'view_mode': 'form', |
2675 | + 'res_model': 'revisar.entrada.wizard', |
2676 | + 'type': 'ir.actions.act_window', |
2677 | + 'target': 'new', |
2678 | + 'res_ids': [hmw_id], |
2679 | + 'ref': "diana_integracion_biostar.view_revisar_entrada_wizard", |
2680 | + 'res_id':[], |
2681 | + 'context': context, |
2682 | + #~ |
2683 | + } |
2684 | + |
2685 | + |
2686 | + |
2687 | + def reader_id(self, cr, uid, ids): |
2688 | + dev_obj = self.pool.get('biostar.fingerprint') |
2689 | + dev_id = dev_obj.search(cr, uid, [('valido', '=', True)]) |
2690 | + dev_brw = dev_obj.browse(cr, uid, dev_id) |
2691 | + t = [n.reader_id for n in dev_brw] |
2692 | + if len(t) > 1: |
2693 | + t = 'IN %s' %str(tuple(t)) |
2694 | + elif len(t) == 1: |
2695 | + t = '= %s' %t[0] |
2696 | + else: |
2697 | + t = '' |
2698 | + return t |
2699 | + |
2700 | + def create_period(self, dia): |
2701 | + l = [] |
2702 | + for i in xrange(dia.day, 0, -1): |
2703 | + d = dia - timedelta(i) |
2704 | + l.append(d.strftime("%Y-%m-%d")) |
2705 | + |
2706 | + |
2707 | + l.append(dia.strftime("%Y-%m-%d")) |
2708 | + l.pop(0) |
2709 | + return l |
2710 | + |
2711 | + |
2712 | + |
2713 | + |
2714 | + def conexion(self, cr, uid, ids, context=None): |
2715 | + bio_obj = self.pool.get('horas.extras') |
2716 | + bio_conect = bio_obj.conexion(cr, uid, ids, context = None) |
2717 | + #~ cursor = bio_conect.cursor() |
2718 | + return bio_conect |
2719 | + |
2720 | + def query(self, codigo, fecha_inicio, fecha_fin, captahuellas): |
2721 | + sql = ''' |
2722 | + SELECT READER.sName, COUNT(CONVERT(VARCHAR(32), DATEADD(s, EVENT.nDateTime, '1970-01-01'),108)),MIN(CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108)) As hour, MAX(CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108)) As hour,CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) |
2723 | + FROM TB_EVENT_LOG AS EVENT |
2724 | + JOIN TB_USER AS U ON EVENT.nUserID = U.sUserId |
2725 | + JOIN TB_READER AS READER ON EVENT.nReaderIdn = READER.nReaderIdn JOIN TB_EVENT_DATA AS E_DATA ON EVENT.nEventIdn = E_DATA.nEventIdn |
2726 | + JOIN TB_USER_CUSTOMINFO As C ON C.nUserIdn = U.nUserIdn |
2727 | + WHERE E_DATA.nEventIdn = 55 |
2728 | + AND CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) BETWEEN '%s' and '%s' |
2729 | + AND READER.nReaderIdn %s |
2730 | + AND C.sFieldValue5 = %s |
2731 | + GROUP BY CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20), READER.sName |
2732 | + '''%(fecha_inicio, fecha_fin, captahuellas, codigo) |
2733 | + return sql |
2734 | + |
2735 | + def convert_hours(self, hora): |
2736 | + return datetime.datetime.strptime(hora, '%H:%M:%S') |
2737 | + |
2738 | + def search_delays(self, row, h1, h2): |
2739 | + #~ consulta = [i for i in row if self.convert_hours(row[2]) >= self.convert_hours(h1) and self.convert_hours(row[2]) < self.convert_hours(h2)] |
2740 | + consulta = [i for i in row if self.convert_hours(row[2]) >= h1 and self.convert_hours(row[2]) < h2] |
2741 | + if consulta: |
2742 | + return consulta |
2743 | + |
2744 | +consultar_retardos_next_wizard() |
2745 | + |
2746 | + |
2747 | +class revisar_entrada_lineas_wizard(osv.osv_memory): |
2748 | + _name = 'revisar.entrada.lineas.wizard' |
2749 | + _description = 'muestra los campos de salida del Biostart' |
2750 | + _columns = { |
2751 | + 'hora': fields.time('Hora', readonly=True), |
2752 | + 'fecha': fields.date('Fecha'), |
2753 | + 'codigo': fields.char('Codigo', size=64), |
2754 | + 'nombre': fields.char('Nombre', size=64), |
2755 | + 'capta_huella': fields.char('Capta Huellas', size=200), |
2756 | + 'tolerancia': fields.integer('Tolerancia', size=200), |
2757 | + 'horas_marcaje_id': fields.many2one('revisar.entrada.wizard', 'hora de marcaje'), |
2758 | + |
2759 | + } |
2760 | + |
2761 | + |
2762 | + |
2763 | + |
2764 | +revisar_entrada_lineas_wizard() |
2765 | + |
2766 | + |
2767 | + |
2768 | + |
2769 | +class revisar_entrada_wizard(osv.osv_memory): |
2770 | + |
2771 | + _inherit = 'revisar.entrada.wizard' |
2772 | + _columns = { |
2773 | + 'revisar_line_ids': fields.one2many('revisar.entrada.lineas.wizard', 'horas_marcaje_id', 'Lineas de marcaje'), |
2774 | + |
2775 | + |
2776 | + } |
2777 | + |
2778 | + |
2779 | +revisar_entrada_wizard() |
2780 | + |
2781 | + |
2782 | |
2783 | === added file 'diana_integracion_biostar/wizard/export_biostar.py' |
2784 | --- diana_integracion_biostar/wizard/export_biostar.py 1970-01-01 00:00:00 +0000 |
2785 | +++ diana_integracion_biostar/wizard/export_biostar.py 2013-06-17 20:23:29 +0000 |
2786 | @@ -0,0 +1,108 @@ |
2787 | +from osv import fields, osv |
2788 | +import datetime |
2789 | +from datetime import timedelta |
2790 | +import time |
2791 | + |
2792 | + |
2793 | +class exportar_empleado_biostar_wizard(osv.osv_memory): |
2794 | + _name = 'exportar.empleado.biostar.wizard' |
2795 | + _description = 'Exporta los empleados al Biometrico' |
2796 | + |
2797 | + def export(self, cr, uid, ids, context=None): |
2798 | + sql1 = "select TOP 1 sUserID from TB_USER ORDER BY nUserIdn DESC" |
2799 | + sql2 = "INSERT INTO TB_USER VALUES ('%s', 0, '', '', %s, '', 0, 0, 241, 0, 0, 0, CAST('' AS VARBINARY))" |
2800 | + sql3 = "select MAX(nUserIdn) from TB_USER" |
2801 | + sql4 = "INSERT INTO TB_USER_CUSTOMINFO VALUES (%s, 'Asistant Manager', '', '', '', %s, %s, '', '', '', '', '', '', '', '', '', '', '', '', '', '' )" |
2802 | + sql5 = "INSERT INTO TB_USER_EX VALUES (%s, '', '', '', 0, '', 0, 0, 0, '')" |
2803 | + idsw = [context['active_id']] |
2804 | + |
2805 | + try: |
2806 | + bio_conect = self.conexion(cr, uid, ids, context=None) |
2807 | + conex = bio_conect.cursor() |
2808 | + except: |
2809 | + raise osv.except_osv('ERROR', 'Conexion fallida') |
2810 | + |
2811 | + idsw = [context['active_id']] |
2812 | + if len(context['active_ids']) > 1: |
2813 | + idsw = context['active_ids'] |
2814 | + #~ print idsw |
2815 | + cod_obj = self.pool.get('hr.employee').browse(cr, uid, idsw) |
2816 | + for idt in cod_obj: |
2817 | + cod = idt.cod_number |
2818 | + nombre = idt.name |
2819 | + cedula = idt.identification_id |
2820 | + #~ print cod, nombre, cedula |
2821 | + chk = self.user_check(cr, uid, ids, cod, context=None) |
2822 | + if chk == None: |
2823 | + pass |
2824 | + else: |
2825 | + raise osv.except_osv('ERROR', 'Usuario %s ya existe en el BioStar y hace referencia a %s con el codigo: %s y la cedula: %s' %(nombre, chk[0], chk[1], chk[2])) |
2826 | + try: |
2827 | + conex.execute(sql1) |
2828 | + rows = conex.fetchall() |
2829 | + except: |
2830 | + raise osv.except_osv('ERROR', 'Conexion fallida') |
2831 | + |
2832 | + for row in rows: |
2833 | + #~ print "consulata 1", row |
2834 | + id = int(row[0]) + 1 |
2835 | + #~ print "id de sUserID",id |
2836 | + sql2 = sql2 %(nombre, id) |
2837 | + #~ print sql2 |
2838 | + try: |
2839 | + conex.execute(sql2) |
2840 | + except: |
2841 | + raise osv.except_osv('ERROR', 'Conexion fallida') |
2842 | + |
2843 | + conex.execute(sql3) |
2844 | + rows2 = conex.fetchall() |
2845 | + for row in rows2: |
2846 | + id2 = row[0] |
2847 | + |
2848 | + sql4 = sql4 %(id2,cod, cedula) |
2849 | + |
2850 | + try: |
2851 | + conex.execute(sql4) |
2852 | + except: |
2853 | + raise osv.except_osv('ERROR', 'Conexion fallida') |
2854 | + |
2855 | + sql5 = sql5%id2 |
2856 | + #~ print sql5 |
2857 | + try: |
2858 | + conex.execute(sql5) |
2859 | + except: |
2860 | + raise osv.except_osv('ERROR', 'Fallo al insertar usuario') |
2861 | + |
2862 | + |
2863 | + |
2864 | + |
2865 | + bio_conect.commit() |
2866 | + |
2867 | + return { |
2868 | + 'type': 'ir.actions.act_window_close', |
2869 | + 'active_id': ids |
2870 | + } |
2871 | + |
2872 | + def conexion(self, cr, uid, ids, context=None): |
2873 | + bio_obj = self.pool.get('horas.extras') |
2874 | + bio_conect = bio_obj.conexion(cr, uid, ids, context = None) |
2875 | + #~ cursor = bio_conect.cursor() |
2876 | + return bio_conect |
2877 | + |
2878 | + def user_check(self, cr, uid, ids, codigo, context=None): |
2879 | + sql = "SELECT U.sUserName, C.sFieldValue5, C.sFieldValue6 FROM TB_USER AS U JOIN TB_USER_CUSTOMINFO AS C ON U.nUserIdn = C.nUserIdn WHERE sFieldValue5 = %s" %codigo |
2880 | + bio_conect = self.conexion(cr, uid, ids, context=None) |
2881 | + conex = bio_conect.cursor() |
2882 | + conex.execute(sql) |
2883 | + rows = conex.fetchall() |
2884 | + for row in rows: |
2885 | + return row |
2886 | + return None |
2887 | + |
2888 | + def salir(self, cr, uid, ids, context=None): |
2889 | + return { |
2890 | + 'type': 'ir.actions.act_window_close', |
2891 | + 'active_id': ids |
2892 | + } |
2893 | + |
2894 | +exportar_empleado_biostar_wizard() |
2895 | |
2896 | === added file 'diana_integracion_biostar/wizard/export_biostar_view.xml' |
2897 | --- diana_integracion_biostar/wizard/export_biostar_view.xml 1970-01-01 00:00:00 +0000 |
2898 | +++ diana_integracion_biostar/wizard/export_biostar_view.xml 2013-06-17 20:23:29 +0000 |
2899 | @@ -0,0 +1,28 @@ |
2900 | +<?xml version="1.0" encoding="utf-8"?> |
2901 | +<openerp> |
2902 | + <data> |
2903 | + <record id="view_exportar_empleado_biostar_wizard" model="ir.ui.view"> |
2904 | + <field name="name">exportar.empleado.biostar.wizard.form</field> |
2905 | + <field name="model">exportar.empleado.biostar.wizard</field> |
2906 | + <field name="type">form</field> |
2907 | + <field name="arch" type="xml"> |
2908 | + <form string="Exportar empleado a BioStar"> |
2909 | + <group colspan="4"> |
2910 | + <button string="EXPORTAR" name="export" type="object" icon="gtk-ok" confirm="esta seguro que desea continuar"/> |
2911 | + <button string="SALIR" name="salir" type="object" icon="gtk-cancel" colspan="1" /> |
2912 | + </group> |
2913 | + </form> |
2914 | + </field> |
2915 | + </record> |
2916 | + |
2917 | + <act_window name="Exportar empleado a BioStar" |
2918 | + res_model="exportar.empleado.biostar.wizard" |
2919 | + src_model="hr.employee" |
2920 | + key2="client_action_multi" |
2921 | + multi="False" |
2922 | + view_mode="form" |
2923 | + view_type="form" |
2924 | + target="new" |
2925 | + id="action_exportar_empleado_biostar_wizard"/> |
2926 | + </data> |
2927 | +</openerp> |
2928 | |
2929 | === added file 'diana_integracion_biostar/wizard/horas_extras_excepcion_view.xml' |
2930 | --- diana_integracion_biostar/wizard/horas_extras_excepcion_view.xml 1970-01-01 00:00:00 +0000 |
2931 | +++ diana_integracion_biostar/wizard/horas_extras_excepcion_view.xml 2013-06-17 20:23:29 +0000 |
2932 | @@ -0,0 +1,39 @@ |
2933 | +<?xml version="1.0" encoding="utf-8"?> |
2934 | +<openerp> |
2935 | + <data> |
2936 | + <record id="view_horas_extras_excepcion_wizard" model="ir.ui.view"> |
2937 | + <field name="name">horas.extras.excepcion.wizard.form</field> |
2938 | + <field name="model">horas.extras.execepcion.wizard</field> |
2939 | + <field name="type">form</field> |
2940 | + <field name="arch" type="xml"> |
2941 | + <form string="Comprobar horas extras"> |
2942 | + <group colspan="4"> |
2943 | + <field name="confirmar" /> |
2944 | + </group> |
2945 | + <group> |
2946 | + <field name="hora_desde" attrs= "{'readonly':[('confirmar','!=','True')]}" /> |
2947 | + <field name="hora_hasta" attrs= "{'readonly':[('confirmar','!=','True')]}" /> |
2948 | + </group> |
2949 | + <separator /> |
2950 | + <group colspan="4"> |
2951 | + <button string="Aprobar" name="modify" type="object" icon="gtk-ok" /> |
2952 | + <button string="Anular" name="cancel" type="object" icon="gtk-cancel" colspan="1" confirm="esta seguro que desea anular la hora" /> |
2953 | + </group> |
2954 | + <separator /> |
2955 | + <group colspan="4"> |
2956 | + <field name="observacion" /> |
2957 | + </group> |
2958 | + </form> |
2959 | + </field> |
2960 | + </record> |
2961 | + <record id="horas_extras_excepcion_action" model="ir.actions.act_window"> |
2962 | + <field name="name">Modificar hora extra</field> |
2963 | + <field name="type">ir.actions.act_window</field> |
2964 | + <field name="res_model">horas.extras.execepcion.wizard</field> |
2965 | + <field name="view_type">form</field> |
2966 | + <field name="view_mode">form</field> |
2967 | + <field name="view_id" ref="view_horas_extras_excepcion_wizard" /> |
2968 | + <field name="target">new</field> |
2969 | + </record> |
2970 | + </data> |
2971 | +</openerp> |
2972 | |
2973 | === added file 'diana_integracion_biostar/wizard/horas_extras_execpcion_wizard.py' |
2974 | --- diana_integracion_biostar/wizard/horas_extras_execpcion_wizard.py 1970-01-01 00:00:00 +0000 |
2975 | +++ diana_integracion_biostar/wizard/horas_extras_execpcion_wizard.py 2013-06-17 20:23:29 +0000 |
2976 | @@ -0,0 +1,101 @@ |
2977 | +#!/usr/bin/env python |
2978 | +# -*- coding: utf-8 -*- |
2979 | + |
2980 | +from osv import fields, osv |
2981 | +import datetime |
2982 | +import time |
2983 | + |
2984 | +class horas_extras_excepcion_wizard(osv.osv_memory): |
2985 | + _name = 'horas.extras.execepcion.wizard' |
2986 | + _description = 'excepcion de horas extras lineas' |
2987 | + _columns = { |
2988 | + 'hora_desde': fields.time('hora desde'), |
2989 | + 'hora_hasta': fields.time('hora hasta'), |
2990 | + 'confirmar': fields.boolean('Modificar hora'), |
2991 | + 'observacion': fields.text('Observacion', required=True), |
2992 | + } |
2993 | + |
2994 | + def modify(self, cr, uid, ids, context=None): |
2995 | + |
2996 | + data = self.read(cr, uid, ids, [],context=context)[0] |
2997 | + idsw = [context['active_id']] |
2998 | + |
2999 | + if data['confirmar'] == True: |
3000 | + |
3001 | + if data['hora_desde']: |
3002 | + self.pool.get('horas.extras.lineas').write(cr, uid, idsw, {'hora_desde':data['hora_desde']}) |
3003 | + |
3004 | + elif data['hora_hasta']: |
3005 | + self.pool.get('horas.extras.lineas').write(cr, uid, idsw, {'hora_hasta':data['hora_hasta']}) |
3006 | + |
3007 | + else: |
3008 | + raise osv.except_osv('ERROR', "Debe especificar una hora ") |
3009 | + |
3010 | + self.pool.get('horas.extras.lineas').write(cr, uid, idsw, {'state':'done'}) |
3011 | + read = self.read(cr, uid, ids, context=context)[0] |
3012 | + self.pool.get('horas.extras.lineas').write(cr, uid, idsw, {'observacion': read['observacion']}) |
3013 | + |
3014 | + return { |
3015 | + 'type': 'ir.actions.act_window_close', |
3016 | + 'active_id': ids |
3017 | + } |
3018 | + |
3019 | + def cancel(self, cr, uid, ids, context=None): |
3020 | + |
3021 | + idsw = [context['active_id']] |
3022 | + obj_hel = self.pool.get('horas.extras.lineas') |
3023 | + obj_hel.write(cr, uid, idsw, {'state':'cancel'}) |
3024 | + |
3025 | + read = self.read(cr, uid, ids, context=context)[0] |
3026 | + |
3027 | + employee_read = obj_hel.read(cr, uid, idsw) |
3028 | + |
3029 | + for employee in employee_read: |
3030 | + emp = employee['empleado_id'] |
3031 | + emp_fecha = employee['fecha'] |
3032 | + emp_hasta = employee['hora_hasta'] |
3033 | + attendant = employee['create_uid'] |
3034 | + |
3035 | + message = """ Anulada la hora extra del trabajador(a) %s referente a la |
3036 | + Fecha: %s la cual comprende hasta las %s por motivo de: %s""" %(emp[1], emp_fecha, emp_hasta, read['observacion']) |
3037 | + self.smtp_notify(cr, uid, ids, message, emp, attendant) |
3038 | + |
3039 | + obj_hel.write(cr, uid, idsw, {'observacion': read['observacion']}) |
3040 | + |
3041 | + return { |
3042 | + 'type': 'ir.actions.act_window_close', |
3043 | + 'active_id': ids |
3044 | + } |
3045 | + |
3046 | + def smtp_notify(self,cr, uid, ids, message, employee, attendant): |
3047 | + |
3048 | + smtp_server_id = self.pool.get('email.smtpclient').search(cr, uid, [('active','=',True),('state','=','confirm')], context=False) |
3049 | + smtp_server_id = smtp_server_id and smtp_server_id[0] or False |
3050 | + if smtp_server_id : |
3051 | + server_name = self.pool.get('email.smtpclient').browse(cr, uid, smtp_server_id) |
3052 | + email_to = self.pool.get('res.users').browse(cr, uid, int(attendant)).user_email |
3053 | + email = { |
3054 | + 'server_id': smtp_server_id, |
3055 | + 'name': ('ANULADA HORA EXTRA DE %s') %employee[1], |
3056 | + 'server': server_name.server, |
3057 | + 'body': ("%s") %message, |
3058 | + 'to': email_to, |
3059 | + 'from': uid, |
3060 | + } |
3061 | + smtp_obj = self.pool.get('email.smtpclient') |
3062 | + if email['to']: |
3063 | + smtp_obj.send_email(cr, uid, smtp_server_id, email['to'], email['name'], email['body']) |
3064 | + return True |
3065 | + |
3066 | + |
3067 | + |
3068 | + |
3069 | + |
3070 | + |
3071 | + |
3072 | + |
3073 | + |
3074 | + |
3075 | + |
3076 | + |
3077 | +horas_extras_excepcion_wizard() |
3078 | |
3079 | === added file 'diana_integracion_biostar/wizard/horas_extras_planificacion_view.xml' |
3080 | --- diana_integracion_biostar/wizard/horas_extras_planificacion_view.xml 1970-01-01 00:00:00 +0000 |
3081 | +++ diana_integracion_biostar/wizard/horas_extras_planificacion_view.xml 2013-06-17 20:23:29 +0000 |
3082 | @@ -0,0 +1,30 @@ |
3083 | +<?xml version="1.0" encoding="utf-8"?> |
3084 | +<openerp> |
3085 | + <data> |
3086 | + <record id="view_horas_extras_planificacion_wizard" model="ir.ui.view"> |
3087 | + <field name="name">horas.extras.wizard.form</field> |
3088 | + <field name="model">horas.extras.wizard</field> |
3089 | + <field name="type">form</field> |
3090 | + <field name="arch" type="xml"> |
3091 | + <form string="Concepto variable"> |
3092 | + <group colspan="4"> |
3093 | + <field name="concepto_id" domain="[('state', '=', ['load', 'review'])]"/> |
3094 | + </group> |
3095 | + <separator/> |
3096 | + <group colspan="4"> |
3097 | + <button string="Listo" name="done" type="object" icon="gtk-ok" colspan="1" /> |
3098 | + </group> |
3099 | + </form> |
3100 | + </field> |
3101 | + </record> |
3102 | + <record id="horas_extras_wizard_action" model="ir.actions.act_window"> |
3103 | + <field name="name">horas extras wizard</field> |
3104 | + <field name="type">ir.actions.act_window</field> |
3105 | + <field name="res_model">horas.extras.wizard</field> |
3106 | + <field name="view_type">form</field> |
3107 | + <field name="view_mode">form</field> |
3108 | + <field name="view_id" ref="view_horas_extras_planificacion_wizard" /> |
3109 | + <field name="target">new</field> |
3110 | + </record> |
3111 | + </data> |
3112 | +</openerp> |
3113 | |
3114 | === added file 'diana_integracion_biostar/wizard/horas_extras_wizard.py' |
3115 | --- diana_integracion_biostar/wizard/horas_extras_wizard.py 1970-01-01 00:00:00 +0000 |
3116 | +++ diana_integracion_biostar/wizard/horas_extras_wizard.py 2013-06-17 20:23:29 +0000 |
3117 | @@ -0,0 +1,69 @@ |
3118 | +#!/usr/bin/env python |
3119 | +# -*- coding: utf-8 -*- |
3120 | + |
3121 | +from osv import fields, osv |
3122 | +import datetime |
3123 | +import time |
3124 | + |
3125 | + |
3126 | +class horas_extras_wizard(osv.osv_memory): |
3127 | + _name = 'horas.extras.wizard' |
3128 | + _description = 'formato de horas extras' |
3129 | + _columns = { |
3130 | + 'concepto_id': fields.many2one('hr.variable.concepts', 'Concepto'), |
3131 | + 'state' : fields.selection([('draft','Borrardor'), ('done','Listo')], 'Estado', readonly=True), |
3132 | + |
3133 | + } |
3134 | + |
3135 | + _defaults = { |
3136 | + 'state': lambda *a : 'draft' |
3137 | + } |
3138 | + |
3139 | + def done(self, cr, uid, ids, context = None): |
3140 | + |
3141 | + idsw = [context['active_id']] |
3142 | + hep_obj = self.pool.get('horas.extras.planificacion') |
3143 | + hext = self.pool.get('horas.extras') |
3144 | + hextl = self.pool.get('horas.extras.lineas') |
3145 | + hep_brw = hep_obj.browse(cr, uid, idsw) |
3146 | + |
3147 | + data = self.read(cr, uid, ids, [],context=context)[0] |
3148 | + now = datetime.datetime.now().strftime("%Y-%m-%d") |
3149 | + |
3150 | + |
3151 | + if data['concepto_id'] == False: |
3152 | + raise osv.except_osv('ERROR', "Debe seleccionar un concepto variable") |
3153 | + |
3154 | + for i in hep_brw: |
3155 | + fecha = i.fecha_sobre_tiempo |
3156 | + refencia = i.referencia |
3157 | + |
3158 | + if datetime.datetime.strptime(i.fecha_sobre_tiempo, "%Y-%m-%d") >= datetime.datetime.strptime(now, "%Y-%m-%d"): |
3159 | + raise osv.except_osv('ERROR', "No se puede confirmar mientras no se cumpla el periodo de sobretiempo") |
3160 | + |
3161 | + |
3162 | + |
3163 | + hext.create(cr, uid, {'referencia':'ORIGEN:'+ refencia, 'concepto_id':data['concepto_id']}) |
3164 | + |
3165 | + h_id = hext.search(cr, uid, []) |
3166 | + |
3167 | + |
3168 | + h = [h_brw.id for h_brw in hext.browse (cr, uid, h_id)] |
3169 | + |
3170 | + for l in hep_brw[0].planificacion_lineas_ids: |
3171 | + hextl.create(cr, uid, {'fecha': fecha, 'hora_desde': l.hora_desde, 'hora_hasta': l.hora_hasta, 'empleado_id': l.empleado_id.id, 'horas_extras_id': h[-1]}) |
3172 | + #~ hextl.create(cr, uid, {'fecha': '2013-02-04', 'hora_hasta': l.hora_hasta, 'empleado_id': l.empleado_id.id, 'horas_extras_id': h[-1]}) |
3173 | + |
3174 | + hep_obj.write(cr, uid, idsw, {'state': 'done'}) |
3175 | + |
3176 | + |
3177 | + return { |
3178 | + 'type': 'ir.actions.act_window_close', |
3179 | + 'active_id': ids |
3180 | + } |
3181 | + |
3182 | + |
3183 | + |
3184 | + |
3185 | + |
3186 | +horas_extras_wizard() |
3187 | |
3188 | === added file 'diana_integracion_biostar/wizard/horas_marcaje_view.xml' |
3189 | --- diana_integracion_biostar/wizard/horas_marcaje_view.xml 1970-01-01 00:00:00 +0000 |
3190 | +++ diana_integracion_biostar/wizard/horas_marcaje_view.xml 2013-06-17 20:23:29 +0000 |
3191 | @@ -0,0 +1,71 @@ |
3192 | +<?xml version="1.0" encoding="utf-8"?> |
3193 | +<openerp> |
3194 | + <data> |
3195 | + <!-- |
3196 | + Vista para buscar horas de marcaje |
3197 | + --> |
3198 | + <record id="view_horas_marcaje_next_wizard" model="ir.ui.view"> |
3199 | + <field name="name">horas.marcaje.next.wizard.form</field> |
3200 | + <field name="model">horas.marcaje.next.wizard</field> |
3201 | + <field name="type">form</field> |
3202 | + <field name="arch" type="xml"> |
3203 | + <form string="Buscar marcaje"> |
3204 | + <field name="fecha_desde" /> |
3205 | + <field name="fecha_hasta" /> |
3206 | + <group colspan="4"> |
3207 | + <button string="BUSCAR" name="search_hour" type="object" icon="gtk-ok" /> |
3208 | + <button string="SALIR" name="salir" type="object" icon="gtk-cancel" colspan="1" /> |
3209 | + </group> |
3210 | + </form> |
3211 | + </field> |
3212 | + </record> |
3213 | + <!-- |
3214 | + Fin de horas de marcaje |
3215 | + --> |
3216 | + <!-- |
3217 | + |
3218 | + --> |
3219 | + <record id="view_horas_marcaje_wizard" model="ir.ui.view"> |
3220 | + <field name="name">horas.marcaje.wizard.form</field> |
3221 | + <field name="model">horas.marcaje.wizard</field> |
3222 | + <field name="type">form</field> |
3223 | + <field name="arch" type="xml"> |
3224 | + <form string="Marcaje del Empleado"> |
3225 | + <field name="fecha_desde" readonly="True" /> |
3226 | + <field name="fecha_hasta" readonly="True" /> |
3227 | + <field name="h_line_ids" readonly="True" nolabel="1" colspan='4'> |
3228 | + <tree editable='top'> |
3229 | + <field name="hora" readonly="True" /> |
3230 | + <field name="fecha" readonly="True" /> |
3231 | + <field name="codigo" readonly="True" /> |
3232 | + <field name="nombre" readonly="True" /> |
3233 | + <field name="capta_huella" readonly="True" /> |
3234 | + </tree> |
3235 | + </field> |
3236 | + <group col="12" colspan="4"> |
3237 | + <button name="imprimir" string="Imprimir" colspan="1" type="object" icon="gtk-print" /> |
3238 | + <button string="SALIR" name="salir" type="object" icon="gtk-cancel" colspan="1" /> |
3239 | + </group> |
3240 | + </form> |
3241 | + </field> |
3242 | + </record> |
3243 | + <record id="view_horas_marcaje_lineas_wizard" model="ir.ui.view"> |
3244 | + <field name="name">horas.marcaje.lineas.wizard.form</field> |
3245 | + <field name="model">horas.marcaje.lineas.wizard</field> |
3246 | + <field name="type">form</field> |
3247 | + <field name="arch" type="xml"> |
3248 | + <form string="Marcaje del Empleado"> |
3249 | + <field name="hora" /> |
3250 | + <field name="fecha" /> |
3251 | + <field name="codigo" /> |
3252 | + <field name="nombre" /> |
3253 | + <field name="capta_huella" /> |
3254 | + </form> |
3255 | + </field> |
3256 | + </record> |
3257 | + <!-- |
3258 | + <act_window name="Buscar marcaje del empleado" res_model="horas.marcaje.next.wizard" src_model="hr.employee" key2="client_action_multi" multi="True" view_mode="form" view_type="form" target="new" id="action_horas_marcaje_next_wizard" /> |
3259 | + --> |
3260 | + <act_window name="Buscar marcaje del empleado" res_model="horas.marcaje.next.wizard" src_model="hr.employee" key2="client_action_multi" multi="True" view_mode="form" view_type="form" target="new" id="action_horas_marcaje_next_wizard" /> |
3261 | + </data> |
3262 | +</openerp> |
3263 | |
3264 | === added file 'diana_integracion_biostar/wizard/horas_marcaje_wizard.py' |
3265 | --- diana_integracion_biostar/wizard/horas_marcaje_wizard.py 1970-01-01 00:00:00 +0000 |
3266 | +++ diana_integracion_biostar/wizard/horas_marcaje_wizard.py 2013-06-17 20:23:29 +0000 |
3267 | @@ -0,0 +1,199 @@ |
3268 | +#!/usr/bin/env python |
3269 | +# -*- coding: utf-8 -*- |
3270 | + |
3271 | +from osv import fields, osv |
3272 | +import datetime |
3273 | +from datetime import timedelta |
3274 | +import time |
3275 | + |
3276 | +class horas_marcaje_wizard(osv.osv_memory): |
3277 | + _name = 'horas.marcaje.wizard' |
3278 | + _description = 'busca la hora de marcaje en el Biometrico' |
3279 | + _columns = { |
3280 | + 'fecha_desde': fields.date('Fecha desde'), |
3281 | + 'fecha_hasta': fields.date('Fecha hasta'), |
3282 | + |
3283 | + } |
3284 | + |
3285 | + |
3286 | + def salir(self, cr, uid, ids, context=None): |
3287 | + return { |
3288 | + 'type': 'ir.actions.act_window_close', |
3289 | + 'active_id': ids |
3290 | + } |
3291 | + |
3292 | + |
3293 | + def default_get(self, cr, uid, fields, context=None): |
3294 | + if context != None: |
3295 | + res = {'fecha_desde':context['fecha_desde'], 'fecha_hasta': context['fecha_hasta'], 'h_line_ids':context['h_line_ids']} |
3296 | + else: |
3297 | + #~ context = {} |
3298 | + res = {} |
3299 | + return res |
3300 | + |
3301 | + |
3302 | + |
3303 | +horas_marcaje_wizard() |
3304 | + |
3305 | +class horas_marcaje_next_wizard(osv.osv_memory): |
3306 | + _name = 'horas.marcaje.next.wizard' |
3307 | + _description = 'busca la hora de marcaje en el Biometrico' |
3308 | + _columns = { |
3309 | + 'fecha_desde': fields.date('Fecha desde', required=True), |
3310 | + 'fecha_hasta': fields.date('Fecha hasta', required=True), |
3311 | + } |
3312 | + |
3313 | + |
3314 | + def salir(self, cr, uid, ids, context=None): |
3315 | + |
3316 | + return { |
3317 | + 'type': 'ir.actions.act_window_close', |
3318 | + 'active_id': ids |
3319 | + } |
3320 | + |
3321 | + |
3322 | + |
3323 | + def search_hour(self, cr, uid, ids, context=None): |
3324 | + data = self.read(cr, uid, ids)[0] |
3325 | + idsw = [context['active_id']] |
3326 | + conex = self.conexion(cr, uid, ids, context=None) |
3327 | + |
3328 | + if context['active_ids'] > 1: |
3329 | + idsw = context['active_ids'] |
3330 | + |
3331 | + fd = data['fecha_desde'] |
3332 | + fh = data['fecha_hasta'] |
3333 | + |
3334 | + |
3335 | + hmw_id = self.pool.get('horas.marcaje.wizard').create(cr, uid, {'fecha_desde': fd, 'fecha_hasta':fh}) |
3336 | + driver = self. reader_id(cr, uid, ids) |
3337 | + if driver: |
3338 | + pass |
3339 | + else: |
3340 | + raise osv.except_osv('ERROR', 'No existen capta huellas o no a seleccionado ninguno en la configuracion') |
3341 | + |
3342 | + cod_obj = self.pool.get('hr.employee').browse(cr, uid, idsw) |
3343 | + |
3344 | + for idt in cod_obj: |
3345 | + cod = idt.cod_number |
3346 | + nombre = idt.name |
3347 | + sql = self.query(cod,fd, fh, driver) |
3348 | + rows = conex.execute(sql) |
3349 | + for row in rows: |
3350 | + crl = self.pool.get('horas.marcaje.lineas.wizard').create(cr, uid, {'hora':row[0], 'fecha':row[1],'codigo':row[3],'nombre':nombre, 'capta_huella':row[2], 'horas_marcaje_id':hmw_id}) |
3351 | + brw = self.pool.get('horas.marcaje.wizard').read(cr, uid, ids) |
3352 | + brw_line = self.pool.get('horas.marcaje.lineas.wizard').read(cr, uid, ids) |
3353 | + |
3354 | + context.update({'active_id': hmw_id, 'active_model':'horas.marcaje.wizard'}) |
3355 | + context.update({'active_model':'horas.marcaje.wizard'}) |
3356 | + context.update(brw[0]) |
3357 | + |
3358 | + try: |
3359 | + context.update(brw_line[0]) |
3360 | + except: |
3361 | + raise osv.except_osv('ERROR', 'No existen marcajes en el perido desde %s hasta %s' %(fd, fh)) |
3362 | + |
3363 | + return { |
3364 | + 'view_type': 'form', |
3365 | + 'view_mode': 'form', |
3366 | + 'res_model': 'horas.marcaje.wizard', |
3367 | + 'type': 'ir.actions.act_window', |
3368 | + 'target': 'new', |
3369 | + 'res_ids': [hmw_id], |
3370 | + 'ref': "diana_integracion_biostar.view_horas_marcaje_wizard", |
3371 | + 'res_id':[hmw_id], |
3372 | + 'context': context, |
3373 | + |
3374 | + } |
3375 | + |
3376 | + |
3377 | + |
3378 | + def reader_id(self, cr, uid, ids): |
3379 | + dev_obj = self.pool.get('biostar.fingerprint') |
3380 | + dev_id = dev_obj.search(cr, uid, [('valido', '=', True)]) |
3381 | + dev_brw = dev_obj.browse(cr, uid, dev_id) |
3382 | + t = [n.reader_id for n in dev_brw] |
3383 | + if len(t) > 1: |
3384 | + t = 'IN %s' %str(tuple(t)) |
3385 | + elif len(t) == 1: |
3386 | + t = '= %s' %t[0] |
3387 | + else: |
3388 | + t = '' |
3389 | + return t |
3390 | + |
3391 | + def conexion(self, cr, uid, ids, context=None): |
3392 | + bio_obj = self.pool.get('horas.extras') |
3393 | + bio_conect = bio_obj.conexion(cr, uid, ids, context = None) |
3394 | + cursor = bio_conect.cursor() |
3395 | + return cursor |
3396 | + |
3397 | + def query(self, cod,fd, fh, t): |
3398 | + sql = ''' |
3399 | + SELECT CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108), CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20), READER.sName, C.sFieldValue5 |
3400 | + FROM TB_EVENT_LOG AS EVENT |
3401 | + JOIN TB_USER AS U ON EVENT.nUserID = U.sUserId |
3402 | + JOIN TB_READER AS READER ON EVENT.nReaderIdn = READER.nReaderIdn JOIN TB_EVENT_DATA AS E_DATA ON EVENT.nEventIdn = E_DATA.nEventIdn |
3403 | + JOIN TB_USER_CUSTOMINFO As C ON C.nUserIdn = U.nUserIdn |
3404 | + WHERE E_DATA.nEventIdn = 55 |
3405 | + AND CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) >= '%s' |
3406 | + AND CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) <= '%s' |
3407 | + AND READER.nReaderIdn %s |
3408 | + AND C.sFieldValue5 = %s |
3409 | + GROUP BY CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108), READER.sName, CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20), C.sFieldValue5 |
3410 | + ORDER BY CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) |
3411 | + '''%(fd, fh, t, cod) |
3412 | + return sql |
3413 | + |
3414 | + |
3415 | + |
3416 | +horas_marcaje_next_wizard() |
3417 | + |
3418 | +class horas_marcaje_lineas_wizard(osv.osv_memory): |
3419 | + _name = 'horas.marcaje.lineas.wizard' |
3420 | + _description = 'muestra los campos de salida del Biostart' |
3421 | + _columns = { |
3422 | + #~ 'hora_entrada': fields.time('Hora de entrada'), |
3423 | + 'hora': fields.time('Hora', readonly=True), |
3424 | + #~ 'hora_salida': fields.time('Hora de salida'), |
3425 | + 'fecha': fields.date('Fecha'), |
3426 | + 'codigo': fields.char('Codigo', size=64), |
3427 | + 'nombre': fields.char('Nombre', size=64), |
3428 | + 'capta_huella': fields.char('Capta Huellas', size=200), |
3429 | + 'horas_marcaje_id': fields.many2one('horas.marcaje.wizard', 'hora de marcaje'), |
3430 | + } |
3431 | + |
3432 | + |
3433 | + |
3434 | + |
3435 | +horas_marcaje_lineas_wizard() |
3436 | + |
3437 | + |
3438 | +class horas_marcaje_wizard(osv.osv_memory): |
3439 | + |
3440 | + _inherit = 'horas.marcaje.wizard' |
3441 | + _columns = { |
3442 | + 'h_line_ids': fields.one2many('horas.marcaje.lineas.wizard', 'horas_marcaje_id', 'Lineas de marcaje'), |
3443 | + |
3444 | + |
3445 | + } |
3446 | + |
3447 | + def imprimir(self, cr, uid, ids, context=None): |
3448 | + d = {} |
3449 | + d = { |
3450 | + 'ids': context.get('active_ids',[]), |
3451 | + 'model': 'horas.marcaje.wizard', |
3452 | + } |
3453 | + |
3454 | + data = self.read(cr, uid, ids) |
3455 | + data = data[0] |
3456 | + data.update(d) |
3457 | + |
3458 | + return { |
3459 | + 'type': 'ir.actions.report.xml', |
3460 | + 'report_name': 'horas.marcaje', |
3461 | + #~ 'datas': data, |
3462 | + } |
3463 | + |
3464 | + |
3465 | +horas_marcaje_wizard() |
3466 | + |
3467 | |
3468 | === added file 'diana_integracion_biostar/wizard/horas_retardo_wizard.py' |
3469 | --- diana_integracion_biostar/wizard/horas_retardo_wizard.py 1970-01-01 00:00:00 +0000 |
3470 | +++ diana_integracion_biostar/wizard/horas_retardo_wizard.py 2013-06-17 20:23:29 +0000 |
3471 | @@ -0,0 +1,318 @@ |
3472 | +#!/usr/bin/env python |
3473 | +# -*- coding: utf-8 -*- |
3474 | + |
3475 | +from osv import fields, osv |
3476 | +import datetime |
3477 | +from datetime import timedelta |
3478 | +import time |
3479 | + |
3480 | + |
3481 | +class horas_retardo_wizard(osv.osv_memory): |
3482 | + _name = 'horas.retardo.wizard' |
3483 | + _description = 'calculo de retardo automatico contra biometrico' |
3484 | + _columns = { |
3485 | + 'concepto_id': fields.many2one('hr.concept', 'Concepto para descuento por retardos', required=True), |
3486 | + 'concepto_no_trabjada': fields.many2one('hr.concept', 'Concepto para descuento de jornada no trabajada ', required=True), |
3487 | + 'concepto_tiempo_no_trabajda': fields.many2one('hr.concept', 'Concepto para descuento tiempo no laborado', required=True), |
3488 | + } |
3489 | + |
3490 | + def search_hour(self, cr, uid, ids, context=None): |
3491 | + """ |
3492 | + Funcion encargada de buscar las horas de marcaje del empleado |
3493 | + busca mediante una lista de codigos y periodos armando un sql y ejecutandolo |
3494 | + mediante odbc en el BioStar |
3495 | + @return 'type': 'ir.actions.act_window_close' |
3496 | + sale del wizard |
3497 | + """ |
3498 | + try: |
3499 | + t = self.reader_id(cr, uid, ids) |
3500 | + except: |
3501 | + raise osv.except_osv('ERROR', 'Error no se pudo obtener los dispositivos de marcaje talvez no exista una conexion hacia el biometrico o no esten seleccionados los dipositivos') |
3502 | + |
3503 | + if t == '': |
3504 | + raise osv.except_osv('ERROR', 'Error lista de dispositivos de marcaje vacías') |
3505 | + |
3506 | + data = self.read(cr, uid, ids)[0] |
3507 | + concepto_id = data.get('concepto_id') |
3508 | + concepto_jornada_no_trabajda_id = data.get('concepto_no_trabjada') |
3509 | + concepto_horas_no_trabajadas_id = data.get('concepto_tiempo_no_trabajda') |
3510 | + |
3511 | + #~ print concepto_id, jornada_no_trabajda, tiempo_no_trabajado |
3512 | + idsw = [context['active_id']] |
3513 | + |
3514 | + hrvc_linea_obj = self.pool.get('hr.variable.concept.line') |
3515 | + hrvc_obj = self.pool.get('hr.variable.concepts') |
3516 | + # CONEXION CON BASE DE DATOS BIOSTART |
3517 | + bio_obj = self.pool.get('horas.extras') |
3518 | + try: |
3519 | + bio_conect = bio_obj.conexion(cr, uid, ids, context = None) |
3520 | + except: |
3521 | + raise osv.except_osv('ERROR', 'Error conexion fallida ') |
3522 | + |
3523 | + try: |
3524 | + cursor = bio_conect.cursor() |
3525 | + except: |
3526 | + raise osv.except_osv('ERROR', 'Error al crear Cursor') |
3527 | + |
3528 | + # PERIODO A BUSCAR PARA EL SQL |
3529 | + hrvc_brw = hrvc_obj.browse(cr, uid, idsw) |
3530 | + period_id = hrvc_brw[0].hr_process_id.hr_period_ids[0].id |
3531 | + fhp = self.pool.get('hr.period').browse(cr, uid, int(period_id -1)) |
3532 | + fh = [fhp.date_start, fhp.date_end] |
3533 | + #TIPO DE PERIODO DE NOMINA |
3534 | + hr_holidays_id = self.pool.get('hr.holidays.calendar').search(cr, uid, []) |
3535 | + hr_holidays = self.pool.get('hr.holidays.calendar').browse(cr, uid, hr_holidays_id) |
3536 | + if hr_holidays: |
3537 | + hr_holidays_calendar = [i.date for i in hr_holidays] |
3538 | + else: |
3539 | + hr_holidays_calendar = [] |
3540 | + |
3541 | + tipo_obj = self.pool.get('hr.period').browse(cr, uid, int(period_id -1)) |
3542 | + tipo_nomina = tipo_obj.type |
3543 | + |
3544 | + #CODIGO DE EMPLEADO PARA EL SQL |
3545 | + cod = tuple([str(i.employee_id.cod_number) for i in hrvc_brw[0].hr_process_id.hr_payslip_ids if not i.employee_id.no_sujeto_marcaje]) |
3546 | + period2 = self.generate_period(fh) |
3547 | + inicio = period2[0][0:8]+'01' |
3548 | + fin = datetime.datetime.strptime(period2[0], '%Y-%m-%d') - timedelta(days=1) |
3549 | + period1 = self.generate_period([inicio, fin.strftime('%Y-%m-%d')]) |
3550 | + |
3551 | + fecha_inicio = period1[0][0:8]+'01' |
3552 | + fecha_fin = period2[-1] |
3553 | + periodo = period2 |
3554 | + |
3555 | + #~ for i in cod: |
3556 | + #~ periodo = self.generate_valid_period(cr, uid, ids, i, periodo, hr_holidays_calendar) |
3557 | + |
3558 | + j = [] |
3559 | + n = [] |
3560 | + retardos = [] |
3561 | + tiempo_no_laborado = [] |
3562 | + asusencia = [] |
3563 | + |
3564 | + |
3565 | + |
3566 | + for i in cod: |
3567 | + periodo = self.generate_valid_period(cr, uid, ids, i, periodo, hr_holidays_calendar) |
3568 | + #~ print periodo, i |
3569 | + sql = self.query(i, fecha_inicio, fecha_fin, t) |
3570 | + cursor.execute(sql) |
3571 | + rows = cursor.fetchall() |
3572 | + if not rows: |
3573 | + raise osv.except_osv('ERROR', 'El codigo %s perteneciente al trabajador %s no existe en el BioStar'%(i, self.name_for_codnumber(cr, uid, ids, i)) ) |
3574 | + for row in rows: |
3575 | + n.append(row[-1]) |
3576 | + d = self.descuento(cr, uid, ids, context, row, j, concepto_id, idsw, periodo, retardos, tiempo_no_laborado, concepto_horas_no_trabajadas_id, asusencia, concepto_jornada_no_trabajda_id) |
3577 | + asu = self.absence(cr, uid, ids, context, n, periodo, concepto_jornada_no_trabajda_id, idsw, i, asusencia) |
3578 | + j = [] |
3579 | + n = [] |
3580 | + retardos = [] |
3581 | + tiempo_no_laborado = [] |
3582 | + asusencia = [] |
3583 | + |
3584 | + |
3585 | + if d[0]['value'] != 0: |
3586 | + hrvc_linea_obj.create(cr, uid, d[0] , context=None) |
3587 | + |
3588 | + if d[1]['value'] != 0: |
3589 | + hrvc_linea_obj.create(cr, uid, d[1] , context=None) |
3590 | + |
3591 | + |
3592 | + if asu['value'] != 0: |
3593 | + hrvc_linea_obj.create(cr, uid, asu , context=None) |
3594 | + #~ |
3595 | + #~ print '=' * 50 |
3596 | + |
3597 | + |
3598 | + return { |
3599 | + 'type': 'ir.actions.act_window_close', |
3600 | + 'active_id': ids |
3601 | + } |
3602 | + |
3603 | + def salir(self, cr, uid, ids, context=None): |
3604 | + """ |
3605 | + Funcion que se ejecuta en el boton salir |
3606 | + @return {'type': 'ir.actions.act_window_close', |
3607 | + 'active_id': ids} |
3608 | + retorna un diccionario que cierra el wizard |
3609 | + """ |
3610 | + return { |
3611 | + 'type': 'ir.actions.act_window_close', |
3612 | + 'active_id': ids |
3613 | + } |
3614 | + |
3615 | + def reader_id(self, cr, uid, ids): |
3616 | + """ |
3617 | + Funcion que busca la lista de IDS que identifican cada uno de los |
3618 | + capta huellas conectadas al servidor SQL SERVER que contiene el |
3619 | + Biometrico, esta funcion es usada para armar la consulta en SQL para |
3620 | + el Biometrico retorna |
3621 | + @return t: un estring t |
3622 | + |
3623 | + """ |
3624 | + dev_obj = self.pool.get('biostar.fingerprint') |
3625 | + dev_id = dev_obj.search(cr, uid, [('valido', '=', True)]) |
3626 | + dev_brw = dev_obj.browse(cr, uid, dev_id) |
3627 | + t = [n.reader_id for n in dev_brw] |
3628 | + if len(t) > 1: |
3629 | + t = 'IN %s' %str(tuple(t)) |
3630 | + elif len(t) == 1: |
3631 | + t = '= %s' %t[0] |
3632 | + else: |
3633 | + t = '' |
3634 | + return t |
3635 | + |
3636 | + |
3637 | + def generate_period(self, fh): |
3638 | + """ |
3639 | + Funcion encargada de generar un periodo a paratir de dos fechas |
3640 | + @param: fh: es una lista que contiene la fecha de inicio y fin del periodo |
3641 | + @return: l: una lista con todos las fechas intermedias a la fecha fin |
3642 | + e inicio |
3643 | + """ |
3644 | + l = [] |
3645 | + dia1 = datetime.datetime.strptime(fh[0], '%Y-%m-%d') |
3646 | + dia2 = datetime.datetime.strptime(fh[1], '%Y-%m-%d') |
3647 | + dias = abs(dia2 - dia1) |
3648 | + l.append(fh[0]) |
3649 | + for i in range(1, dias.days): |
3650 | + dia_periodo = dia1 + timedelta(i) |
3651 | + l.append(dia_periodo.strftime("%Y-%m-%d")) |
3652 | + l.append(fh[1]) |
3653 | + return l |
3654 | + |
3655 | + def descuento(self, cr, uid, ids, context, row, j, concepto, variable_id, periodo, retardos, tiempo_no_laborado, concepto_horas_no_trabajadas_id, asusencia, concepto_jornada_no_trabajda_id): |
3656 | + |
3657 | + empleado_obj = self.pool.get('hr.employee') |
3658 | + empleado_id = empleado_obj.search(cr, uid, [('cod_number', '=', row[0])]) |
3659 | + empleado_brw = empleado_obj.browse(cr, uid, empleado_id) |
3660 | + period = empleado_brw[0].shift_id |
3661 | + dif_total = self.total_discount('mensual') |
3662 | + d = self. discount_case(period, row[-1]) |
3663 | + des1 = [i for i in row if row[1] < 2 if row[-1] in periodo] |
3664 | + des2 = [i for i in row if row[1] >= 2 if self.cvr_hr(row[2]) >= self.cvr_hr(d[0]) + timedelta(minutes=15) if row[-1] in periodo] |
3665 | + des3 = [i for i in row if row[1] >= 2 if self.cvr_hr(row[2]) >= self.cvr_hr(d[0]) + timedelta(minutes=5) and self.cvr_hr(row[2]) < self.cvr_hr(d[0]) + timedelta(minutes=15) ] |
3666 | + des4 = [i for i in row if row[1] >= 2 if self.cvr_hr(row[3]) < self.cvr_hr(d[1]) if row[-1] in periodo] |
3667 | + |
3668 | + if des1: |
3669 | + asusencia.append(1) |
3670 | + #~ print "descuento1", des1 |
3671 | + |
3672 | + if des2: |
3673 | + asusencia.append(1) |
3674 | + #~ print "descuento2", des2[2] |
3675 | + |
3676 | + if des3: |
3677 | + #~ print des3 |
3678 | + j.append(1) |
3679 | + if len(j) > 3: |
3680 | + asusencia.append(1) |
3681 | + #~ print "descuento totelacia" |
3682 | + else: |
3683 | + if des3[-1] in periodo: |
3684 | + dif = self.subtract_hours(des3[2], d[0], 3600) |
3685 | + retardos.append(dif) |
3686 | + #~ print "tolerancia acumulada", len(j), des3, dif |
3687 | + |
3688 | + if des4: |
3689 | + dif = self.subtract_hours(des4[3], d[1], 3600) |
3690 | + tiempo_no_laborado.append(dif) |
3691 | + #~ print "descuento saldia" , dif, des4[3] |
3692 | + |
3693 | + return [{'employee_id': empleado_id[0], 'value': sum(retardos), 'payroll_id': False, 'variable_concept_id': variable_id[0], 'type': 'qty', 'concept_id': concepto}, |
3694 | + {'employee_id': empleado_id[0], 'value': sum(tiempo_no_laborado), 'payroll_id': False, 'variable_concept_id': variable_id[0], 'type': 'qty', 'concept_id': concepto_horas_no_trabajadas_id}, |
3695 | + {'employee_id': empleado_id[0], 'value': sum(asusencia), 'payroll_id': False, 'variable_concept_id': variable_id[0], 'type': 'qty', 'concept_id': concepto_jornada_no_trabajda_id}] |
3696 | + |
3697 | + def cvr_hr(self, hours): |
3698 | + """ |
3699 | + Funcion encargada de convertir todas las horas en intervalos |
3700 | + los cuales son posibles de realizar operaciones logias y aritmeticas |
3701 | + y generar unos intervalos |
3702 | + @param: hours: es la hora en formato H:M:S la cual se va a llevar |
3703 | + a intervalos |
3704 | + @return: un objeto del tipo datetime |
3705 | + """ |
3706 | + return datetime.datetime.strptime(hours, '%H:%M:%S') |
3707 | + |
3708 | + def subtract_hours(self, hr, ha, criterio): |
3709 | + |
3710 | + r1 = datetime.datetime.strptime(hr, '%H:%M:%S') |
3711 | + r2 = datetime.datetime.strptime(ha, '%H:%M:%S') |
3712 | + dif = r2 - r1 |
3713 | + ab = abs(dif) |
3714 | + time = float(ab.seconds / float(criterio)) |
3715 | + time = round(time, 2) |
3716 | + return time |
3717 | + |
3718 | + def total_discount(self, tipo): |
3719 | + """ |
3720 | + Funcion para calcular el tipo de descuento |
3721 | + al empleado si es nomina mensual o diaria |
3722 | + @param: tipo: tipo de periodo |
3723 | + return: minut: es un numero real de dos decimales, tiene la cantidad a |
3724 | + descontar |
3725 | + """ |
3726 | + minut = 0 |
3727 | + if tipo == 'mensual': |
3728 | + minut = 7.33 |
3729 | + if tipo == 'diario': |
3730 | + minut = 7.33 |
3731 | + return minut |
3732 | + |
3733 | + def discount_case(self, period, fecha): |
3734 | + """ |
3735 | + Funcion que busca el horario de un dia del trabajador a partir de su |
3736 | + periodo y la fecha seleccionada |
3737 | + @param: period: es un interable que tiene los periodos del dia de un trabajador |
3738 | + fecha: el dia delde que se busca |
3739 | + @return: l: un lista que tiene la hora de entrada y salida del empleado |
3740 | + """ |
3741 | + |
3742 | + dia_id = {1:'monday', 2:'tuesday', 3:'wednesday', 4:'thursday', 5:'friday', 6:'saturday', 7:'sunday'} |
3743 | + dia = datetime.datetime.strptime(fecha, '%Y-%m-%d').isoweekday() |
3744 | + func = getattr(period, dia_id[dia]+'_hours_day_id') |
3745 | + func = getattr(func, dia_id[dia]+'_hours_id') |
3746 | + l = [func.hour_start, func.hour_end] |
3747 | + return l |
3748 | + |
3749 | + def query(self, codigo, fecha_inicio, fecha_fin, captahuellas): |
3750 | + sql = ''' |
3751 | + SELECT C.sFieldValue5 , COUNT(CONVERT(VARCHAR(32), DATEADD(s, EVENT.nDateTime, '1970-01-01'),108)),MIN(CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108)) As hour, MAX(CONVERT(VARCHAR(11), DATEADD(s, nDateTime, '1970-01-01'),108)) As hour,CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) |
3752 | + FROM TB_EVENT_LOG AS EVENT |
3753 | + JOIN TB_USER AS U ON EVENT.nUserID = U.sUserId |
3754 | + JOIN TB_READER AS READER ON EVENT.nReaderIdn = READER.nReaderIdn JOIN TB_EVENT_DATA AS E_DATA ON EVENT.nEventIdn = E_DATA.nEventIdn |
3755 | + JOIN TB_USER_CUSTOMINFO As C ON C.nUserIdn = U.nUserIdn |
3756 | + WHERE E_DATA.nEventIdn = 55 |
3757 | + AND CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20) BETWEEN '%s' and '%s' |
3758 | + AND READER.nReaderIdn %s |
3759 | + AND C.sFieldValue5 = %s |
3760 | + GROUP BY CONVERT(nVarchar(10), DATEADD(s, EVENT.nDateTime, '1970-01-01'), 20), C.sFieldValue5 |
3761 | + '''%(fecha_inicio, fecha_fin, captahuellas, codigo) |
3762 | + return sql |
3763 | + |
3764 | + def generate_valid_period(self, cr, uid, ids, codigo, fecha, hr_holidays_calendar): |
3765 | + empleado_obj = self.pool.get('hr.employee') |
3766 | + empleado_id = empleado_obj.search(cr, uid, [('cod_number', '=', codigo)]) |
3767 | + empleado_brw = empleado_obj.browse(cr, uid, empleado_id) |
3768 | + period = empleado_brw[0].shift_id |
3769 | + periodo = [i for i in fecha if i not in hr_holidays_calendar if self.discount_case(period, i)[0] != '00:00:00' and self.discount_case(period, i)[1] != '00:00:00'] |
3770 | + return periodo |
3771 | + |
3772 | + def absence(self, cr, uid, ids, context, fecha, periodo, concepto, variable_id, codigo, asusencia): |
3773 | + empleado_obj = self.pool.get('hr.employee') |
3774 | + empleado_id = empleado_obj.search(cr, uid, [('cod_number', '=', codigo)]) |
3775 | + for x in periodo: |
3776 | + if x not in fecha: |
3777 | + dif_total = self.total_discount('mensual') |
3778 | + asusencia.append(1) |
3779 | + #~ print "descuento por el dia no trabajado",x, codigo |
3780 | + return {'employee_id': empleado_id[0], 'value': int(sum(asusencia)), 'payroll_id': False, 'variable_concept_id': variable_id[0], 'type': 'qty', 'concept_id': concepto} |
3781 | + |
3782 | + def name_for_codnumber(self, cr, uid, ids, codigo): |
3783 | + empleado_obj = self.pool.get('hr.employee') |
3784 | + empleado_id = empleado_obj.search(cr, uid, [('cod_number', '=', codigo)]) |
3785 | + empleado_brw = empleado_obj.browse(cr, uid, empleado_id) |
3786 | + nombre = empleado_brw[0].name |
3787 | + return nombre |
3788 | + |
3789 | +horas_retardo_wizard() |
3790 | |
3791 | === added file 'diana_integracion_biostar/wizard/horas_retardo_wizard.xml' |
3792 | --- diana_integracion_biostar/wizard/horas_retardo_wizard.xml 1970-01-01 00:00:00 +0000 |
3793 | +++ diana_integracion_biostar/wizard/horas_retardo_wizard.xml 2013-06-17 20:23:29 +0000 |
3794 | @@ -0,0 +1,28 @@ |
3795 | +<?xml version="1.0" encoding="utf-8"?> |
3796 | +<openerp> |
3797 | + <data> |
3798 | + <record id="view_horas_retardo_wizard" model="ir.ui.view"> |
3799 | + <field name="name">horas.retardo.wizard.form</field> |
3800 | + <field name="model">horas.retardo.wizard</field> |
3801 | + <field name="type">form</field> |
3802 | + <field name="arch" type="xml"> |
3803 | + <form string="Cargar retardos"> |
3804 | + <group colspan="4"> |
3805 | + <field name="concepto_id" /> |
3806 | + </group> |
3807 | + <group colspan="4"> |
3808 | + <field name="concepto_no_trabjada" /> |
3809 | + </group> |
3810 | + <group colspan="4"> |
3811 | + <field name="concepto_tiempo_no_trabajda" /> |
3812 | + </group> |
3813 | + <group colspan="4"> |
3814 | + <button string="CONTINUAR" name="search_hour" type="object" icon="gtk-ok" confirm="esta seguro que desea continuar" /> |
3815 | + <button string="SALIR" name="salir" type="object" icon="gtk-cancel" colspan="1" /> |
3816 | + </group> |
3817 | + </form> |
3818 | + </field> |
3819 | + </record> |
3820 | + <act_window name="Cargar retardos" res_model="horas.retardo.wizard" src_model="hr.variable.concepts" key2="client_action_multi" multi="False" view_mode="form" view_type="form" target="new" id="action_horas_retardo_wizard" /> |
3821 | + </data> |
3822 | +</openerp> |