@@ -218,7 +204,7 @@
|
- Email
+ Email
|
[[ o.employee_id.work_email or '' ]]
@@ -233,26 +219,26 @@
|
-
+
|
- Reference
+ Reference
|
[[ o.number or '' ]]
|
- Bank Account
+ Bank Account
|
[[ o.employee_id.otherid or '' ]]
|
-
+
|
- Date From
+ Date From
|
[[ o.date_from or '']]
@@ -271,32 +257,28 @@
-
+
|
- Payslip Lines:
+ Code
+ |
+
+ Name
+ |
+
+ Quantity/Rate
+ |
+
+ Amount
+ |
+
+ Total
|
-
-
- |
- Code
- |
-
- Name
- |
-
- Amount (in [[o.company_id and o.company_id.currency_id.symbol or '']])
- |
-
-
-
-
-
[[repeatIn(get_payslip_lines(o.line_ids),'p') ]]
-
+
|
[[ p.code ]]
@@ -305,18 +287,21 @@
[[ p.name ]]
|
- [[ p.total or '0.0']]
+ [[ formatLang(p.quantity) ]]
+ |
+
+ [[ formatLang(p.amount) ]]
+ |
+
+ [[ formatLang(p.total) ]] [[o.company_id and o.company_id.currency_id.symbol or '']]
|
-
-
-
-
+
-
+
@@ -333,16 +318,16 @@
|
-
+
-
+
-
+
- Authorized Signature
+ Authorized Signature
|
diff --git a/addons/hr_payroll/report/report_payslip_details.py b/addons/hr_payroll/report/report_payslip_details.py
index be40a2ec02a..e8df94d3b5a 100644
--- a/addons/hr_payroll/report/report_payslip_details.py
+++ b/addons/hr_payroll/report/report_payslip_details.py
@@ -97,13 +97,19 @@ class payslip_details_report(report_sxw.rml_parse):
result.setdefault(obj[id].register_id.name, [])
result[obj[id].register_id.name].append(obj[id].id)
for key, value in result.iteritems():
+ register_total = 0
+ for line in payslip_line.browse(self.cr, self.uid, value):
+ register_total += line.total
res.append({
'register_name': key,
+ 'total': register_total,
})
for line in payslip_line.browse(self.cr, self.uid, value):
res.append({
'name': line.name,
'code': line.code,
+ 'quantity': line.quantity,
+ 'amount': line.amount,
'total': line.total,
})
return res
diff --git a/addons/hr_payroll/report/report_payslip_details.rml b/addons/hr_payroll/report/report_payslip_details.rml
index 43ad71a7c9e..c344389648d 100644
--- a/addons/hr_payroll/report/report_payslip_details.rml
+++ b/addons/hr_payroll/report/report_payslip_details.rml
@@ -100,56 +100,42 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
@@ -159,28 +145,31 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -196,7 +185,7 @@
-
+
@@ -206,11 +195,11 @@
- [[repeatIn(objects,'o')]]
+ [[repeatIn(objects,'o')]]
|
- Pay Slip Details
+ Pay Slip Details
|
@@ -220,24 +209,24 @@
Note
- ([[o.name or removeParentNode('para') ]])
+ ([[o.name or removeParentNode('para')]])
|
- Name
+ Name
|
- [[o.employee_id.name]]
+ [[o.employee_id.name]]
|
- Designation
+ Designation
|
- [[ o.employee_id.job_id.name or '' ]]
+ [[ o.employee_id.job_id.name or '' ]]
|
-
+
|
@@ -245,17 +234,17 @@
|
- [[o.employee_id.address_home_id and o.employee_id.address_home_id.name or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.street or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.street2 or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.zip or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.city or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.state_id and o.employee_id.address_home_id.state_id.name or '' ]] [[o.employee_id.address_home_id and o.employee_id.address_home_id.country_id and o.employee_id.address_home_id.country_id.name or '' ]]
+ [[o.employee_id.address_home_id and o.employee_id.address_home_id.name or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.street or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.street2 or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.zip or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.city or '' ]],[[o.employee_id.address_home_id and o.employee_id.address_home_id.state_id and o.employee_id.address_home_id.state_id.name or '' ]] [[o.employee_id.address_home_id and o.employee_id.address_home_id.country_id and o.employee_id.address_home_id.country_id.name or '' ]]
|
|
- Email
+ Email
|
- [[ o.employee_id.work_email or '' ]]
+ [[ o.employee_id.work_email or '' ]]
|
@@ -263,33 +252,33 @@
|
- [[ o.employee_id.identification_id or '' ]]
+ [[ o.employee_id.identification_id or '' ]]
|
-
+
|
- Reference
+ Reference
|
- [[ o.number or '' ]]
+ [[ o.number or '' ]]
|
- Bank Account
+ Bank Account
|
- [[ o.employee_id.otherid or '' ]]
+ [[ o.employee_id.otherid or '' ]]
|
-
+
|
- Date From
+ Date From
|
- [[ o.date_from or '']]
+ [[ o.date_from or '']]
|
@@ -297,37 +286,34 @@
|
- [[ o.date_to or '' ]]
+ [[ o.date_to or '' ]]
|
-
-
+
+
-
+
|
- Details by Salary Rule Category:
+ Details by Salary Rule Category:
|
-
+
|
- Code
+ Code
|
- Salary Rule Category
+ Salary Rule Category
|
- Name
- |
-
- Amount(in [[o.company_id and o.company_id.currency_id.symbol or '']])
+ Total
|
@@ -335,69 +321,77 @@
- [[repeatIn(get_details_by_rule_category(o.details_by_salary_rule_category),'h') ]]
-
+ [[repeatIn(get_details_by_rule_category(o.details_by_salary_rule_category),'h') ]]
+
|
-
+
[[ h['code'] ]]
[[ h['level']!=0 and ( setTag('para','para',{'style':'terp_default_8'})) or removeParentNode('font')]]
|
- [[ '..'*h['level'] ]][[ h['rule_category'] ]][[ h['level']!=0 and ( setTag('para','para',{'style':'terp_default_8'})) or removeParentNode('font') ]]
+ [[ '..'*h['level'] ]][[ h['rule_category'] ]][[ h['level']!=0 and ( setTag('para','para',{'style':'terp_default_8'})) or removeParentNode('font') ]]
|
- [[ h['name'] ]][[ h['level']!=0 and ( setTag('para','para',{'style':'terp_default_8'})) or removeParentNode('font')]]
- |
-
- [[ h['total'] ]] [[ h['level']!=0 and ( setTag('para','para',{'style':'terp_default_10'})) or removeParentNode('font') ]]
+ [[ formatLang(h['total']) ]] [[o.company_id and o.company_id.currency_id.symbol or '']] [[ h['level']==0 and ( setTag('para','para',{'style':'terp_default_10'})) or removeParentNode('font') ]]
|
-
+
-
-
+
|
- Payslip Lines by Contribution Register:
+ Payslip Lines by Contribution Register:
|
-
+
|
- Register Name
+ Register Name
|
- Code
+ Code
|
- Name
+ Name
|
- Amount (in [[o.company_id and o.company_id.currency_id.symbol or '']])
+ Quantity/Rate
+ |
+
+ Amount
+ |
+
+ Total
|
- [[repeatIn(get_lines_by_contribution_register(o.details_by_salary_rule_category),'r')]]
-
+ [[repeatIn(get_lines_by_contribution_register(o.details_by_salary_rule_category),'r') ]]
+
|
- [[ r.get('register_name', False) ]][[ h.get('register_name', False) and ( setTag('para','para',{'style':'terp_default_8'})) or removeParentNode('font')]]
+ [[ r.get('register_name', False) ]][[ h.get('register_name', False) and ( setTag('para','para',{'style':'terp_default_8'})) or removeParentNode('font')]]
|
- [[ r['code'] ]]
+ [[ r['code'] ]]
|
- [[ r['name'] ]]
+ [[ r['name'] ]]
|
- [[ r['total'] or '0.0']]
+ [[ formatLang(r['quantity']) ]]
+ |
+
+ [[ formatLang(r['amount']) ]]
+ |
+
+ [[ formatLang(r['total']) ]] [[ o.company_id and o.company_id.currency_id.symbol or '']][[ r.get('register_name', False) and ( setTag('para','para',{'style':'terp_default_10'})) or removeParentNode('font')]]
|
@@ -405,25 +399,25 @@
|
-
+
|
-
+
-
+
-
+
- Authorized Signature
+ Authorized Signature
|
-
+
diff --git a/addons/hr_payroll/report/report_year_report.rml b/addons/hr_payroll/report/report_year_report.rml
deleted file mode 100644
index 564e87d04ab..00000000000
--- a/addons/hr_payroll/report/report_year_report.rml
+++ /dev/null
@@ -1,367 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- Name
- |
-
- [[ m[0] != 'None' and m[0] or '' ]]
- |
-
- [[ m[1] != 'None' and m[1] or '' ]]
- |
-
- [[ m[2] != 'None' and m[2] or '' ]]
- |
-
- [[ m[3] != 'None' and m[3] or '' ]]
- |
-
- [[ m[4] != 'None' and m[4] or '' ]]
- |
-
- [[ m[5] != 'None' and m[5] or '' ]]
- |
-
- [[ m[6] != 'None' and m[6] or '' ]]
- |
-
- [[ m[7] != 'None' and m[7] or '' ]]
- |
-
- [[ m[8] != 'None' and m[8] or '' ]]
- |
-
- [[ m[9] != 'None' and m[9] or '' ]]
- |
-
- [[ m[10] != 'None' and m[10] or '' ]]
- |
-
- [[ m[11] != 'None' and m[11] or '' ]]
- |
-
- Total
- |
-
-
-
- Yearly Salary Details
- From [[ formatLang(data['form']['date_from'], date=True) ]] To [[ formatLang(data['form']['date_to'], date=True) ]]
-
-
-
-
- [[ repeatIn(get_periods(data['form']),'m') ]]
-
-
- |
- Name
- |
-
- [[ m[0] != 'None' and m[0] or '' ]]
- |
-
- [[ m[1] != 'None' and m[1] or '' ]]
- |
-
- [[ m[2] != 'None' and m[2] or '' ]]
- |
-
- [[ m[3] != 'None' and m[3] or '' ]]
- |
-
- [[ m[4] != 'None' and m[4] or '' ]]
- |
-
- [[ m[5] != 'None' and m[5] or '' ]]
- |
-
- [[ m[6] != 'None' and m[6] or '' ]]
- |
-
- [[ m[7] != 'None' and m[7] or '' ]]
- |
-
- [[ m[8] != 'None' and m[8] or '' ]]
- |
-
- [[ m[9] != 'None' and m[9] or '' ]]
- |
-
- [[ m[10] != 'None' and m[10] or '' ]]
- |
-
- [[ m[11] != 'None' and m[11] or '' ]]
- |
-
- Total
- |
-
-
-
- [[ repeatIn(get_employee(data['form']),'e') ]]
-
-
- |
- [[ e[0] ]]
- |
-
-
- [[ (e[1]!='' and formatLang(e[1], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[2]!='' and formatLang(e[2], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[3]!='' and formatLang(e[3], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[4]!='' and formatLang(e[4], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[5]!='' and formatLang(e[5], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[6]!='' and formatLang(e[6], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[7]!='' and formatLang(e[7], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[8]!='' and formatLang(e[8], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[9]!='' and formatLang(e[9], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[10]!='' and formatLang(e[10], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[11]!='' and formatLang(e[11], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
-
- [[ (e[12]!='' and formatLang(e[12], dp='Account')) or removeParentNode('font') ]] [[company.currency_id.symbol]]
-
- |
-
- [[ formatLang(e[13], dp='Account') ]] [[company.currency_id.symbol]]
- |
-
-
-
-
-
- [[ repeatIn(get_months_tol(),'t') ]]
-
-
- |
- Total
- |
-
- [[ formatLang(t[1], dp='Account') or removeParentNode('para') ]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[2], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[3], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[4], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[5], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[6], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[7], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[8], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[9], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[10], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[11], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(t[12], dp='Account') or removeParentNode('para')]] [[company.currency_id.symbol]]
- |
-
- [[ formatLang(get_total(), dp='Account') ]] [[company.currency_id.symbol]]
- |
-
-
-
-
-
-
diff --git a/addons/hr_payroll/report/report_year_salary.py b/addons/hr_payroll/report/report_year_salary.py
deleted file mode 100644
index bc7ac8fc93a..00000000000
--- a/addons/hr_payroll/report/report_year_salary.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# d$
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import datetime
-from report import report_sxw
-import time
-import pooler
-
-class year_salary_report(report_sxw.rml_parse):
-
- def __init__(self, cr, uid, name, context):
- super(year_salary_report, self).__init__(cr, uid, name, context)
- self.localcontext.update({
- 'time': time,
- 'get_employee': self.get_employee,
- 'get_periods': self.get_periods,
- 'get_months_tol': self.get_months_tol,
- 'get_total': self.get_total,
- })
-
- self.mnths =[]
- self.mnths_tol = []
- self.total=0.0
-
- def get_periods(self,form):
-# Get start year-month-date and end year-month-date
- fy = int(form['date_from'][0:4])
- ly = int(form['date_to'][0:4])
-
- fm = int(form['date_from'][5:7])
- lm = int(form['date_to'][5:7])
- no_months = (ly-fy)*12+lm-fm + 1
- cm = fm
- cy = fy
-
-# Get name of the months from integer
- mnth_name = []
- for count in range(0,no_months):
- 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
- cm = cm +1
- for c in range(0,(12-no_months)):
- mnth_name.append('None')
- self.mnths.append('None')
- return [mnth_name]
-
- def get_employee(self,form):
- ls1=[]
- ls = []
- tol_mnths=['Total',0,0,0,0,0,0,0,0,0,0,0,0]
- emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
- emp_ids = form['employee_ids']
- empll = emp.browse(self.cr,self.uid, emp_ids)
- cnt = 1
- for emp_id in empll:
- ls1.append(emp_id.name)
- tol = 0.0
- for mnth in self.mnths:
- if mnth <> 'None':
- if len(mnth) != 7:
- mnth = '0' + str(mnth)
- query = "select net from hr_payslip where employee_id = "+str(emp_id.id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' "
- self.cr.execute(query)
- sal = self.cr.fetchall()
- if sal:
- ls1.append(sal[0][0])
- tol += sal[0][0]
- tol_mnths[cnt] = tol_mnths[cnt] + sal[0][0]
- else:
- ls1.append(0.00)
- tol_mnths[cnt] = 0.0
- else:
- ls1.append('')
- tol_mnths[cnt] = ''
- cnt = cnt + 1
- cnt = 1
- ls1.append(tol)
- ls.append(ls1)
- ls1 = []
- self.mnths_tol.append(tol_mnths)
- return ls
-
- def get_months_tol(self):
- return self.mnths_tol
-
- def get_total(self):
- for item in self.mnths_tol:
- for count in range(1,len(item)):
- if item[count] == '':
- continue
- self.total += item[count]
- return self.total
-
-report_sxw.report_sxw('report.year.salary', 'hr.payslip', 'hr_payroll/report/report_year_report.rml', parser=year_salary_report,header='internal landscape')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_payroll/test/hr_payroll_report.yml b/addons/hr_payroll/test/hr_payroll_report.yml
index 90866d84cfa..5b86bacf693 100644
--- a/addons/hr_payroll/test/hr_payroll_report.yml
+++ b/addons/hr_payroll/test/hr_payroll_report.yml
@@ -1,12 +1,5 @@
-
In order to test the PDF reports defined on HR Payroll, we will print Employees' Salary Structure
--
- !python {model: hr.employee}: |
- import netsvc, tools, os
- (data, format) = netsvc.LocalService('report.salary.structure').create(cr, uid, [ref('hr_payroll.hr_employee_bonamy0')], {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-salary_structure.'+format), 'wb+').write(data)
-
-
Print HR Payslip
-
@@ -14,28 +7,4 @@
import netsvc, tools, os
(data, format) = netsvc.LocalService('report.payslip.pdf').create(cr, uid, [ref('hr_payroll.hr_payslip_salaryslipofbonamyforjune0')], {}, {})
if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payslip_report.'+format), 'wb+').write(data)
-
--
- Print Employee Salary Statement through wizard
--
- !python {model: hr.payslip}: |
- import time
- ctx={}
- ctx.update({'model': 'hr.employee','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]})
- data_dict = {'employee_ids': [(6,0,[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')])], 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d')}
- from tools import test_reports
- test_reports.try_report_action(cr, uid, 'action_hr_payroll_employees_detail',wiz_data=data_dict, context=ctx, our_module='hr_payroll')
-
--
- Print Salary Register through wizard
--
- !python {model: hr.payslip}: |
- import time
- ctx={}
- ctx.update({'model': 'hr.payslip','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]})
- data_dict = {'employee_ids': [(6,0,[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')])], 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d')}
- from tools import test_reports
- test_reports.try_report_action(cr, uid, 'action_hr_payroll_year_salary',wiz_data=data_dict, context=ctx, our_module='hr_payroll')
-
-
+ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payslip_report.'+format), 'wb+').write(data)
\ No newline at end of file
diff --git a/addons/hr_payroll/test/payment_advice.yml b/addons/hr_payroll/test/payment_advice.yml
deleted file mode 100644
index ef600670a48..00000000000
--- a/addons/hr_payroll/test/payment_advice.yml
+++ /dev/null
@@ -1,59 +0,0 @@
--
- I test the 'Payment Advice' in order to check the hr_payroll in OpenERP
--
- I create a new employee “Richie”
--
- !record {model: hr.employee, id: hr_employee_richie0}:
- address_home_id: base.res_partner_address_1
- address_id: base.res_partner_address_9
- birthday: '1984-05-01'
- children: 0.0
- contract_ids:
- - advantages_gross: 0.0
- advantages_net: 0.0
- date_end: !eval "'%s-%s-%s' %(datetime.now().year+1,datetime.now().month,datetime.now().day)"
- date_start: !eval time.strftime('%Y-%m-%d')
- name: reference
- wage: 5000.0
- wage_type_id: hr_contract.hr_contract_monthly_gross
- type_id: hr_contract.hr_contract_type_emp
- country_id: base.in
- department_id: hr.dep_it
- gender: male
- marital: hr.hr_employee_marital_status_single
- name: Richie
- vehicle_distance: 0.0
--
- I create a new payment advice record
--
- !record {model: hr.payroll.advice, id: hr_payroll_advice_advice0}:
- line_ids:
- - amount: 5500.0
- bysal: 5000.0
- employee_id: 'hr_employee_richie0'
- flag: C
- name: Axis Bank
- name: advice1
--
- I confirmed the sheet by click on "Confirm Sheet" button.
--
- !python {model: hr.payroll.advice}: |
- self.confirm_sheet(cr, uid, [ref("hr_payroll_advice_advice0")], {"lang": "en_US",
- "active_model": "ir.ui.menu", "active_ids": [ref("hr_payroll.hr_menu_payment_advice")],
- "tz": False, "active_id": ref("hr_payroll.hr_menu_payment_advice")})
--
- I check that a state is "Confirm"
--
- !python {model: hr.payroll.advice}: |
- from tools.translate import _
- advice_id=self.browse(cr, uid, ref("hr_payroll_advice_advice0"))
- assert(advice_id.state == 'confirm'), _('State not changed!')
-
--
- Print Payroll Advice
--
- !python {model: hr.payroll.advice}: |
- import netsvc, tools, os
- (data, format) = netsvc.LocalService('report.payroll.advice').create(cr, uid, [ref('hr_payroll_advice_advice0')], {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payroll-advice.'+format), 'wb+').write(data)
diff --git a/addons/hr_payroll/test/payroll_register.yml b/addons/hr_payroll/test/payroll_register.yml
deleted file mode 100644
index 41231e361db..00000000000
--- a/addons/hr_payroll/test/payroll_register.yml
+++ /dev/null
@@ -1,64 +0,0 @@
--
- I test the 'Payroll Register' in order to check the hr_payroll in OpenERP
- I create a new employee “Keith”
--
- !record {model: hr.employee, id: hr_employee_keith0}:
- address_home_id: base.res_partner_address_3
- address_id: base.res_partner_address_9
- birthday: '1984-05-01'
- children: 0.0
- contract_ids:
- - advantages_gross: 0.0
- advantages_net: 0.0
- date_end: !eval "'%s-%s-%s' %(datetime.now().year+1,datetime.now().month,datetime.now().day)"
- date_start: !eval time.strftime('%Y-%m-%d')
- name: reference
- wage: 5000.0
- wage_type_id: hr_contract.hr_contract_monthly_gross
- type_id: hr_contract.hr_contract_type_emp
- country_id: base.in
- department_id: hr.dep_it
- gender: male
- marital: hr.hr_employee_marital_status_single
- name: Keith
- vehicle_distance: 0.0
--
- I create a payroll register record.
--
- !record {model: hr.payroll.register, id: hr_payroll_register_payroll0}:
- date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d')"
- line_ids:
- - employee_id: hr_payroll.hr_employee_keith0
- name: payroll1
--
- I click on Compute button.
--
- !python {model: hr.payroll.register}: |
- self.compute_sheet(cr, uid, [ref("hr_payroll_register_payroll0")], {"lang": "en_US",
- "tz": False, "active_model": "ir.ui.menu", "department_id": False, "active_ids":
- [ref("hr_payroll.hr_menu_payroll_register")], "section_id": False, "active_id":
- ref("hr_payroll.hr_menu_payroll_register"), })
--
- Then I click on Verify Sheet button.
--
- !python {model: hr.payroll.register}: |
- self.verify_sheet(cr, uid, [ref("hr_payroll_register_payroll0")], {"lang": "en_US",
- "tz": False, "active_model": "ir.ui.menu", "department_id": False, "active_ids":
- [ref("hr_payroll.hr_menu_payroll_register")], "section_id": False, "active_id":
- ref("hr_payroll.hr_menu_payroll_register"), })
--
- I check that a state has transferred from 'Wating for Verification' to 'Wating for HR Verification'state
--
- !python {model: hr.payroll.register}: |
- from tools.translate import _
- reg_brw=self.browse(cr, uid, ref("hr_payroll_register_payroll0"))
- assert(reg_brw.state == 'hr_check'), _('State not changed!')
-
--
- Print HR Payroll Register
--
- !python {model: hr.payroll.register}: |
- import netsvc, tools, os
- (data, format) = netsvc.LocalService('report.hr.payroll.register.sheet').create(cr, uid, [ref('hr_payroll_register_payroll0')], {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-register_report.'+format), 'wb+').write(data)
diff --git a/addons/hr_payroll/wizard/__init__.py b/addons/hr_payroll/wizard/__init__.py
index 73a1b7ceb9e..62a0c2a5c5d 100644
--- a/addons/hr_payroll/wizard/__init__.py
+++ b/addons/hr_payroll/wizard/__init__.py
@@ -20,10 +20,7 @@
#
##############################################################################
-
-import hr_payroll_employees_detail
-#import hr_payroll_create_analytic
-import hr_payroll_year_salary
import hr_payroll_payslips_by_employees
+import hr_payroll_contribution_register_report
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_payroll/wizard/hr_payroll_contribution_register_report.py b/addons/hr_payroll/wizard/hr_payroll_contribution_register_report.py
new file mode 100644
index 00000000000..14860cdc753
--- /dev/null
+++ b/addons/hr_payroll/wizard/hr_payroll_contribution_register_report.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import time
+from datetime import datetime
+from dateutil import relativedelta
+
+from osv import osv, fields
+
+class payslip_lines_contribution_register(osv.osv_memory):
+ _name = 'payslip.lines.contribution.register'
+ _description = 'PaySlip Lines by Contribution Registers'
+ _columns = {
+ 'date_from': fields.date('Date From', required=True),
+ 'date_to': fields.date('Date To', required=True),
+ }
+
+ _defaults = {
+ 'date_from': lambda *a: time.strftime('%Y-%m-01'),
+ 'date_to': lambda *a: str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10],
+ }
+
+ def print_report(self, cr, uid, ids, context=None):
+ datas = {
+ 'ids': context.get('active_ids', []),
+ 'model': 'hr.contribution.register',
+ 'form': self.read(cr, uid, ids, [], context=context)[0]
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'contribution.register.lines',
+ 'datas': datas,
+ }
+
+payslip_lines_contribution_register()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_payroll/wizard/hr_payroll_contribution_register_report.xml b/addons/hr_payroll/wizard/hr_payroll_contribution_register_report.xml
new file mode 100644
index 00000000000..cb787cf536e
--- /dev/null
+++ b/addons/hr_payroll/wizard/hr_payroll_contribution_register_report.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ payslip.lines.contribution.register
+ payslip.lines.contribution.register
+ form
+
+
+
+
+
+
+ PaySlip Lines
+ ir.actions.act_window
+ payslip.lines.contribution.register
+ form
+ form
+ new
+
+
+
+
+
+ PaySlip Lines
+ client_print_multi
+
+ action
+ hr.contribution.register
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_payroll/wizard/hr_payroll_employees_detail.py b/addons/hr_payroll/wizard/hr_payroll_employees_detail.py
deleted file mode 100644
index 2cb14a53f82..00000000000
--- a/addons/hr_payroll/wizard/hr_payroll_employees_detail.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import time
-
-from osv import fields, osv
-
-class hr_payroll_employees_detail(osv.osv_memory):
-
- _name ='hr.payroll.employees.detail'
- _columns = {
- 'employee_ids': fields.many2many('hr.employee', 'payroll_emp_rel','payroll_id','emp_id', 'Employees',required=True),
- 'date_from': fields.date('Start Date', required=True),
- 'date_to': fields.date('End Date', required=True),
- #'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True)
- }
-# def _get_fiscalyear(self, cr, uid, ids, context=None):
-# if context is None:
-# context = {}
-# fiscal_ids = self.pool.get('account.fiscalyear').search(cr,uid,[], context=context)
-# if fiscal_ids:
-# return fiscal_ids[0]
-# return False
-
- _defaults = {
-# 'fiscalyear_id':_get_fiscalyear,
- 'date_from': lambda *a: time.strftime('%Y-01-01'),
- 'date_to': lambda *a: time.strftime('%Y-%m-%d'),
-
- }
-
- def print_report(self, cr, uid, ids, context=None):
- """
- To get the date and print the report
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param context: A standard dictionary
- @return: return report
- """
- if context is None:
- context = {}
- datas = {'ids': context.get('active_ids', [])}
- res = self.read(cr, uid, ids, ['employee_ids', 'date_from', 'date_to'], context=context)
- res = res and res[0] or {}
- datas['form'] = res
- datas['ids'] = res.get('employee_ids',[])
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'employees.salary',
- 'datas': datas,
- }
-
-hr_payroll_employees_detail()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_payroll/wizard/hr_payroll_employees_detail.xml b/addons/hr_payroll/wizard/hr_payroll_employees_detail.xml
deleted file mode 100644
index e65278e1b94..00000000000
--- a/addons/hr_payroll/wizard/hr_payroll_employees_detail.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
- Employee Salary Statement
- hr.payroll.employees.detail
- form
-
-
-
-
-
- Employee Salary Statement
- ir.actions.act_window
- hr.payroll.employees.detail
- form
- form
- new
-
-
-
-
-
diff --git a/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py b/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py
index ebb9bed26c1..5d806d3809b 100644
--- a/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py
+++ b/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py
@@ -33,18 +33,25 @@ class hr_payslip_employees(osv.osv_memory):
_columns = {
'employee_ids': fields.many2many('hr.employee', 'hr_employee_group_rel', 'payslip_id', 'employee_id', 'Employees'),
}
-
+
def compute_sheet(self, cr, uid, ids, context=None):
emp_pool = self.pool.get('hr.employee')
slip_pool = self.pool.get('hr.payslip')
+ run_pool = self.pool.get('hr.payslip.run')
slip_ids = []
if context is None:
context = {}
data = self.read(cr, uid, ids, context=context)[0]
+ run_data = {}
+ if context and context.get('active_id', False):
+ run_data = run_pool.read(cr, uid, context['active_id'], ['date_start', 'date_end', 'credit_note'])
+ from_date = run_data.get('date_start', False)
+ to_date = run_data.get('date_end', False)
+ credit_note = run_data.get('credit_note', False)
if not data['employee_ids']:
raise osv.except_osv(_("Warning !"), _("You must select employee(s) to generate payslip(s)"))
for emp in emp_pool.browse(cr, uid, data['employee_ids'], context=context):
- slip_data = slip_pool.onchange_employee_id(cr, uid, [], time.strftime('%Y-%m-01'), str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10], emp.id, contract_id=False, context=context)
+ slip_data = slip_pool.onchange_employee_id(cr, uid, [], from_date, to_date, emp.id, contract_id=False, context=context)
res = {
'employee_id': emp.id,
'name': slip_data['value'].get('name', False),
@@ -52,7 +59,10 @@ class hr_payslip_employees(osv.osv_memory):
'contract_id': slip_data['value'].get('contract_id', False),
'payslip_run_id': context.get('active_id', False),
'input_line_ids': [(0, 0, x) for x in slip_data['value'].get('input_line_ids', False)],
- 'worked_days_line_ids': [(0, 0, x) for x in slip_data['value'].get('worked_days_line_ids', False)]
+ 'worked_days_line_ids': [(0, 0, x) for x in slip_data['value'].get('worked_days_line_ids', False)],
+ 'date_from': from_date,
+ 'date_to': to_date,
+ 'credit_note': credit_note,
}
slip_ids.append(slip_pool.create(cr, uid, res, context=context))
slip_pool.compute_sheet(cr, uid, slip_ids, context=context)
@@ -60,4 +70,4 @@ class hr_payslip_employees(osv.osv_memory):
hr_payslip_employees()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.xml b/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.xml
index c8bd142dbf9..60b25bbd95a 100644
--- a/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.xml
+++ b/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.xml
@@ -8,9 +8,9 @@
form
|