[REF] hr_payroll

bzr revid: psi@tinyerp.co.in-20101015114359-mcqv5oywfkxeqya0
This commit is contained in:
psi (Open ERP)
2010-10-15 17:13:59 +05:30
parent 5d631c99de
commit 06beea3369
5 changed files with 151 additions and 77 deletions
@@ -1,3 +1,27 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import locale
import datetime
@@ -48,7 +72,7 @@ class employees_salary_report(rml_parse.rml_parse):
m = datetime.date(cy, cm, 1).strftime('%b')
mnth_name.append(m)
self.mnths.append(str(cm)+'-'+str(cy))
if cm == 12:
cm = 0
cy = ly
@@ -1,3 +1,27 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from datetime import datetime
from report import report_sxw
@@ -5,7 +29,7 @@ from report import report_sxw
class report_payroll_register(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_payroll_register, self).__init__(cr, uid, name, context)
self.total_amount = 0.00
self.total_bysal = 0.00
self.localcontext.update({
@@ -27,7 +51,7 @@ class report_payroll_register(report_sxw.rml_parse):
self.grows = 0.0
self.deduct = 0.0
self.net = 0.0
def add_line(self, line):
self.basic += line.basic
self.other += line.other_pay
@@ -35,37 +59,37 @@ class report_payroll_register(report_sxw.rml_parse):
self.grows += line.grows
self.deduct += line.deduction
self.net += line.net
def get_basic(self,obj):
for line in obj.line_ids:
self.basic += line.basic
return self.basic
def get_other(self,obj):
for line in obj.line_ids:
self.other += line.other_pay
return self.other
def get_allow(self,obj):
for line in obj.line_ids:
self.allow += line.allounce
return self.allow
def get_grows(self,obj):
for line in obj.line_ids:
self.grows += line.grows
return self.grows
def get_deduct(self,obj):
for line in obj.line_ids:
self.deduct += line.deduction
return self.deduct
def get_net(self,obj):
for line in obj.line_ids:
self.net += line.net
return self.net
def get_month(self, indate):
new_date = datetime.strptime(indate, '%Y-%m-%d')
out_date = new_date.strftime('%B')+'-'+new_date.strftime('%Y')
@@ -74,12 +98,12 @@ class report_payroll_register(report_sxw.rml_parse):
def get_no(self):
self.no += 1
return self.no
report_sxw.report_sxw(
'report.hr.payroll.register.sheet',
'hr.payroll.register',
'hr_payroll/report/payroll_register.rml',
'report.hr.payroll.register.sheet',
'hr.payroll.register',
'hr_payroll/report/payroll_register.rml',
parser=report_payroll_register
)
)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+61 -61
View File
@@ -23,78 +23,78 @@
##############################################################################
from datetime import datetime
from report import report_sxw
from tools import amount_to_text_en
class payslip_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(payslip_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
'convert' : self.convert,
'get_month' : self.get_month,
'get_earnings': self.get_earnings,
'get_deductions':self.get_deductions,
'get_leave':self.get_leave,
'get_others':self.get_others,
})
def __init__(self, cr, uid, name, context):
super(payslip_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
'convert': self.convert,
'get_month': self.get_month,
'get_earnings': self.get_earnings,
'get_deductions':self.get_deductions,
'get_leave':self.get_leave,
'get_others':self.get_others,
})
def convert(self, amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
return amt_en
def convert(self,amount, cur):
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur)
return amt_en
def get_others(self, obj):
payslip_line = self.pool.get('hr.payslip.line')
res = []
ids = []
for id in range(len(obj)):
if obj[id].category_id.type in ('advance', 'loan', 'otherpay', 'otherdeduct', 'installment'):
ids.append(obj[id].id)
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_others(self,obj):
res = []
ids = []
for id in range(len(obj)):
if obj[id].category_id.type in ('advance','loan','otherpay','otherdeduct','installment'):
ids.append(obj[id].id)
payslip_line = self.pool.get('hr.payslip.line')
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_leave(self, obj):
payslip_line = self.pool.get('hr.payslip.line')
res = []
ids = []
for id in range(len(obj)):
if obj[id].type == 'leaves':
ids.append(obj[id].id)
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_leave(self,obj):
res = []
ids = []
for id in range(len(obj)):
if obj[id].type == 'leaves':
ids.append(obj[id].id)
payslip_line = self.pool.get('hr.payslip.line')
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_earnings(self, obj):
payslip_line = self.pool.get('hr.payslip.line')
res = []
ids = []
for id in range(len(obj)):
if obj[id].category_id.type == 'allowance' and obj[id].type != 'leaves':
ids.append(obj[id].id)
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_earnings(self,obj):
res = []
ids = []
for id in range(len(obj)):
if obj[id].category_id.type == 'allowance' and obj[id].type != 'leaves':
ids.append(obj[id].id)
payslip_line = self.pool.get('hr.payslip.line')
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_deductions(self, obj):
payslip_line = self.pool.get('hr.payslip.line')
res = []
ids = []
for id in range(len(obj)):
if obj[id].category_id.type == 'deduction' and obj[id].type != 'leaves':
ids.append(obj[id].id)
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_deductions(self,obj):
res = []
ids = []
for id in range(len(obj)):
if obj[id].category_id.type == 'deduction' and obj[id].type != 'leaves':
ids.append(obj[id].id)
payslip_line = self.pool.get('hr.payslip.line')
if len(ids):
res = payslip_line.browse(self.cr, self.uid, ids)
return res
def get_month(self,obj):
res = {
'mname':''
}
date = datetime.strptime(obj.date, '%Y-%m-%d')
res['mname']= date.strftime('%B')+"-"+date.strftime('%Y')
return res['mname']
def get_month(self, obj):
res = {
'mname':''
}
date = datetime.strptime(obj.date, '%Y-%m-%d')
res['mname']= date.strftime('%B')+"-"+date.strftime('%Y')
return res['mname']
report_sxw.report_sxw('report.payslip.pdf', 'hr.payslip', 'hr_payroll/report/payslip.rml', parser=payslip_report)
@@ -1,3 +1,27 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import datetime
from report import report_sxw
import time
+3 -1
View File
@@ -19,10 +19,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from time import strptime
from report import report_sxw
import re
from lxml import etree
from time import strptime
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):