Merge lp:~openerp-community/openerp-mexico-localization/6.1-hrpayroll into lp:openerp-mexico-localization/6.1

Proposed by Eduardo Vizcaino Granados on 2012-11-15
Status: Needs review
Proposed branch: lp:~openerp-community/openerp-mexico-localization/6.1-hrpayroll
Merge into: lp:openerp-mexico-localization/6.1
Diff against target: 1668 lines (+1643/-0)
5 files modified
l10n_mx_hr_payroll/__init__.py (+27/-0)
l10n_mx_hr_payroll/__openerp__.py (+53/-0)
l10n_mx_hr_payroll/hr_payroll.py (+430/-0)
l10n_mx_hr_payroll/hr_payroll_data.xml (+977/-0)
l10n_mx_hr_payroll/hr_payroll_view.xml (+156/-0)
To merge this branch: bzr merge lp:~openerp-community/openerp-mexico-localization/6.1-hrpayroll
Reviewer Review Type Date Requested Status
OscarAlca (community) Needs Fixing on 2012-11-21
Nhomar - Vauxoo 2012-11-15 Needs Fixing on 2012-11-15
Review via email: mp+134393@code.launchpad.net

Description of the change

Bases minimas para l10n payroll
conceptos

To post a comment you must log in.
208. By Nhomar - Vauxoo on 2012-11-15

[MERGE]

209. By Nhomar - Vauxoo on 2012-11-15

[CLEAN] print arreglados

210. By Nhomar - Vauxoo on 2012-11-15

[CLEAN] comments

211. By Nhomar - Vauxoo on 2012-11-15

[CLEAN] comments

Nhomar - Vauxoo (nhomar) wrote :

Comentando que debes limpiar los prints.

En las líneas mencionadas

review: Needs Fixing
Eduardo Vizcaino Granados (evigra) wrote :

Aun los cambios no estan completos
sigo reparando

212. By Eduardo Vizcaino Granados on 2012-11-15

[FIX] Modifield field an amended rules

213. By Eduardo Vizcaino Granados on 2012-11-15

[FIX] Modifield field an amended rules

214. By Eduardo Vizcaino Granados on 2012-11-15

[FIX] Amended rules

215. By Eduardo Vizcaino Granados on 2012-11-17

UPDATE

216. By Eduardo Vizcaino Granados on 2012-11-17

UPDATE

217. By Eduardo Vizcaino Granados on 2012-11-17

UPDATE

218. By Eduardo Vizcaino Granados on 2012-11-17

UPDATE

219. By Eduardo Vizcaino Granados on 2012-11-20

[UPDATE] Rules

220. By Eduardo Vizcaino Granados on 2012-11-20

[UPDATE] Rules

221. By Eduardo Vizcaino Granados on 2012-11-20

[UPDATE] Rules

222. By Eduardo Vizcaino Granados on 2012-11-21

[UPDATE] Rules

223. By Eduardo Vizcaino Granados on 2012-11-21

[UPDATE] Rules

224. By Eduardo Vizcaino Granados on 2012-11-21

[UPDATE] Rules

225. By Eduardo Vizcaino Granados on 2012-11-21

[UPDATE] Rules

OscarAlca (oscarolar) wrote :

Aun quedan prints en algunos archivos, hay que quitarlos

review: Needs Fixing
226. By Eduardo Vizcaino Granados on 2012-11-23

[UPDATE] Rules

227. By Eduardo Vizcaino Granados on 2012-11-26

[UPDATE] Rules

228. By Eduardo Vizcaino Granados on 2012-11-27

[UPDATE] Rules

229. By Eduardo Vizcaino Granados on 2012-11-27

[UPDATE] Rules

230. By Eduardo Vizcaino Granados on 2012-11-27

[UPDATE] Rules

231. By Eduardo Vizcaino Granados on 2012-11-27

[UPDATE] Rules

232. By Eduardo Vizcaino Granados on 2012-11-27

[UPDATE] Rules

233. By Eduardo Vizcaino Granados on 2012-11-28

[UPDATE] Rules

234. By Eduardo Vizcaino Granados on 2012-11-28

[UPDATE] Rules

235. By Eduardo Vizcaino Granados on 2012-11-28

[UPDATE] Rules

236. By Eduardo Vizcaino Granados on 2012-11-29

[UPDATE] Rules

237. By Eduardo Vizcaino Granados on 2012-11-29

[UPDATE] Rules

238. By Eduardo Vizcaino Granados on 2012-11-29

[UPDATE] Rules

239. By Eduardo Vizcaino Granados on 2012-11-30

[UPDATE] Rules

240. By Eduardo Vizcaino Granados on 2012-12-03

[UPDATE] Rules and methods

241. By Eduardo Vizcaino Granados on 2012-12-03

[UPDATE] Rules and methods

242. By Eduardo Vizcaino Granados on 2012-12-04

[UPDATE] Rules and methods

Unmerged revisions

242. By Eduardo Vizcaino Granados on 2012-12-04

[UPDATE] Rules and methods

241. By Eduardo Vizcaino Granados on 2012-12-03

[UPDATE] Rules and methods

240. By Eduardo Vizcaino Granados on 2012-12-03

[UPDATE] Rules and methods

239. By Eduardo Vizcaino Granados on 2012-11-30

[UPDATE] Rules

238. By Eduardo Vizcaino Granados on 2012-11-29

[UPDATE] Rules

237. By Eduardo Vizcaino Granados on 2012-11-29

[UPDATE] Rules

236. By Eduardo Vizcaino Granados on 2012-11-29

[UPDATE] Rules

235. By Eduardo Vizcaino Granados on 2012-11-28

[UPDATE] Rules

234. By Eduardo Vizcaino Granados on 2012-11-28

[UPDATE] Rules

233. By Eduardo Vizcaino Granados on 2012-11-28

[UPDATE] Rules

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'l10n_mx_hr_payroll'
2=== added file 'l10n_mx_hr_payroll/__init__.py'
3--- l10n_mx_hr_payroll/__init__.py 1970-01-01 00:00:00 +0000
4+++ l10n_mx_hr_payroll/__init__.py 2012-12-04 15:42:21 +0000
5@@ -0,0 +1,27 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+
27+
28+import hr_payroll
29+
30+
31+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
32+
33
34=== added file 'l10n_mx_hr_payroll/__openerp__.py'
35--- l10n_mx_hr_payroll/__openerp__.py 1970-01-01 00:00:00 +0000
36+++ l10n_mx_hr_payroll/__openerp__.py 2012-12-04 15:42:21 +0000
37@@ -0,0 +1,53 @@
38+# -*- encoding: utf-8 -*-
39+###########################################################################
40+# Module Writen to OpenERP, Open Source Management Solution
41+#
42+# Copyright (c) 2012 - Alce Consorsio Imobiliario
43+# All Rights Reserved.
44+############################################################################
45+# Coded by: EDUARDO VIZCAINO GRANADOS (evigra@hotmail.com)
46+############################################################################
47+#
48+# This program is free software: you can redistribute it and/or modify
49+# it under the terms of the GNU Affero General Public License as
50+# published by the Free Software Foundation, either version 3 of the
51+# License, or (at your option) any later version.
52+#
53+# This program is distributed in the hope that it will be useful,
54+# but WITHOUT ANY WARRANTY; without even the implied warranty of
55+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+# GNU Affero General Public License for more details.
57+#
58+# You should have received a copy of the GNU Affero General Public License
59+# along with this program. If not, see <http://www.gnu.org/licenses/>.
60+#
61+##############################################################################
62+{
63+ "name" : "l10n_mx_hr_payroll",
64+ "version": "0.1",
65+ "author": "Alce Consorsio Inmobiliario",
66+ "category" : "Localization/Mexico",
67+ 'complexity': "easy",
68+ "website": "",
69+ "depends": [
70+ 'hr',
71+ 'hr_payroll',
72+ ],
73+ "data": [
74+ 'hr_payroll_view.xml',
75+ ],
76+ 'update_xml': [
77+ 'hr_payroll_data.xml',
78+ ],
79+ "description": """l10n_mx_hr_payroll
80+=======================================
81+Este modulo agrega las reglas de salario
82+para generar la nomina especifica de la
83+empresa Alce COnsorsio Inmobiliario
84+""",
85+ "auto_install": False,
86+ "installable": True,
87+}
88+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
89+
90+
91
92=== added file 'l10n_mx_hr_payroll/hr_payroll.py'
93--- l10n_mx_hr_payroll/hr_payroll.py 1970-01-01 00:00:00 +0000
94+++ l10n_mx_hr_payroll/hr_payroll.py 2012-12-04 15:42:21 +0000
95@@ -0,0 +1,430 @@
96+# -*- encoding: utf-8 -*-
97+##############################################################################
98+#
99+# OpenERP, Open Source Management Solution
100+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
101+#
102+# This program is free software: you can redistribute it and/or modify
103+# it under the terms of the GNU Affero General Public License as
104+# published by the Free Software Foundation, either version 3 of the
105+# License, or (at your option) any later version.
106+#
107+# This program is distributed in the hope that it will be useful,
108+# but WITHOUT ANY WARRANTY; without even the implied warranty of
109+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110+# GNU Affero General Public License for more details.
111+#
112+# You should have received a copy of the GNU Affero General Public License
113+# along with this program. If not, see <http://www.gnu.org/licenses/>.
114+# sudo easy_install python-dateutil
115+##############################################################################
116+
117+from osv import osv,fields
118+from datetime import *
119+import time, sys, subprocess,os
120+from dateutil.relativedelta import *
121+from dateutil.easter import *
122+from dateutil.rrule import *
123+from dateutil.parser import *
124+
125+import netsvc
126+import tools
127+from tools.translate import _
128+import decimal_precision as dp
129+
130+from tools.safe_eval import safe_eval as eval
131+
132+class hr_payslip_employees(osv.osv_memory):
133+
134+ _inherit ='hr.payslip.employees'
135+ _description = 'Generate payslips for all selected employees'
136+
137+ def compute_sheet(self, cr, uid, ids, context=None):
138+ print "WIZARD LALO"
139+ emp_pool = self.pool.get('hr.employee')
140+ slip_pool = self.pool.get('hr.payslip')
141+ run_pool = self.pool.get('hr.payslip.run')
142+ slip_ids = []
143+ if context is None:
144+ context = {}
145+ data = self.read(cr, uid, ids, context=context)[0]
146+ run_data = {}
147+ if context and context.get('active_id', False):
148+ run_data = run_pool.read(cr, uid, context['active_id'], ['date_start', 'date_end', 'credit_note'])
149+ from_date = run_data.get('date_start', False)
150+ to_date = run_data.get('date_end', False)
151+ credit_note = run_data.get('credit_note', False)
152+ if not data['employee_ids']:
153+ raise osv.except_osv(_("Warning !"), _("You must select employee(s) to generate payslip(s)"))
154+ for emp in emp_pool.browse(cr, uid, data['employee_ids'], context=context):
155+
156+
157+ dayp_from_date = datetime.strptime(from_date,"%Y-%m-%d")
158+ day_from_date = dayp_from_date.strftime("%Y-%m-%d")
159+
160+ dayp_to_date = datetime.strptime(to_date,"%Y-%m-%d")
161+ day_to_date = dayp_to_date.strftime("%Y-%m-%d")
162+
163+
164+ # '&',('date_from','<=', day_from_date),('date_to','>=', day_from_date)
165+ # '&',('date_from','<=', day_to_date),('date_to','>=', day_to_date)
166+
167+ # '|','&',('date_from','<=', day_from_date),('date_to','>=', day_from_date),'&',('date_from','<=', day_to_date),('date_to','>=', day_to_date)
168+ # '&',('employee_id','=', emp.id),'|','&',('date_from','<=', day_from_date),('date_to','>=', day_from_date),'&',('date_from','<=', day_to_date),('date_to','>=', day_to_date)
169+
170+ payslip_ids = slip_pool.search(cr,uid,['&',('employee_id','=', emp.id),'|','&',('date_from','<=', day_from_date),('date_to','>=', day_from_date),'&',('date_from','<=', day_to_date),('date_to','>=', day_to_date)])
171+
172+ print "IDS",payslip_ids
173+ print "NAME=",emp.name,emp.id
174+ print "DATE=",from_date, " DATE=",to_date
175+ if len(payslip_ids)==0:
176+
177+ slip_data = slip_pool.onchange_employee_id(cr, uid, [], from_date, to_date, emp.id, contract_id=False, context=context)
178+ for x in slip_data['value'].get('worked_days_line_ids', False):
179+ print "X=====", x
180+ res = {
181+ 'employee_id': emp.id,
182+ 'name': slip_data['value'].get('name', False),
183+ 'struct_id': slip_data['value'].get('struct_id', False),
184+ 'contract_id': slip_data['value'].get('contract_id', False),
185+ 'payslip_run_id': context.get('active_id', False),
186+ 'input_line_ids': [(0, 0, x) for x in slip_data['value'].get('input_line_ids', False)],
187+ 'worked_days_line_ids': [(0, 0, x) for x in slip_data['value'].get('worked_days_line_ids', False)],
188+ 'date_from': from_date,
189+ 'date_to': to_date,
190+ 'credit_note': credit_note,
191+ }
192+ slip_ids=[slip_pool.create(cr, uid, res, context=context)]
193+ print "slip_ids=",slip_ids
194+ slip_pool.compute_sheet(cr, uid, slip_ids, context=context)
195+ return {'type': 'ir.actions.act_window_close'}
196+
197+hr_payslip_employees()
198+
199+
200+class hr_payslip(osv.osv):
201+ _inherit = 'hr.payslip'
202+ def onchange_employee_id(self, cr, uid, ids, date_from, date_to, employee_id=False, contract_id=False, context=None):
203+ empolyee_obj = self.pool.get('hr.employee')
204+ contract_obj = self.pool.get('hr.contract')
205+ worked_days_obj = self.pool.get('hr.payslip.worked_days')
206+ input_obj = self.pool.get('hr.payslip.input')
207+
208+ if context is None:
209+ context = {}
210+ #delete old worked days lines
211+ old_worked_days_ids = ids and worked_days_obj.search(cr, uid, [('payslip_id', '=', ids[0])], context=context) or False
212+ if old_worked_days_ids:
213+ worked_days_obj.unlink(cr, uid, old_worked_days_ids, context=context)
214+
215+ #delete old input lines
216+ old_input_ids = ids and input_obj.search(cr, uid, [('payslip_id', '=', ids[0])], context=context) or False
217+ if old_input_ids:
218+ input_obj.unlink(cr, uid, old_input_ids, context=context)
219+
220+
221+ #defaults
222+ res = {'value':{
223+ 'line_ids':[],
224+ 'input_line_ids': [],
225+ 'worked_days_line_ids': [],
226+ #'details_by_salary_head':[], TODO put me back
227+ 'name':'',
228+ 'contract_id': False,
229+ 'struct_id': False,
230+ }
231+ }
232+ if (not employee_id) or (not date_from) or (not date_to):
233+ return res
234+ ttyme = datetime.fromtimestamp(time.mktime(time.strptime(date_from, "%Y-%m-%d")))
235+ employee_id = empolyee_obj.browse(cr, uid, employee_id, context=context)
236+ res['value'].update({
237+ 'name': _('Salary Slip of %s for %s') % (employee_id.name, tools.ustr(ttyme.strftime('%B-%Y'))),
238+ 'company_id': employee_id.company_id.id
239+ })
240+
241+ if not context.get('contract', False):
242+ #fill with the first contract of the employee
243+ contract_ids = self.get_contract(cr, uid, employee_id, date_from, date_to, context=context)
244+ res['value'].update({
245+ 'struct_id': contract_ids and contract_obj.read(cr, uid, contract_ids[0], ['struct_id'], context=context)['struct_id'][0] or False,
246+ 'contract_id': contract_ids and contract_ids[0] or False,
247+ })
248+ else:
249+ if contract_id:
250+ #set the list of contract for which the input have to be filled
251+ contract_ids = [contract_id]
252+ #fill the structure with the one on the selected contract
253+ contract_record = contract_obj.browse(cr, uid, contract_id, context=context)
254+ res['value'].update({
255+ 'struct_id': contract_record.struct_id.id,
256+ 'contract_id': contract_id
257+ })
258+ else:
259+ #if we don't give the contract, then the input to fill should be for all current contracts of the employee
260+ contract_ids = self.get_contract(cr, uid, employee_id, date_from, date_to, context=context)
261+ if not contract_ids:
262+ return res
263+
264+ #computation of the salary input
265+ context['lang']="en_US"
266+ worked_days_line_ids = self.get_worked_day_lines(cr, uid, contract_ids, date_from, date_to, context=context)
267+ input_line_ids = self.get_inputs(cr, uid, contract_ids, date_from, date_to, context=context)
268+ res['value'].update({
269+ 'worked_days_line_ids': worked_days_line_ids,
270+ 'input_line_ids': input_line_ids,
271+ })
272+ print "RES=", res
273+ return res
274+
275+
276+ def get_worked_day_lines(self, cr, uid, contract_ids, date_from, date_to, context=None):
277+ def was_on_leave(employee_id, datetime_day, context=None):
278+ res = False
279+ day = datetime_day.strftime("%Y-%m-%d")
280+
281+ holiday_ids = self.pool.get('hr.holidays').search(cr, uid, [('state','=','validate'),('employee_id','=',employee_id),('type','=','remove'),('date_from','<=',day),('date_to','>=',day)])
282+ if holiday_ids:
283+ res = self.pool.get('hr.holidays').browse(cr, uid, holiday_ids, context=context)[0].holiday_status_id.name
284+ return res
285+
286+ res = []
287+ print "CONTEXT=========", context
288+
289+ for contract in self.pool.get('hr.contract').browse(cr, uid, contract_ids, context=context):
290+ if not contract.working_hours:
291+ #fill only if the contract as a working schedule linked
292+ continue
293+ attendances = {
294+ 'name': _("Normal Working Days paid at 100%"),
295+ 'sequence': 1,
296+ 'code': 'WORK100',
297+ 'number_of_days': 0.0,
298+ 'number_of_hours': 0.0,
299+ 'contract_id': contract.id,
300+ }
301+ leaves = {}
302+ day_from = datetime.strptime(date_from,"%Y-%m-%d")
303+ day_to = datetime.strptime(date_to,"%Y-%m-%d")
304+ nb_of_days = (day_to - day_from).days + 1
305+
306+
307+ for day in range(0, nb_of_days):
308+ working_hours_on_day = self.pool.get('resource.calendar').working_hours_on_day(cr, uid, contract.working_hours, day_from + timedelta(days=day), context)
309+ print "DAY=",day, " HOURS=",contract.working_hours, " working_hours_on_day====", working_hours_on_day
310+ if working_hours_on_day:
311+ #the employee had to work
312+
313+ leave_type = was_on_leave(contract.employee_id.id, day_from + timedelta(days=day), context=context)
314+ print "leave_type=",leave_type
315+ if leave_type:
316+ #if he was on leave, fill the leaves dict
317+ if leave_type in leaves:
318+ leaves[leave_type]['number_of_days'] += 1.0
319+ leaves[leave_type]['number_of_hours'] += working_hours_on_day
320+ else:
321+ code=leave_type.replace(" ","_").upper()
322+ leaves[leave_type] = {
323+ 'name': leave_type,
324+ 'sequence': 5,
325+ 'code': code,
326+ 'number_of_days': 1.0,
327+ 'number_of_hours': working_hours_on_day,
328+ 'contract_id': contract.id,
329+ }
330+ else:
331+ #add the input vals to tmp (increment if existing)
332+ attendances['number_of_days'] += 1.0
333+ attendances['number_of_hours'] += working_hours_on_day
334+ holidays_obj = self.pool.get('hr.holidays.status')
335+ holidays_ids=holidays_obj.search(cr, uid, [])
336+ for holiday in holidays_obj.browse(cr, uid, holidays_ids, context=context):
337+ if holiday.name not in leaves:
338+ code=holiday.name.replace(" ","_").upper()
339+ leaves[holiday.name] = {
340+ 'name': holiday.name,
341+ 'sequence': 5,
342+ 'code': code,
343+ 'number_of_days': 0.0,
344+ 'number_of_hours': 0,
345+ 'contract_id': contract.id,
346+ }
347+
348+ leaves = [value for key,value in leaves.items()]
349+ res += [attendances] + leaves
350+ return res
351+
352+ def compute_sheet(self, cr, uid, ids, context=None):
353+ print "IDS===========", ids
354+ slip_line_pool = self.pool.get('hr.payslip.line')
355+ sequence_obj = self.pool.get('ir.sequence')
356+ for payslip in self.browse(cr, uid, ids, context=context):
357+ number = payslip.number or sequence_obj.get(cr, uid, 'salary.slip')
358+
359+ #delete old payslip lines
360+ old_slipline_ids = slip_line_pool.search(cr, uid, [('slip_id', '=', payslip.id)], context=context)
361+# old_slipline_ids
362+
363+ if old_slipline_ids:
364+ slip_line_pool.unlink(cr, uid, old_slipline_ids, context=context)
365+ print "ANTES"
366+ if payslip.contract_id:
367+ #set the list of contract for which the rules have to be applied
368+ contract_ids = [payslip.contract_id.id]
369+ else:
370+
371+ #if we don't give the contract, then the rules to apply should be for all current contracts of the employee
372+ contract_ids = self.get_contract(cr, uid, payslip.employee_id, payslip.date_from, payslip.date_to, context=context)
373+ print "DESPUES"
374+ lines = [(0,0,line) for line in self.pool.get('hr.payslip').get_payslip_lines(cr, uid, contract_ids, payslip.id, context=context)]
375+ print "lines=",lines
376+ self.write(cr, uid, [payslip.id], {'line_ids': lines, 'number': number,}, context=context)
377+ return True
378+
379+ def get_inputs(self, cr, uid, contract_ids, date_from, date_to, context=None):
380+ res = []
381+ contract_obj = self.pool.get('hr.contract')
382+ concept_obj = self.pool.get('hr.contract.concept')
383+ rule_obj = self.pool.get('hr.salary.rule')
384+
385+ structure_ids = contract_obj.get_all_structures(cr, uid, contract_ids, context=context)
386+ rule_ids = self.pool.get('hr.payroll.structure').get_all_rules(cr, uid, structure_ids, context=context)
387+ sorted_rule_ids = [id for id, sequence in sorted(rule_ids, key=lambda x:x[1])]
388+ for contract in contract_obj.browse(cr, uid, contract_ids, context=context):
389+ ###########################
390+ today=datetime.today().date()
391+
392+ concept_id=concept_obj.search(cr, uid, [('contract_id','=',contract.id),('code','=','ANTIG')])
393+ inicio=datetime(int(str(contract.date_start)[:4]),int(str(contract.date_start)[5:7]),int(str(contract.date_start)[8:10]))
394+ days=today - inicio.date()
395+ str_days=str(days)
396+ antiguedad = float(int(str_days.replace(str_days[-14:],"")))/365
397+
398+ vals_contract={"amount":antiguedad}
399+ concept_obj.write(cr, uid, concept_id, vals_contract)
400+
401+ inicio2= datetime(int(today.strftime("%Y")),01,01)
402+
403+ if inicio2 > inicio:
404+ fecha=inicio2
405+ else:
406+ fecha=inicio
407+
408+ concept_id=concept_obj.search(cr, uid, [('contract_id','=',contract.id),('code','=','DLANU')])
409+ days=today - fecha.date()
410+ str_days=str(days)
411+ DLANU = float(int(str_days.replace(str_days[-14:],"")))/365
412+ vals_contract={"amount":DLANU}
413+ concept_obj.write(cr, uid, concept_id, vals_contract)
414+
415+
416+
417+
418+
419+ ###########################
420+ for rule in rule_obj.browse(cr, uid, sorted_rule_ids, context=context):
421+ if rule.input_ids:
422+ for input in rule.input_ids:
423+ inputs = {
424+ 'name': input.name,
425+ 'code': input.code,
426+ 'amount': 0.0,
427+ 'contract_id': contract.id,
428+ }
429+ res += [inputs]
430+ return res
431+
432+hr_payslip()
433+class hr_contract(osv.osv):
434+ _inherit = 'hr.contract'
435+ _columns = {
436+ 'concept_ids': fields.one2many('hr.contract.concept','contract_id','Concept')
437+ }
438+ def create(self, cr, uid, vals, context=False):
439+ ids=False
440+ res=self.save(cr, uid, vals, ids)
441+ return res
442+ def write(self, cr, uid, ids, vals, context=None, update=True):
443+ res=self.save(cr, uid, vals, ids)
444+ return res
445+ def save(self, cr, uid, vals, ids, context=False):
446+ obj_concept = self.pool.get('hr.contract.concept')
447+ if (type(ids) is list and len(ids)>0) or ids==False:
448+ if(ids==0 or ids==False):
449+ ids=[]
450+ res = super(hr_contract, self).create(cr, uid, vals, context=context)
451+ ids.append(res)
452+ data_before = self.browse(cr, uid, ids)[0]
453+ before_name = data_before.name
454+ data = self.browse(cr, uid, ids)[0]
455+ else:
456+ data_before = self.browse(cr, uid, ids)[0]
457+ res = super(hr_contract, self).write(cr, uid, ids, vals)
458+ data = self.browse(cr, uid, ids)[0]
459+ if len(data.concept_ids)==0:
460+ vals_concept={"contract_id":ids[0],"code":"DAGUI", "name":"Dias de aguinaldo","description":"Son los dias otorgados por la empresa", "amount":15}
461+ obj_concept.create(cr, uid, vals_concept, context=context)
462+ vals_concept={"contract_id":ids[0],"code":"ANTIG", "name":"Antiguedad","description":"Son los años de servicio laborandos en este contrato", "amount":0}
463+ obj_concept.create(cr, uid, vals_concept, context=context)
464+ vals_concept={"contract_id":ids[0],"code":"CINFO", "name":"Prestamo Infonavit","description":"Es la retencion al empleado para el pago de su credito", "amount":0}
465+ obj_concept.create(cr, uid, vals_concept, context=context)
466+ vals_concept={"contract_id":ids[0],"code":"DLANU", "name":"Dias Laborados en el año","description":"Son los dias laborados durante el año, para determinar proporciones", "amount":0}
467+ obj_concept.create(cr, uid, vals_concept, context=context)
468+
469+ return res
470+hr_contract()
471+
472+class hr_payslip_run(osv.osv):
473+ _inherit = 'hr.payslip.run'
474+ _columns = {
475+ 'date': fields.date('Date'),
476+ 'type': fields.selection((('nor','Normal'), ('agu','Aguinaldo'), ('ptu','PTU')), 'Type'),
477+ 'schedule_pay': fields.selection([
478+ ('monthly', 'Monthly'),
479+ ('quarterly', 'Quarterly'),
480+ ('semi-annually', 'Semi-annually'),
481+ ('annually', 'Annually'),
482+ ('weekly', 'Weekly'),
483+ ('bi-weekly', 'Bi-weekly'),
484+ ('bi-monthly', 'Bi-monthly'),
485+ ], 'Scheduled Pay', select=True),
486+ }
487+ _defaults = {
488+ 'type': 'nor',
489+ }
490+hr_payslip_run()
491+"""
492+class hr_holidays_status(osv.osv):
493+ _name = 'hr.holidays.status'
494+ _columns = {
495+ 'code': fields.char('Code', size=20, required=True, readonly=False),
496+ }
497+hr_holidays_status()
498+"""
499+
500+class hr_contract_concept(osv.osv):
501+ _name = 'hr.contract.concept'
502+ _columns = {
503+ 'contract_id': fields.many2one('hr.contract', 'Contract',),
504+ 'history_ids': fields.one2many('hr.concept.history','concept_id','History'),
505+ 'name': fields.char('Concept', size=75, required=True, readonly=False),
506+ 'code': fields.char('Code', size=20, required=True, readonly=False),
507+ 'description': fields.char('Description', size=250, required=False, readonly=False),
508+ 'concept_type': fields.selection((('rec','Recursive'), ('val','Value')), 'Amount Type'),
509+ 'amount': fields.float('Amount'),
510+ 'amount_type': fields.selection((('per','Percentage'), ('val','Value')), 'Amount Type'),
511+ }
512+hr_contract_concept()
513+
514+class hr_concept_history(osv.osv):
515+ _name = 'hr.concept.history'
516+ _columns = {
517+ 'concept_id': fields.many2one('hr.contract.concept', 'Concept',),
518+ 'date': fields.date('Date'),
519+ 'amount_initial':fields.float('Amount Initial'),
520+ 'amount_final':fields.float('Amount Final'),
521+ 'amount':fields.float('Amount'),
522+ }
523+hr_concept_history()
524+
525+
526
527=== added file 'l10n_mx_hr_payroll/hr_payroll_data.xml'
528--- l10n_mx_hr_payroll/hr_payroll_data.xml 1970-01-01 00:00:00 +0000
529+++ l10n_mx_hr_payroll/hr_payroll_data.xml 2012-12-04 15:42:21 +0000
530@@ -0,0 +1,977 @@
531+<?xml version="1.0"?>
532+<openerp>
533+ <data>
534+ <!-- ESTRUCTURA SALARIAL -->
535+ <record id="nomina" model="hr.payroll.structure">
536+ <field name="name">Nomina</field>
537+ <field name="code">NOM</field>
538+ </record>
539+ <!-- FIN ESTRUCTURA SALARIAL -->
540+
541+ <!-- CATEGORIAS -->
542+ <record id="CAT_CONCEPTOS" model="hr.salary.rule.category">
543+ <field name="name">CONCEPTOS EMPLEADO</field>
544+ <field name="code">CONCEP</field>
545+ </record>
546+ <record id="CAT_REGLAS" model="hr.salary.rule.category">
547+ <field name="name">REGLAS</field>
548+ <field name="code">REGLAS</field>
549+ </record>
550+
551+ <record id="CAT_CONFIGURACIONES" model="hr.salary.rule.category">
552+ <field name="name">CONFIGURACIONES</field>
553+ <field name="code">CONFIGURACIONES</field>
554+ </record>
555+ <record id="CAT_PERCEPCIONES_G" model="hr.salary.rule.category">
556+ <field name="name">PRECEPCIONES GRAVADAS</field>
557+ <field name="code">PGRAVA</field>
558+ </record>
559+ <record id="CAT_PERCEPCIONES_E" model="hr.salary.rule.category">
560+ <field name="name">PRECEPCIONES EXENTAS</field>
561+ <field name="code">PEXENT</field>
562+ </record>
563+ <record id="CAT_PERCEPCIONES" model="hr.salary.rule.category">
564+ <field name="name">PERCEPCIONES</field>
565+ <field name="code">PERCEPCIONES</field>
566+ </record>
567+ <record id="CAT_IMSS_G" model="hr.salary.rule.category">
568+ <field name="name">IMSS GRAVADO</field>
569+ <field name="code">IGRAVA</field>
570+ </record>
571+ <record id="CAT_OBLIGACIONES" model="hr.salary.rule.category">
572+ <field name="name">IMSS EXENTO</field>
573+ <field name="code">IEXENT</field>
574+ </record>
575+ <record id="CAT_IMSS" model="hr.salary.rule.category">
576+ <field name="name">IMSS</field>
577+ <field name="code">IMSS</field>
578+ </record>
579+
580+ <record id="CAT_DEDUCCIONES" model="hr.salary.rule.category">
581+ <field name="name">DEDUCCIONES</field>
582+ <field name="code">DEDUCCIONES</field>
583+ </record>
584+
585+ <record id="CAT_OBLIGACIONES" model="hr.salary.rule.category">
586+ <field name="name">OBLIGACIONES</field>
587+ <field name="code">OBLIGACIONES</field>
588+ </record>
589+ <!-- FIN CATEGORIAS -->
590+
591+
592+ <!-- REGLAS SALARIALES -->
593+ <record id="REG10" model="hr.salary.rule">
594+ <field name="category_id" ref="CAT_CONFIGURACIONES"/>
595+ <field name="appears_on_payslip" eval="False"/>
596+ <field name="name">Vacaciones</field>
597+ <field name="sequence">10</field>
598+ <field name="code">VACACI</field>
599+ <field name="condition_select">none</field>
600+ <field name="amount_select">code</field>
601+ <field name="amount_python_compute"><![CDATA[antiguedad=ANTIG
602+if antiguedad<2:
603+ vac=6
604+elif antiguedad<3:
605+ vac=8
606+elif antiguedad<4:
607+ vac=10
608+elif antiguedad<5:
609+ vac=12
610+elif antiguedad<10:
611+ vac=14
612+elif antiguedad<15:
613+ vac=16
614+elif antiguedad<20:
615+ vac=18
616+elif antiguedad<25:
617+ vac=20
618+elif antiguedad<30:
619+ vac=22
620+elif antiguedad<35:
621+ vac=24
622+result = vac]]></field>
623+ </record>
624+
625+
626+ <record id="REG12" model="hr.salary.rule">
627+ <field name="category_id" ref="CAT_CONFIGURACIONES"/>
628+ <field name="name">Salario General Vigente al DF</field>
629+ <field name="sequence">12</field>
630+ <field name="code">SGVDF</field>
631+ <field name="condition_select">none</field>
632+ <field name="amount_select">code</field>
633+ <field name="appears_on_payslip" eval="False"/>
634+ <field name="amount_python_compute">result = 62.33</field>
635+ </record>
636+
637+
638+ <record id="REG14" model="hr.salary.rule">
639+ <field name="category_id" ref="CAT_CONFIGURACIONES"/>
640+ <field name="name">Zona salarial del empleado</field>
641+ <field name="sequence">14</field>
642+ <field name="code">ZSALA</field>
643+ <field name="condition_select">none</field>
644+ <field name="amount_select">code</field>
645+ <field name="appears_on_payslip" eval="False"/>
646+ <field name="amount_python_compute">result = 59 </field>
647+ </record>
648+
649+
650+
651+ <record id="REG9" model="hr.salary.rule">
652+ <field name="category_id" ref="CAT_CONCEPTOS"/>
653+ <field name="appears_on_payslip" eval="False"/>
654+ <field name="name">Antiguedad (Años)</field>
655+ <field name="sequence">9</field>
656+ <field name="code">ANTIG</field>
657+ <field name="condition_select">none</field>
658+ <field name="amount_select">code</field>
659+ <field name="amount_python_compute"><![CDATA[result=0
660+for concept in contract.concept_ids:
661+ if concept.code == 'ANTIG':
662+ result=concept.amount]]></field>
663+ </record>
664+
665+ <record id="REG18" model="hr.salary.rule">
666+ <field name="category_id" ref="CAT_CONCEPTOS"/>
667+ <field name="appears_on_payslip" eval="False"/>
668+ <field name="name">Dias de Aguinaldo</field>
669+ <field name="sequence">18</field>
670+ <field name="code">DAGUI</field>
671+ <field name="condition_select">none</field>
672+ <field name="amount_select">code</field>
673+ <field name="amount_python_compute"><![CDATA[monto = [c.amount for c in contract.concept_ids if c.code == 'DAGUI']
674+result=monto and monto[0] or 0.0 ]]></field>
675+ </record>
676+
677+ <record id="REG20" model="hr.salary.rule">
678+ <field name="category_id" ref="CAT_CONCEPTOS"/>
679+ <field name="appears_on_payslip" eval="False"/>
680+ <field name="name">Salario Diario Integrado</field>
681+ <field name="sequence">20</field>
682+ <field name="code">SDI</field>
683+ <field name="condition_select">none</field>
684+ <field name="amount_select">code</field>
685+ <field name="amount_python_compute"><![CDATA[antiguedad=ANTIG
686+aguinaldo=DAGUI
687+vac =VACACI
688+
689+factor=(vac*.25+aguinaldo)/365+1
690+result = factor * contract.wage]]></field>
691+ </record>
692+ <record id="REG21" model="hr.salary.rule">
693+ <field name="category_id" ref="CAT_CONCEPTOS"/>
694+ <field name="appears_on_payslip" eval="False"/>
695+ <field name="name">Vacaciones Disfrutadas</field>
696+ <field name="sequence">20</field>
697+ <field name="code">VDISFR</field>
698+ <field name="condition_select">none</field>
699+ <field name="amount_select">code</field>
700+ <field name="amount_python_compute"><![CDATA[monto = [c.amount for c in contract.concept_ids if c.code == 'DAGUI']
701+result=monto and monto[0] or 0.0 ]]></field>
702+ </record>
703+
704+
705+
706+
707+
708+
709+
710+
711+
712+
713+ <record id="REG40" model="hr.salary.rule">
714+ <field name="category_id" ref="CAT_REGLAS"/>
715+ <field name="name">PAGO DE AGUINALDO</field>
716+ <field name="sequence">16</field>
717+ <field name="code">PAGUI</field>
718+ <field name="condition_select">python</field>
719+ <field name="condition_python"><![CDATA[result=0
720+if payslip.payslip_run_id=='agu':
721+ result=1]]></field>
722+ <field name="amount_select">code</field>
723+ <field name="amount_python_compute">result= 1</field>
724+
725+ </record>
726+
727+
728+
729+
730+
731+
732+
733+
734+
735+
736+
737+ <!-- ######################################### -->
738+ <record id="REG100" model="hr.salary.rule">
739+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
740+ <field name="appears_on_payslip" eval="False"/>
741+ <field name="name">Sueldo (ISR Gravado)</field>
742+ <field name="sequence">100</field>
743+ <field name="code">S_ISG</field>
744+ <field name="condition_select">none</field>
745+ <field name="amount_select">code</field>
746+ <field name="amount_python_compute">result = contract.wage * worked_days.WORK100.number_of_days</field>
747+ </record>
748+ <record id="REG101" model="hr.salary.rule">
749+ <field name="category_id" ref="CAT_IMSS_G"/>
750+ <field name="appears_on_payslip" eval="False"/>
751+ <field name="name">Sueldo (IMSS Gravado)</field>
752+ <field name="sequence">101</field>
753+ <field name="code">S_IMG</field>
754+ <field name="condition_select">none</field>
755+ <field name="amount_select">code</field>
756+ <field name="amount_python_compute">result = S_ISG</field>
757+ </record>
758+ <record id="RE102" model="hr.salary.rule">
759+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
760+ <field name="name">Sueldo</field>
761+ <field name="sequence">102</field>
762+ <field name="code">SUELD</field>
763+ <field name="condition_select">none</field>
764+ <field name="amount_select">code</field>
765+ <field name="amount_python_compute">result = S_ISG</field>
766+ </record>
767+
768+
769+ <!--
770+ <record id="REG51-1" model="hr.structure.salary.rule.rel">
771+ <field name="struct_id" ref="nomina"/>
772+ <field name="rule_id" ref="REG51"/>
773+ </record>
774+
775+ <record id="ACCION" model="hr.rule.input">
776+ <field name="name">Codigo de accion</field>
777+ <field name="code">CODE</field>
778+ <field name="input_id" ref="REG51"/>
779+ </record>
780+ <record id="MONTO" model="hr.rule.input">
781+ <field name="name">Monto de accion</field>
782+ <field name="code">AMOUNT</field>
783+ <field name="input_id" ref="REG51"/>
784+ </record>
785+ -->
786+
787+ <!-- ######################################### -->
788+ <record id="REG110" model="hr.salary.rule">
789+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
790+ <field name="appears_on_payslip" eval="False"/>
791+ <field name="name">Septimo Dia (ISR Gravado)</field>
792+ <field name="sequence">110</field>
793+ <field name="code">SD_ISG</field>
794+ <field name="condition_select">none</field>
795+ <field name="amount_select">code</field>
796+ <field name="amount_python_compute">result = contract.wage * worked_days.WORK100.number_of_days / 6</field>
797+ </record>
798+ <record id="REG111" model="hr.salary.rule">
799+ <field name="category_id" ref="CAT_IMSS_G"/>
800+ <field name="name">Septimo Dia (IMSS Gravado)</field>
801+ <field name="appears_on_payslip" eval="False"/>
802+ <field name="sequence">111</field>
803+ <field name="code">SD_IMG</field>
804+ <field name="condition_select">none</field>
805+ <field name="amount_select">code</field>
806+ <field name="amount_python_compute">result = SD_ISG</field>
807+ </record>
808+ <record id="REG112" model="hr.salary.rule">
809+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
810+ <field name="name">Septimo Dia</field>
811+ <field name="sequence">112</field>
812+ <field name="code">SDIA</field>
813+ <field name="condition_select">none</field>
814+ <field name="amount_select">code</field>
815+ <field name="amount_python_compute">result = SD_ISG</field>
816+ </record>
817+
818+ <!-- ######################################### -->
819+ <record id="REG120" model="hr.salary.rule">
820+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
821+ <field name="appears_on_payslip" eval="False"/>
822+ <field name="name">Bono de Asistencia (ISR Gravado)</field>
823+ <field name="sequence">120</field>
824+ <field name="code">BA_ISG</field>
825+ <field name="condition_select">none</field>
826+ <field name="amount_select">code</field>
827+ <field name="amount_python_compute">result = 0.10 * contract.wage * worked_days.WORK100.number_of_days * 7 /6</field>
828+ </record>
829+ <record id="REG121" model="hr.salary.rule">
830+ <field name="category_id" ref="CAT_IMSS_G"/>
831+ <field name="appears_on_payslip" eval="False"/>
832+ <field name="name">Bono de Asistencia (IMSS Gravado)</field>
833+ <field name="sequence">121</field>
834+ <field name="code">BA_IMG</field>
835+ <field name="condition_select">none</field>
836+ <field name="amount_select">code</field>
837+ <field name="amount_python_compute">result = BA_ISG</field>
838+ </record>
839+ <record id="REG122" model="hr.salary.rule">
840+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
841+ <field name="name">Bono de Asistencia</field>
842+ <field name="sequence">122</field>
843+ <field name="code">BA</field>
844+ <field name="condition_select">none</field>
845+ <field name="amount_select">code</field>
846+ <field name="amount_python_compute">result = BA_ISG</field>
847+ </record>
848+
849+ <!-- ######################################### -->
850+ <record id="REG130" model="hr.salary.rule">
851+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
852+ <field name="appears_on_payslip" eval="False"/>
853+ <field name="name">Bono de Puntualidad (ISR Gravado)</field>
854+ <field name="sequence">130</field>
855+ <field name="code">BP_ISG</field>
856+ <field name="condition_select">none</field>
857+ <field name="amount_select">code</field>
858+ <field name="amount_python_compute">result = 0.10 * contract.wage * worked_days.WORK100.number_of_days * 7 /6</field>
859+ </record>
860+ <record id="REG131" model="hr.salary.rule">
861+ <field name="category_id" ref="CAT_IMSS_G"/>
862+ <field name="name">Bono de Puntualidad (IMSS Gravado)</field>
863+ <field name="appears_on_payslip" eval="False"/>
864+ <field name="sequence">131</field>
865+ <field name="code">BP_IMG</field>
866+ <field name="condition_select">none</field>
867+ <field name="amount_select">code</field>
868+ <field name="amount_python_compute">result = BP_ISG</field>
869+ </record>
870+ <record id="REG132" model="hr.salary.rule">
871+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
872+ <field name="name">Bono de Puntualidad</field>
873+ <field name="sequence">132</field>
874+ <field name="code">SD</field>
875+ <field name="condition_select">none</field>
876+ <field name="amount_select">code</field>
877+ <field name="amount_python_compute">result = BA_ISG</field>
878+ </record>
879+
880+
881+ <!-- ######################################### -->
882+ <record id="REG140" model="hr.salary.rule">
883+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
884+ <field name="name">Despensa (ISR Gravado)</field>
885+ <field name="appears_on_payslip" eval="False"/>
886+ <field name="sequence">140</field>
887+ <field name="code">D_ISG</field>
888+ <field name="condition_select">none</field>
889+ <field name="amount_select">code</field>
890+ <field name="amount_python_compute">result = SGVDF * 0.4 * worked_days.WORK100.number_of_days * 7 /6</field>
891+ </record>
892+ <record id="REG141" model="hr.salary.rule">
893+ <field name="category_id" ref="CAT_IMSS_G"/>
894+ <field name="name">Despensa (IMSS Gravado)</field>
895+ <field name="appears_on_payslip" eval="False"/>
896+ <field name="sequence">141</field>
897+ <field name="code">D_IMG</field>
898+ <field name="condition_select">none</field>
899+ <field name="amount_select">code</field>
900+ <field name="amount_python_compute">result = D_ISG</field>
901+ </record>
902+ <record id="REG142" model="hr.salary.rule">
903+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
904+ <field name="name">Despensa</field>
905+ <field name="sequence">142</field>
906+ <field name="code">D</field>
907+ <field name="condition_select">none</field>
908+ <field name="amount_select">code</field>
909+ <field name="amount_python_compute">result = D_ISG</field>
910+ </record>
911+
912+
913+ <!-- ######################################### -->
914+ <record id="REG150" model="hr.salary.rule">
915+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
916+ <field name="name">Aguinaldo (ISR Gravado)</field>
917+ <field name="appears_on_payslip" eval="False"/>
918+ <field name="sequence">150</field>
919+ <field name="code">A_ISG</field>
920+ <field name="condition_select">python</field>
921+ <field name="condition_python"><![CDATA[antiguedad=ANTIG
922+aguinaldo=DAGUI
923+if antiguedad>1:
924+ proporcional=1
925+else:
926+ proporcional=antiguedad
927+
928+monto_aguinaldo = proporcional * aguinaldo * contract.wage
929+
930+result=0
931+if payslip.payslip_run_id.type=='agu' and monto_aguinaldo - 30 * ZSALA>0:
932+ result=1]]></field>
933+ <field name="amount_select">code</field>
934+ <field name="amount_python_compute"><![CDATA[antiguedad=ANTIG
935+aguinaldo=DAGUI
936+if antiguedad>1:
937+ proporcional=1
938+else:
939+ proporcional=antiguedad
940+monto_aguinaldo = proporcional * aguinaldo * contract.wage
941+result= monto_aguinaldo - 30 * ZSALA]]></field>
942+ </record>
943+
944+ <record id="REG151" model="hr.salary.rule">
945+ <field name="category_id" ref="CAT_PERCEPCIONES_E"/>
946+ <field name="name">Aguinaldo (ISR Exento)</field>
947+ <field name="appears_on_payslip" eval="False"/>
948+ <field name="sequence">151</field>
949+ <field name="code">A_ISE</field>
950+ <field name="condition_select">python</field>
951+
952+ <field name="condition_python"><![CDATA[result=0
953+if payslip.payslip_run_id.type=='agu':
954+ result=1]]></field>
955+
956+ <field name="amount_select">code</field>
957+ <field name="amount_python_compute"><![CDATA[antiguedad=ANTIG
958+aguinaldo=DAGUI
959+if antiguedad>1:
960+ proporcional=1
961+else:
962+ proporcional=antiguedad
963+result = proporcional * aguinaldo * contract.wage
964+if result> 30 * ZSALA and PAGUI>0:
965+ result= monto_aguinaldo - 30 * ZSALA]]></field>
966+ </record>
967+
968+
969+ <record id="REG152" model="hr.salary.rule">
970+ <field name="category_id" ref="CAT_IMSS_G"/>
971+ <field name="name">Aguinaldo (IMSS Gravado)</field>
972+ <field name="appears_on_payslip" eval="False"/>
973+ <field name="sequence">152</field>
974+ <field name="code">A_IMG</field>
975+ <field name="condition_select">python</field>
976+ <field name="condition_python"><![CDATA[antiguedad=ANTIG
977+aguinaldo=DAGUI
978+if antiguedad>1:
979+ proporcional=1
980+else:
981+ proporcional=antiguedad
982+monto_aguinaldo = proporcional * aguinaldo * contract.wage
983+
984+result=0
985+if payslip.payslip_run_id.type=='agu' and monto_aguinaldo - 30 * ZSALA>0:
986+ result=1]]></field>
987+ <field name="amount_select">code</field>
988+ <field name="amount_python_compute"><![CDATA[antiguedad=ANTIG
989+aguinaldo=DAGUI
990+if antiguedad>1:
991+ proporcional=1
992+else:
993+ proporcional=antiguedad
994+monto_aguinaldo = proporcional * aguinaldo * contract.wage
995+result= monto_aguinaldo - 30 * ZSALA]]></field>
996+ </record>
997+ <record id="REG153" model="hr.salary.rule">
998+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
999+ <field name="name">Aguinaldo</field>
1000+ <field name="sequence">153</field>
1001+ <field name="code">A</field>
1002+ <field name="condition_select">python</field>
1003+ <field name="condition_python"><![CDATA[result=0
1004+if payslip.payslip_run_id.type=='agu':
1005+ result=1]]></field>
1006+ <field name="amount_select">code</field>
1007+ <field name="amount_python_compute"><![CDATA[antiguedad=ANTIG
1008+aguinaldo=DAGUI
1009+if antiguedad>1:
1010+ proporcional=1
1011+else:
1012+ proporcional=antiguedad
1013+result = proporcional * aguinaldo * contract.wage]]></field>
1014+ </record>
1015+
1016+ <record id="REG154" model="hr.salary.rule">
1017+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
1018+ <field name="name">Vacaciones (ISR Gravado)</field>
1019+ <field name="appears_on_payslip" eval="False"/>
1020+ <field name="sequence">154</field>
1021+ <field name="code">V_ISG</field>
1022+ <field name="condition_select">python</field>
1023+ <field name="condition_python"><![CDATA[result=worked_days.LEGAL_LEAVES.number_of_days>0]]></field>
1024+ <field name="amount_select">code</field>
1025+ <field name="amount_python_compute">result = contract.wage * worked_days.LEGAL_LEAVES.number_of_days </field>
1026+ </record>
1027+
1028+ <record id="REG155" model="hr.salary.rule">
1029+ <field name="category_id" ref="CAT_PERCEPCIONES_E"/>
1030+ <field name="name">Vacaciones (ISR Exento)</field>
1031+ <field name="appears_on_payslip" eval="False"/>
1032+ <field name="sequence">155</field>
1033+ <field name="code">V_ISE</field>
1034+ <field name="condition_select">python</field>
1035+ <field name="condition_python"><![CDATA[result=worked_days.LEGAL_LEAVES.number_of_days>0]]></field>
1036+ <field name="amount_select">code</field>
1037+ <field name="amount_python_compute">result = 0</field>
1038+ </record>
1039+
1040+ <record id="REG156" model="hr.salary.rule">
1041+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
1042+ <field name="name">Vacaciones</field>
1043+ <field name="sequence">155</field>
1044+ <field name="code">VPAGAD</field>
1045+ <field name="condition_select">python</field>
1046+ <field name="condition_python"><![CDATA[result=worked_days.LEGAL_LEAVES.number_of_days>0]]></field>
1047+ <field name="amount_select">code</field>
1048+ <field name="amount_python_compute">result = contract.wage * worked_days.LEGAL_LEAVES.number_of_days </field>
1049+ </record>
1050+
1051+
1052+
1053+ <record id="REG157" model="hr.salary.rule">
1054+ <field name="category_id" ref="CAT_PERCEPCIONES_G"/>
1055+ <field name="name">Prima Vacacional (ISR Gravado)</field>
1056+ <field name="appears_on_payslip" eval="False"/>
1057+ <field name="sequence">157</field>
1058+ <field name="code">PV_ISG</field>
1059+ <field name="condition_select">python</field>
1060+ <field name="condition_python"><![CDATA[result=worked_days.LEGAL_LEAVES.number_of_days>0]]></field>
1061+ <field name="amount_select">code</field>
1062+ <field name="amount_python_compute">result = contract.wage * worked_days.LEGAL_LEAVES.number_of_days * 0.25</field>
1063+ </record>
1064+
1065+ <record id="REG158" model="hr.salary.rule">
1066+ <field name="category_id" ref="CAT_PERCEPCIONES_E"/>
1067+ <field name="name">Prima Vacacional (ISR Exento)</field>
1068+ <field name="appears_on_payslip" eval="False"/>
1069+ <field name="sequence">158</field>
1070+ <field name="code">PV_ISE</field>
1071+ <field name="condition_select">python</field>
1072+ <field name="condition_python"><![CDATA[result=worked_days.LEGAL_LEAVES.number_of_days>0]]></field>
1073+ <field name="amount_select">code</field>
1074+ <field name="amount_python_compute">result = 0</field>
1075+ </record>
1076+ <record id="REG159" model="hr.salary.rule">
1077+ <field name="category_id" ref="CAT_PERCEPCIONES"/>
1078+ <field name="name">Prima Vacacional</field>
1079+ <field name="sequence">158</field>
1080+ <field name="code">PRIVAC</field>
1081+ <field name="condition_select">python</field>
1082+ <field name="condition_python"><![CDATA[result=worked_days.LEGAL_LEAVES.number_of_days>0]]></field>
1083+ <field name="amount_select">code</field>
1084+ <field name="amount_python_compute">result = contract.wage * worked_days.LEGAL_LEAVES.number_of_days * 0.25</field>
1085+ </record>
1086+
1087+
1088+ <record id="REG160" model="hr.salary.rule">
1089+ <field name="category_id" ref="CAT_PERCEPCIONES_E"/>
1090+ <field name="name">Incapacidad (por riesgo de trabajo)</field>
1091+ <field name="sequence">160</field>
1092+ <field name="code">I_RT</field>
1093+ <field name="condition_select">python</field>
1094+ <field name="condition_python"><![CDATA[result=worked_days.OCCUPATIONAL_RISK_LEAVES.number_of_days>0]]></field>
1095+ <field name="amount_select">code</field>
1096+ <field name="amount_python_compute">result = 0</field>
1097+ </record>
1098+ <record id="REG161" model="hr.salary.rule">
1099+ <field name="category_id" ref="CAT_PERCEPCIONES_E"/>
1100+ <field name="name">Incapacidad (por enfermedad general)</field>
1101+ <field name="sequence">161</field>
1102+ <field name="code">I_EG</field>
1103+ <field name="condition_select">python</field>
1104+ <field name="condition_python"><![CDATA[result=worked_days.GENERAL_DISEASE_LEAVES.number_of_days>0]]></field>
1105+ <field name="amount_select">code</field>
1106+ <field name="amount_python_compute">result = worked_days.GENERAL_DISEASE_LEAVES.number_of_days * contract.wage * 0.4</field>
1107+ </record>
1108+
1109+
1110+ <record id="REG162" model="hr.salary.rule">
1111+ <field name="category_id" ref="CAT_PERCEPCIONES_E"/>
1112+ <field name="name">Incapacidad (por embarazo y maternidad)</field>
1113+ <field name="sequence">162</field>
1114+ <field name="code">I_EM</field>
1115+ <field name="condition_select">python</field>
1116+ <field name="condition_python"><![CDATA[result=worked_days.PREGNANCY_LEAVES.number_of_days>0]]></field>
1117+ <field name="amount_select">code</field>
1118+ <field name="amount_python_compute">result = 0</field>
1119+ </record>
1120+
1121+
1122+
1123+ <!--
1124+ <record id="REG160" model="hr.salary.rule">
1125+ <field name="category_id" ref="hr_payroll.PEXENT"/>
1126+ <field name="name">FINIQUITO Vacaciones </field>
1127+ <field name="sequence">160</field>
1128+ <field name="code">FAGUI</field>
1129+ <field name="condition_select">python</field>
1130+ <field name="condition_python">result = PAGUI</field>
1131+ <field name="amount_select">code</field>
1132+ <field name="amount_python_compute"><![CDATA[
1133+antiguedad=ANTIG
1134+result = contract.wage * 20 * antiguedad
1135+
1136+ ]]></field>
1137+ </record>
1138+ -->
1139+
1140+
1141+ <record id="REG190" model="hr.salary.rule">
1142+ <field name="category_id" ref="CAT_CONCEPTOS"/>
1143+ <field name="appears_on_payslip" eval="False"/>
1144+ <field name="name">PERCEPCIONES EXENTAS</field>
1145+ <field name="sequence">190</field>
1146+ <field name="code">PEXENT</field>
1147+ <field name="condition_select">none</field>
1148+ <field name="amount_select">code</field>
1149+ <field name="amount_python_compute">result = categories.PEXENT</field>
1150+ </record>
1151+ <record id="REG191" model="hr.salary.rule">
1152+ <field name="category_id" ref="CAT_CONCEPTOS"/>
1153+ <field name="appears_on_payslip" eval="False"/>
1154+ <field name="name">PERCEPCIONES GRAVADAS</field>
1155+ <field name="sequence">191</field>
1156+ <field name="code">PGRAVA</field>
1157+ <field name="condition_select">none</field>
1158+ <field name="amount_select">code</field>
1159+ <field name="amount_python_compute">result = categories.PGRAVA</field>
1160+ </record>
1161+ <record id="REG195" model="hr.salary.rule">
1162+ <field name="category_id" ref="CAT_CONCEPTOS"/>
1163+ <field name="name">PERCEPCIONES</field>
1164+ <field name="sequence">195</field>
1165+ <field name="code">PERCEPCIONES</field>
1166+ <field name="condition_select">none</field>
1167+ <field name="amount_select">code</field>
1168+ <field name="amount_python_compute">result = categories.PERCEPCIONES</field>
1169+ </record>
1170+
1171+ <record id="REG199" model="hr.salary.rule">
1172+ <field name="category_id" ref="CAT_CONFIGURACIONES"/>
1173+ <field name="appears_on_payslip" eval="False"/>
1174+ <field name="name">ISPT</field>
1175+ <field name="sequence">199</field>
1176+ <field name="code">ISPT</field>
1177+ <field name="condition_select">none</field>
1178+ <field name="amount_select">code</field>
1179+ <field name="amount_python_compute"><![CDATA[LI_aux = 0.01
1180+LS_aux = 114.24
1181+if categories.PGRAVA>LI_aux and categories.PGRAVA<LS_aux:
1182+ LI = LI_aux
1183+ CF = 0
1184+ Ex = 0.0192
1185+
1186+LI_aux = LS_aux + 0.01
1187+LS_aux = 969.50
1188+if categories.PGRAVA>LI_aux and categories.PGRAVA<LS_aux:
1189+ LI = LI_aux
1190+ CF = 2.17
1191+ Ex = 0.064
1192+
1193+LI_aux = LS_aux + 0.01
1194+LS_aux = 1703.80
1195+if categories.PGRAVA>LI_aux and categories.PGRAVA<LS_aux:
1196+ LI = LI_aux
1197+ CF = 56.91
1198+ Ex = 0.1088
1199+
1200+LI_aux = LS_aux + 0.01
1201+LS_aux = 1980.58
1202+if categories.PGRAVA>LI_aux and categories.PGRAVA<LS_aux:
1203+ LI = LI_aux
1204+ CF = 136.85
1205+ Ex = 0.16
1206+
1207+LI_aux = LS_aux + 0.01
1208+LS_aux = 2371.32
1209+if categories.PGRAVA>LI_aux and categories.PGRAVA<LS_aux:
1210+ LI = LI_aux
1211+ CF = 181.06
1212+ Ex = 0.1792
1213+
1214+LI_aux = LS_aux + 0.01
1215+LS_aux = 4782.61
1216+if categories.PGRAVA>LI_aux and categories.PGRAVA<LS_aux:
1217+ LI = LI_aux
1218+ CF = 251.16
1219+ Ex = 0.2136
1220+
1221+LI_aux = LS_aux + 0.01
1222+LS_aux = 7538.09
1223+if categories.PGRAVA>LI_aux and categories.PGRAVA<LS_aux:
1224+ LI = LI_aux
1225+ CF = 766.15
1226+ Ex = 0.2352
1227+
1228+LI_aux = LS_aux + 0.01
1229+if categories.PGRAVA>LI_aux:
1230+ LI = LI_aux
1231+ CF = 1414.28
1232+ Ex = 0.30
1233+result = ((categories.PGRAVA - LI) * Ex + CF)]]></field>
1234+ </record>
1235+
1236+<!-- ######################################### -->
1237+<!-- ######################################### -->
1238+<!-- ######################################### -->
1239+
1240+ <record id="REG200" model="hr.salary.rule">
1241+ <field name="category_id" ref="CAT_CONFIGURACIONES"/>
1242+ <field name="name">Subsidio al Empleo acreditado</field>
1243+ <field name="sequence">200</field>
1244+ <field name="code">SEA</field>
1245+ <field name="condition_select">none</field>
1246+ <field name="amount_select">code</field>
1247+ <field name="amount_python_compute"><![CDATA[if categories.PGRAVA>0.01 and categories.PGRAVA<407.33:
1248+ result = 93.73
1249+if categories.PGRAVA>407.34 and categories.PGRAVA<610.96:
1250+ result = 93.66
1251+if categories.PGRAVA>610.97 and categories.PGRAVA<799.68:
1252+ result = 93.66
1253+if categories.PGRAVA>799.69 and categories.PGRAVA<814.66:
1254+ result = 90.44
1255+if categories.PGRAVA>814.67 and categories.PGRAVA<1023.75:
1256+ result = 88.06
1257+if categories.PGRAVA>1023.76 and categories.PGRAVA<1086.16:
1258+ result = 81.55
1259+if categories.PGRAVA>1086.20 and categories.PGRAVA<1228.57:
1260+ result = 74.83
1261+if categories.PGRAVA>1228.58 and categories.PGRAVA<1433.32:
1262+ result = 67.83
1263+if categories.PGRAVA>1433.33 and categories.PGRAVA<1638.07:
1264+ result = 58.38
1265+if categories.PGRAVA>1638.08 and categories.PGRAVA<1699.88:
1266+ result = 50.12
1267+if categories.PGRAVA>1699.89:
1268+ result = 0
1269+result=result*-1]]></field>
1270+ </record>
1271+
1272+ <record id="REG202" model="hr.salary.rule">
1273+ <field name="category_id" ref="CAT_DEDUCCIONES"/>
1274+ <field name="name">Subsidio al empleo (sp) </field>
1275+ <field name="sequence">202</field>
1276+ <field name="code">SESP</field>
1277+ <field name="condition_select">python</field>
1278+ <field name="condition_python">result = -ISPT > SEA</field>
1279+ <field name="amount_select">code</field>
1280+ <field name="amount_python_compute">result =SEA + ISPT</field>
1281+ </record>
1282+
1283+ <record id="REG204" model="hr.salary.rule">
1284+ <field name="category_id" ref="CAT_CONCEPTOS"/>
1285+ <field name="name">ISPT antes de Sub al Empleo</field>
1286+ <field name="sequence">204</field>
1287+ <field name="code">ISPT_SE</field>
1288+ <field name="condition_select">none</field>
1289+ <field name="amount_select">code</field>
1290+ <field name="amount_python_compute">result =ISPT</field>
1291+ </record>
1292+
1293+ <record id="REG206" model="hr.salary.rule">
1294+ <field name="category_id" ref="CAT_DEDUCCIONES"/>
1295+ <field name="name">ISPT (sp)</field>
1296+ <field name="sequence">206</field>
1297+ <field name="code">ISPT_SP</field>
1298+ <field name="condition_select">python</field>
1299+ <field name="condition_python">result = SEA> - ISPT </field>
1300+ <field name="amount_select">code</field>
1301+ <field name="amount_python_compute">result =SEA + ISPT_SE</field>
1302+ </record>
1303+
1304+ <record id="REG207" model="hr.salary.rule">
1305+ <field name="category_id" ref="CAT_DEDUCCIONES"/>
1306+ <field name="name">Prestamo Infonavit</field>
1307+ <field name="sequence">207</field>
1308+ <field name="code">CINFO_T</field>
1309+ <field name="condition_select">python</field>
1310+ <field name="condition_python"><![CDATA[monto = [c.amount for c in contract.concept_ids if c.code == 'CINFO']
1311+prestamo=monto and monto[0] or 0.0
1312+if prestamo>0:
1313+ result = 1]]></field>
1314+ <field name="amount_python_compute"><![CDATA[monto = [c.amount for c in contract.concept_ids if c.code == 'CINFO']
1315+retencion=monto and monto[0] or 0.0
1316+result = retencion]]></field>
1317+ </record>
1318+
1319+ <record id="REG250" model="hr.salary.rule">
1320+ <field name="category_id" ref="CAT_IMSS"/>
1321+ <field name="name">Prestaciones en especie</field>
1322+ <field name="sequence">250</field>
1323+ <field name="code">PE_T</field>
1324+ <field name="condition_select">python</field>
1325+ <field name="condition_python">result = SDI>3 * SGVDF </field>
1326+ <field name="amount_select">code</field>
1327+ <field name="amount_python_compute">result =((SDI * worked_days.WORK100.number_of_days * 7 /6)-(3 * SGVDF))*0.004</field>
1328+ </record>
1329+
1330+ <record id="REG251" model="hr.salary.rule">
1331+ <field name="category_id" ref="CAT_IMSS"/>
1332+ <field name="name">Prestaciones en especie (Pensionados y beneficiarios)</field>
1333+ <field name="sequence">251</field>
1334+ <field name="code">PEPB_T</field>
1335+ <field name="condition_select">none</field>
1336+ <field name="amount_select">code</field>
1337+ <field name="amount_python_compute">result = SDI * 0.00375 * worked_days.WORK100.number_of_days * 7 /6</field>
1338+ </record>
1339+
1340+ <record id="REG252" model="hr.salary.rule">
1341+ <field name="category_id" ref="CAT_IMSS"/>
1342+ <field name="name">Prestaciones en dinero</field>
1343+ <field name="sequence">252</field>
1344+ <field name="code">PD_T</field>
1345+ <field name="condition_select">none</field>
1346+ <field name="amount_select">code</field>
1347+ <field name="amount_python_compute">result = SDI * 0.0025 * worked_days.WORK100.number_of_days * 7 /6</field>
1348+ </record>
1349+
1350+ <record id="REG253" model="hr.salary.rule">
1351+ <field name="category_id" ref="CAT_IMSS"/>
1352+ <field name="name">Seguro de invalides y vida</field>
1353+ <field name="sequence">253</field>
1354+ <field name="code">SIV_T</field>
1355+ <field name="condition_select">none</field>
1356+ <field name="amount_select">code</field>
1357+ <field name="amount_python_compute">result = SDI * 0.00625 * worked_days.WORK100.number_of_days * 7 /6</field>
1358+ </record>
1359+
1360+ <record id="REG254" model="hr.salary.rule">
1361+ <field name="category_id" ref="CAT_IMSS"/>
1362+ <field name="name">Cesantia en edad avanzada y vejes</field>
1363+ <field name="sequence">254</field>
1364+ <field name="code">CEAV_T</field>
1365+ <field name="condition_select">none</field>
1366+ <field name="amount_select">code</field>
1367+ <field name="amount_python_compute">result = SDI * 0.01125 * worked_days.WORK100.number_of_days * 7 /6</field>
1368+ </record>
1369+
1370+ <record id="REG255" model="hr.salary.rule">
1371+ <field name="category_id" ref="CAT_DEDUCCIONES"/>
1372+ <field name="name">IMSS</field>
1373+ <field name="sequence">255</field>
1374+ <field name="code">IMSS_T</field>
1375+ <field name="condition_select">none</field>
1376+ <field name="amount_select">code</field>
1377+ <field name="amount_python_compute">result = categories.IMSS</field>
1378+ </record>
1379+
1380+ <record id="REG259" model="hr.salary.rule">
1381+ <field name="category_id" ref="CAT_CONCEPTOS"/>
1382+ <field name="name">DEDUCCIONES</field>
1383+ <field name="sequence">259</field>
1384+ <field name="code">DEDUCCIONES</field>
1385+ <field name="condition_select">none</field>
1386+ <field name="amount_select">code</field>
1387+ <field name="amount_python_compute">result = categories.DEDUCCIONES</field>
1388+ </record>
1389+
1390+ <!-- ###################################### -->
1391+ <!-- ###################################### -->
1392+ <!-- ###################################### -->
1393+
1394+ <record id="REG260" model="hr.salary.rule">
1395+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1396+ <field name="name">Prestaciones en especie(Cuota fija)</field>
1397+ <field name="sequence">260</field>
1398+ <field name="code">PE_E</field>
1399+ <field name="condition_select">none</field>
1400+ <field name="amount_select">code</field>
1401+ <field name="amount_python_compute">result = SDI * 0.204 * worked_days.WORK100.number_of_days * 7 /6</field>
1402+ </record>
1403+
1404+ <record id="REG261" model="hr.salary.rule">
1405+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1406+ <field name="name">Prestaciones en especie(Cuota adicional)</field>
1407+ <field name="sequence">261</field>
1408+ <field name="code">PE_E</field>
1409+ <field name="condition_select">python</field>
1410+ <field name="condition_python">result = SDI>3 * SGVDF </field>
1411+ <field name="amount_select">code</field>
1412+ <field name="amount_python_compute">result =((SDI * worked_days.WORK100.number_of_days * 7 /6)-(3 * SGVDF))*0.011</field>
1413+ </record>
1414+
1415+ <record id="REG262" model="hr.salary.rule">
1416+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1417+ <field name="name">Prestaciones en especie (Pensionados y beneficiarios)</field>
1418+ <field name="sequence">262</field>
1419+ <field name="code">PEPB_E</field>
1420+ <field name="condition_select">none</field>
1421+ <field name="amount_select">code</field>
1422+ <field name="amount_python_compute">result = SDI * 0.0105 * worked_days.WORK100.number_of_days * 7 /6</field>
1423+ </record>
1424+
1425+ <record id="REG263" model="hr.salary.rule">
1426+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1427+ <field name="name">Prestaciones en dinero</field>
1428+ <field name="sequence">263</field>
1429+ <field name="code">PD_E</field>
1430+ <field name="condition_select">none</field>
1431+ <field name="amount_select">code</field>
1432+ <field name="amount_python_compute">result = SDI * 0.007 * worked_days.WORK100.number_of_days * 7 /6</field>
1433+ </record>
1434+
1435+ <record id="REG264" model="hr.salary.rule">
1436+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1437+
1438+ <field name="name">Seguro de invalides y vida</field>
1439+ <field name="sequence">264</field>
1440+ <field name="code">SIV_E</field>
1441+ <field name="condition_select">none</field>
1442+ <field name="amount_select">code</field>
1443+ <field name="amount_python_compute">result = SDI * 0.0175 * worked_days.WORK100.number_of_days * 7 /6</field>
1444+ </record>
1445+
1446+ <record id="REG265" model="hr.salary.rule">
1447+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1448+ <field name="name">Seguro para el retiro</field>
1449+ <field name="sequence">265</field>
1450+ <field name="code">SR_E</field>
1451+ <field name="condition_select">none</field>
1452+ <field name="amount_select">code</field>
1453+ <field name="amount_python_compute">result = SDI * 0.02 * worked_days.WORK100.number_of_days * 7 /6</field>
1454+ </record>
1455+
1456+ <record id="REG266" model="hr.salary.rule">
1457+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1458+ <field name="name">Cesantia en edad avanzada y vejes</field>
1459+ <field name="sequence">266</field>
1460+ <field name="code">CEAV_E</field>
1461+ <field name="condition_select">none</field>
1462+ <field name="amount_select">code</field>
1463+ <field name="amount_python_compute">result = SDI * 0.0315 * worked_days.WORK100.number_of_days * 7 /6</field>
1464+ </record>
1465+
1466+ <record id="REG267" model="hr.salary.rule">
1467+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1468+ <field name="name">Guarderias y Prestaciones Sociales</field>
1469+ <field name="sequence">267</field>
1470+ <field name="code">GPS_E</field>
1471+ <field name="condition_select">none</field>
1472+ <field name="amount_select">code</field>
1473+ <field name="amount_python_compute">result = SDI * 0.01 * worked_days.WORK100.number_of_days * 7 /6</field>
1474+ </record>
1475+
1476+ <record id="REG268" model="hr.salary.rule">
1477+ <field name="category_id" ref="CAT_OBLIGACIONES"/>
1478+ <field name="name">Infonavit</field>
1479+ <field name="sequence">268</field>
1480+ <field name="code">I_E</field>
1481+ <field name="condition_select">none</field>
1482+ <field name="amount_select">code</field>
1483+ <field name="amount_python_compute">result = SDI * 0.05 * worked_days.WORK100.number_of_days * 7 /6</field>
1484+ </record>
1485+
1486+ <record id="REG269" model="hr.salary.rule">
1487+ <field name="category_id" ref="CAT_CONCEPTOS"/>
1488+ <field name="name">OBLIGACIONES</field>
1489+ <field name="sequence">269</field>
1490+ <field name="code">OBLIGACIONES</field>
1491+ <field name="condition_select">none</field>
1492+ <field name="amount_select">code</field>
1493+ <field name="amount_python_compute">result = categories.OBLIGACIONES</field>
1494+ </record>
1495+
1496+ <record id="REG300" model="hr.salary.rule">
1497+ <field name="category_id" ref="CAT_CONCEPTOS"/>
1498+ <field name="name">PAGO</field>
1499+ <field name="sequence">300</field>
1500+ <field name="code">PAGO</field>
1501+ <field name="condition_select">none</field>
1502+ <field name="amount_select">code</field>
1503+ <field name="amount_python_compute">result = categories.PEXENT + categories.PGRAVA - categories.DEDUCCIONES </field>
1504+ </record>
1505+
1506+ </data>
1507+</openerp>
1508
1509=== added file 'l10n_mx_hr_payroll/hr_payroll_view.xml'
1510--- l10n_mx_hr_payroll/hr_payroll_view.xml 1970-01-01 00:00:00 +0000
1511+++ l10n_mx_hr_payroll/hr_payroll_view.xml 2012-12-04 15:42:21 +0000
1512@@ -0,0 +1,156 @@
1513+<?xml version="1.0"?>
1514+<openerp>
1515+ <data>
1516+ <record id="view_hr_contract_concept_form" model="ir.ui.view">
1517+ <field name="name">hr.contract.concept.form</field>
1518+ <field name="model">hr.contract.concept</field>
1519+ <field name="type">form</field>
1520+ <field name="arch" type="xml">
1521+ <form string="Employee Function">
1522+ <field name="code"/>
1523+ <field name="name"/>
1524+ <field name="description"/>
1525+ <field name="concept_type"/>
1526+ <field name="amount"/>
1527+ <field name="amount_type"/>
1528+ <field name="history_ids"/>
1529+ </form>
1530+ </field>
1531+ </record>
1532+ <record id="view_hr_contract_concept_tree" model="ir.ui.view">
1533+ <field name="name">hr.contract.concept.tree</field>
1534+ <field name="model">hr.contract.concept</field>
1535+ <field name="type">tree</field>
1536+ <field name="arch" type="xml">
1537+ <tree string="Employee Function">
1538+ <field name="code"/>
1539+ <field name="name"/>
1540+ <field name="description"/>
1541+ <field name="amount"/>
1542+ <field name="history_ids"/>
1543+ </tree>
1544+ </field>
1545+ </record>
1546+ <record id="view_concept_history_tree" model="ir.ui.view">
1547+ <field name="name">hr.concept.history.tree</field>
1548+ <field name="model">hr.concept.history</field>
1549+ <field name="type">tree</field>
1550+ <field name="arch" type="xml">
1551+ <tree string="Employee Function">
1552+ <field name="date"/>
1553+ <field name="amount_initial"/>
1554+ <field name="amount_final"/>
1555+ <field name="amount"/>
1556+ </tree>
1557+ </field>
1558+ </record>
1559+ <record id="view_hr_contract_form" model="ir.ui.view">
1560+ <field name="name">hr.contract</field>
1561+ <field name="model">hr.contract</field>
1562+ <field name="type">form</field>
1563+ <field name="inherit_id" ref="hr_contract.hr_contract_view_form"/>
1564+ <field name="arch" type="xml">
1565+ <xpath expr="/form/notebook/page[@string='Work Permit']" position="after">
1566+ <page string="Concept">
1567+ <field name="concept_ids" nolabel="1" colspan="4"/>
1568+ </page>
1569+ </xpath>
1570+ </field>
1571+ </record>
1572+<!--
1573+ <record id="view_hr_holidays_status_form" model="ir.ui.view">
1574+ <field name="name">hr.holidays.status.form</field>
1575+ <field name="model">hr.holidays.status</field>
1576+ <field name="type">form</field>
1577+ <field name="inherit_id" ref="hr_holidays.edit_holiday_status_form"/>
1578+ <field name="arch" type="xml">
1579+ <xpath expr="/form/group/field[@name='name']" position="before">
1580+ <field name="code"/>
1581+ </xpath>
1582+ </field>
1583+ </record>
1584+-->
1585+ <record id="view_hr_payroll_payslip_employees_inherit_form" model="ir.ui.view">
1586+ <field name="name">hr_payroll.payslip.employees.inherit.form</field>
1587+ <field name="model">hr.payslip.employees</field>
1588+ <field name="type">form</field>
1589+ <field name="inherit_id" ref="hr_payroll.view_hr_payslip_by_employees"/>
1590+ <field name="arch" type="xml">
1591+ <xpath expr="/form/group/field[@name='employee_ids']" position="replace">
1592+ <field name="employee_ids" domain="" nolabel="1" colspan="4"/>
1593+ </xpath>
1594+ </field>
1595+ </record>
1596+ <!--
1597+ <record id="view_hr_employee_inherit_search" model="ir.ui.view">
1598+ <field name="name">hr.employee.inherit.search</field>
1599+ <field name="model">hr.employee</field>
1600+ <field name="type">search</field>
1601+ <field name="inherit_id" ref="hr.view_employee_filter"/>
1602+ <field name="arch" type="xml">
1603+ <xpath expr="/search/field[@name='name']" position="after">
1604+ <field name="name" colspan="4"/>
1605+ </xpath>
1606+ </field>
1607+ </record>
1608+ -->
1609+ <record id="view_hr_payslip_run_inherit_form" model="ir.ui.view">
1610+ <field name="name">hr.payslip.run.inherit.form</field>
1611+ <field name="model">hr.payslip.run</field>
1612+ <field name="type">form</field>
1613+ <field name="inherit_id" ref="hr_payroll.hr_payslip_run_form"/>
1614+ <field name="arch" type="xml">
1615+ <xpath expr="/form/group/field[@name='credit_note']" position="replace">
1616+ <field name="credit_note" invisible="1"/>
1617+ </xpath>
1618+ <xpath expr="/form/group/field[@name='date_start']" position="after">
1619+ <field name="type"/>
1620+ <field name="schedule_pay"/>
1621+ </xpath>
1622+ </field>
1623+ </record>
1624+
1625+ <record id="view_hr_payslip_form" model="ir.ui.view">
1626+ <field name="name">hr.payslip</field>
1627+ <field name="model">hr.payslip</field>
1628+ <field name="type">form</field>
1629+ <field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
1630+ <field name="arch" type="xml">
1631+ <xpath expr="/form/group/field[@name='employee_id']" position="replace">
1632+ <field name="employee_id"/>
1633+ </xpath>
1634+ <xpath expr="/form/notebook/page/field[@name='line_ids']" position="replace">
1635+
1636+ <field name="line_ids" colspan="4" nolabel="1">
1637+ <tree string="Salary Structure" editable="bottom" colors="grey:code in ('PEPB_T','PD_T','SIV_T','CEAV_T','PE_E','PEPB_E','PD_E','SIV_E','SR_E','CEAV_E','GPS_E','I_E' );green:code in ('PERCEPCIONES','DEDUCCIONES','OBLIGACIONES')">
1638+ <field name="name"/>
1639+ <field name="code"/>
1640+ <field name="category_id"/>
1641+ <field name="sequence" invisible="1"/>
1642+ <field name="quantity" invisible="1"/>
1643+ <field name="rate" invisible="1"/>
1644+ <field name="amount" invisible="1"/>
1645+ <field name="total"/>
1646+ </tree>
1647+ <form string="Payslip Line">
1648+ <group>
1649+ <field name="name" select="1"/>
1650+ <field name="code" select="1"/>
1651+ <field name="category_id"/>
1652+ <field name="sequence" groups="base.group_extended"/>
1653+ <field name="quantity"/>
1654+ <field name="rate"/>
1655+ <field name="amount"/>
1656+ <field name="total"/>
1657+ <field name="salary_rule_id" groups="base.group_extended"/>
1658+ </group>
1659+ </form>
1660+ </field>
1661+ </xpath>
1662+
1663+ </field>
1664+ </record>
1665+
1666+ </data>
1667+</openerp>
1668+