[MERGE] Merge team3 branch=>

[ADD] hr_payroll: added yaml, get back payroll module changes reverted by merging from addons
[REF] stock

bzr revid: mra@mra-laptop-20100706092836-vmc7dk3yco0l53xf
This commit is contained in:
Mustufa Rangwala
2010-07-06 14:58:36 +05:30
7 changed files with 279 additions and 25 deletions
+6
View File
@@ -54,6 +54,12 @@
'wizard/hr_payroll_employees_detail.xml',
'wizard/hr_payroll_year_salary.xml',
],
'test': [
'test/payslip.yml',
'test/payment_advice.yml',
'test/payroll_register.yml',
],
'demo_xml': [
'hr_payroll_demo.xml'
+22 -22
View File
@@ -194,10 +194,10 @@ class payroll_register(osv.osv):
# 'advice_ids':fields.one2many('hr.payroll.advice', 'register_id', 'Bank Advice'),
'company_id':fields.many2one('res.company', 'Company', required=False),
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, 4))),
'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, 4)),
'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits=(16, 4)),
'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits=(16, 4)),
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, int(config['price_accuracy']))),
'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, int(config['price_accuracy']))),
'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits=(16, int(config['price_accuracy']))),
'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits=(16, int(config['price_accuracy']))),
'note': fields.text('Description'),
}
@@ -366,8 +366,8 @@ class payroll_advice_line(osv.osv):
'advice_id':fields.many2one('hr.payroll.advice', 'Bank Advice', required=False),
'name':fields.char('Bank Account A/C', size=64, required=True, readonly=False),
'employee_id':fields.many2one('hr.employee', 'Employee', required=True),
'amount': fields.float('Amount', digits=(16, 4)),
'bysal': fields.float('By Salary', digits=(16, 4)),
'amount': fields.float('Amount', digits=(16, int(config['price_accuracy']))),
'bysal': fields.float('By Salary', digits=(16, int(config['price_accuracy']))),
'flag':fields.char('D/C', size=8, required=True, readonly=False),
}
_defaults = {
@@ -434,10 +434,10 @@ class contrib_register(osv.osv):
'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account', required=False),
'name':fields.char('Name', size=256, required=True, readonly=False),
'register_line_ids':fields.one2many('hr.contibution.register.line', 'register_id', 'Register Line', readonly=True),
'yearly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, 4)),
'yearly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, 4)),
'monthly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, 4)),
'monthly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, 4)),
'yearly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, int(config['price_accuracy']))),
'yearly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, int(config['price_accuracy']))),
'monthly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, int(config['price_accuracy']))),
'monthly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, int(config['price_accuracy']))),
'note': fields.text('Description'),
}
_defaults = {
@@ -466,9 +466,9 @@ class contrib_register_line(osv.osv):
'code':fields.char('Code', size=64, required=False, readonly=False),
'employee_id':fields.many2one('hr.employee', 'Employee', required=True),
'period_id': fields.many2one('account.period', 'Period'),
'emp_deduction': fields.float('Employee Deduction', digits=(16, 4)),
'comp_deduction': fields.float('Company Deduction', digits=(16, 4)),
'total': fields.function(_total, method=True, store=True, string='Total', digits=(16, 4)),
'emp_deduction': fields.float('Employee Deduction', digits=(16, int(config['price_accuracy']))),
'comp_deduction': fields.float('Company Deduction', digits=(16, int(config['price_accuracy']))),
'total': fields.function(_total, method=True, store=True, string='Total', digits=(16, int(config['price_accuracy']))),
}
contrib_register_line()
@@ -539,7 +539,7 @@ class company_contribution(osv.osv):
('fix','Fixed Amount'),
('func','Function Calculation'),
],'Amount Type', select=True),
'contribute_per':fields.float('Contribution', digits=(16, 4), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
'contribute_per':fields.float('Contribution', digits=(16, int(config['price_accuracy'])), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
'account_id':fields.property(
'account.account',
type='many2one',
@@ -596,13 +596,13 @@ class company_contribution_line(osv.osv):
'contribution_id':fields.many2one('company.contribution', 'Contribution', required=False),
'name':fields.char('Name', size=64, required=False, readonly=False),
'umo_id':fields.many2one('product.uom', 'Unite', required=False),
'from_val': fields.float('From', digits=(16, 4)),
'to_val': fields.float('To', digits=(16, 4)),
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))),
'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))),
'amount_type':fields.selection([
('fix','Fixed Amount'),
],'Amount Type', select=True),
'sequence':fields.integer('Sequence'),
'value': fields.float('Value', digits=(16, 4)),
'value': fields.float('Value', digits=(16, int(config['price_accuracy']))),
}
company_contribution_line()
@@ -1213,9 +1213,9 @@ class hr_payslip_line(osv.osv):
'amount': fields.float('Amount / Percentage', digits=(16, 4)),
'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account', required=False),
'account_id':fields.many2one('account.account', 'General Account', required=True),
'total': fields.float('Sub Total', readonly=True, digits=(16, 4)),
'total': fields.float('Sub Total', readonly=True, digits=(16, int(config['price_accuracy']))),
#'total': fields.function(_calculate, method=True, type='float', string='Label', store=True),
'company_contrib': fields.float('Company Contribution', readonly=True, digits=(16, 4)),
'company_contrib': fields.float('Company Contribution', readonly=True, digits=(16, int(config['price_accuracy']))),
'expanse_id': fields.many2one('hr.expense.expense', 'Expense'),
'sequence': fields.integer('Sequence'),
'note':fields.text('Description'),
@@ -1251,13 +1251,13 @@ class hr_payslip_line_line(osv.osv):
'slipline_id':fields.many2one('hr.payslip.line', 'Slip Line', required=False),
'name':fields.char('Name', size=64, required=False, readonly=False),
'umo_id':fields.many2one('product.uom', 'Unite', required=False),
'from_val': fields.float('From', digits=(16, 4)),
'to_val': fields.float('To', digits=(16, 4)),
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))),
'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))),
'amount_type':fields.selection([
('fix','Fixed Amount'),
],'Amount Type', select=True),
'sequence':fields.integer('Sequence'),
'value': fields.float('Value', digits=(16, 4)),
'value': fields.float('Value', digits=(16, int(config['price_accuracy']))),
}
hr_payslip_line_line()
+1
View File
@@ -169,6 +169,7 @@
<field name="manager" select="1"/>
<field name="vehicle" select="1"/>
<field name="vehicle_distance" select="1"/>
<field name="medic_exam" select="1"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="ESI Information"/>
+54
View File
@@ -0,0 +1,54 @@
-
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: '2011-07-01'
date_start: '2010-07-01'
name: reference
wage: 5000.0
wage_type_id: hr_contract.hr_contract_monthly_gross
country_id: base.in
department_id: hr.dep_it
employee_account: account.a_recv
gender: male
marital: hr.hr_employee_marital_status_single
name: Richie
pg_joining: '2009-12-01'
property_bank_account: account.cash
salary_account: account.a_recv
vehicle_distance: 0.0
-
Then I create a new payment advice record
-
!record {model: hr.payroll.advice, id: hr_payroll_advice_advice0}:
account_id: account.cash
line_ids:
- amount: 5500.0
bysal: 5000.0
employee_id: 'hr_employee_richie0'
flag: C
name: Axis Bank
name: advice1
-
In order to confirm a sheet I 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 has transferred from draft to 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!')
@@ -0,0 +1,63 @@
-
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: '2011-07-01'
date_start: '2010-07-01'
name: reference
wage: 5000.0
wage_type_id: hr_contract.hr_contract_monthly_gross
country_id: base.in
department_id: hr.dep_it
employee_account: account.a_recv
gender: male
marital: hr.hr_employee_marital_status_single
name: Keith
pg_joining: '2009-12-01'
property_bank_account: account.cash
salary_account: account.a_recv
vehicle_distance: 0.0
-
I create a payroll register record
-
!record {model: hr.payroll.register, id: hr_payroll_register_payroll0}:
bank_journal_id: account.bank_journal
date: '2010-07-02'
journal_id: account.expenses_journal
line_ids:
- employee_id: hr_payroll.hr_employee_keith0
bank_journal_id: account.bank_journal
journal_id: account.expenses_journal
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!')
+132
View File
@@ -0,0 +1,132 @@
-
I test the 'Payment Advice' in order to check the hr_payroll in OpenERP
-
I create a new employee “Richard”
-
!record {model: hr.employee, id: hr_employee_richard0}:
address_home_id: base.res_partner_address_2
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: '2011-07-01'
date_start: '2010-07-01'
name: reference
wage: 5000.0
wage_type_id: hr_contract.hr_contract_monthly_gross
country_id: base.in
department_id: hr.dep_it
employee_account: account.a_recv
gender: male
marital: hr.hr_employee_marital_status_single
name: Richard
pg_joining: '2009-12-01'
property_bank_account: account.cash
salary_account: account.a_recv
vehicle_distance: 0.0
-
I create a new payroll structure for software developer
-
!record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper0}:
code: SD
line_ids:
- account_id: account.a_expense
amount: 0.40000000000000002
amount_type: per
category_id: hr_payroll.HRA
code: HRA
company_contrib: 0.0
name: House Rant Allowance
sequence: 5
total: 0.0
type: allowance
- account_id: account.a_expense
amount: 10000.0
amount_type: fix
category_id: hr_payroll.CA
code: CA
company_contrib: 0.0
name: Convance Allowance
sequence: 10
total: 0.0
type: allowance
- account_id: account.a_pay
amount: 10000.0
amount_type: fix
category_id: hr_payroll.PT
code: PT
company_contrib: 0.0
name: Professional Tax
sequence: 15
total: 0.0
type: deduction
- account_id: account.a_pay
amount: 0.125
amount_type: per
category_id: hr_payroll.PF
code: PF
company_contrib: 0.0
name: Provident Fund
sequence: 20
total: 0.0
type: deduction
name: Software Developer
-
I create a employee payslip record
-
!record {model: hr.payslip, id: hr_payslip_0}:
bank_journal_id: account.bank_journal
employee_id: hr_payroll.hr_employee_richard0
journal_id: account.expenses_journal
-
I click on 'Compute Sheet' button
-
!workflow {model: hr.payslip, action: compute_sheet, ref: hr_payslip_0}
-
!python {model: hr.payslip}: |
self.compute_sheet(cr, uid, [ref("hr_payslip_0")], {"lang": "en_US", "tz": False,
"active_model": "ir.ui.menu", "department_id": False, "active_ids": [ref("hr_payroll.menu_department_tree")],
"section_id": False, "active_id": ref("hr_payroll.menu_department_tree"),
})
-
I check that an order which was in the "New Slip" state has transit to "Wating for Verification" state
-
!python {model: hr.payslip}: |
from tools.translate import _
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
assert(payslip_brw.state == 'draft'), _('State not changed!')
-
Then I click on Verify Sheet button
-
!workflow {model: hr.payslip, action: verify_sheet, ref: hr_payslip_0}
-
I check that an order which was in the "Wating for Verification" state has transit to "Wating for HR Verification" state
-
!python {model: hr.payslip}: |
from tools.translate import _
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
assert(payslip_brw.state == 'hr_check'), _('State not changed!')
-
Then I click on Complete HR Checking button
-
!workflow {model: hr.payslip, action: final_verify_sheet, ref: hr_payslip_0}
-
I check that an order which was in the "'Wating for HR Verification'" state has transit to "Confirm Sheet" state
-
!python {model: hr.payslip}: |
from tools.translate import _
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
assert(payslip_brw.state == 'confirm'), _('State not changed!')
-
Then I click on Pay Salary button
-
!workflow {model: hr.payslip, action: process_sheet, ref: hr_payslip_0}
-
I check that an order which was in the "Confirm Sheet" state has transit to "Paid Salary" state
-
!python {model: hr.payslip}: |
from tools.translate import _
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
assert(payslip_brw.state == 'done'), _('State not changed!')
+1 -3
View File
@@ -20,15 +20,13 @@
from datetime import datetime
from dateutil.relativedelta import relativedelta
import time
from osv import fields, osv
from tools import config
from tools.translate import _
import math
import netsvc
import time
import tools
import decimal_precision as dp