Meera Trambadia (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-payroll-improve-yaml-mtr into
lp:~openerp-dev/openobject-addons/trunk-payroll.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-payroll-improve-yaml-mtr/+merge/63641
hr_payroll:- improved yaml for payslip.
hr_payroll_account:- added yaml for hr_payroll_account module.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-payroll-improve-yaml-mtr/+merge/63641
Your team OpenERP R&D Team is requested to review the proposed merge of
lp:~openerp-dev/openobject-addons/trunk-payroll-improve-yaml-mtr into
lp:~openerp-dev/openobject-addons/trunk-payroll.
=== modified file 'hr_payroll/__openerp__.py'
--- hr_payroll/__openerp__.py 2011-05-03 12:38:07 +0000
+++ hr_payroll/__openerp__.py 2011-06-07 06:23:25 +0000
@@ -60,7 +60,7 @@
'wizard/hr_payroll_year_salary.xml',
],
'test': [
-# 'test/payslip.yml',
+ 'test/payslip.yml',
# 'test/payment_advice.yml',
# 'test/payroll_register.yml',
# 'test/hr_payroll_report.yml',
=== modified file 'hr_payroll/test/payslip.yml'
--- hr_payroll/test/payslip.yml 2011-01-14 00:11:01 +0000
+++ hr_payroll/test/payslip.yml 2011-06-07 06:23:25 +0000
@@ -1,15 +1,5 @@
-
- I test the 'Payment Advice' in order to check the hr_payroll in OpenERP
--
- I Create a bank record
--
- !record {model: res.partner.bank, id: res_partner_bank_0}:
- acc_number: '987654321'
- partner_id: base.res_partner_desertic_hispafuentes
- sequence: 0.0
- name: Fortis
- state: bank
- bank: base.res_bank_1
+ I test the 'Payslip' in order to check the hr_payroll module in OpenERP
-
I create a new employee âRichardâ
-
@@ -18,120 +8,94 @@
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
+ marital: single
name: Richard
- bank_account_id: res_partner_bank_0
vehicle_distance: 0.0
-
- I create a new payroll structure for software developer
+ I create a salary structure for 'Software Developer'
-
- !record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper0}:
+ !record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper}:
+ name: Salary Structure for Software Developer
code: SD
- line_ids:
- - 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
- - 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
- - 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
- - 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
+ company_id: base.main_company
+ parent_id: structure_base
+ rule_ids:
+ - hr_payslip_line_houserantallowance1
+ - hr_payslip_line_convanceallowance1
+ - hr_payslip_line_professionaltax1
+ - hr_payslip_line_providentfund1
+ - hr_salary_rule_meal_voucher
+ - hr_salary_rule_sales_commission
+-
+ I create a contract for 'Richard'
+-
+ !record {model: hr.contract, id: hr_contract_richard}:
+ 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: Contract for Richard
+ wage: 5000.0
+ type_id: hr_contract.hr_contract_type_emp
+ employee_id: hr_employee_richard0
+ struct_id: hr_payroll_structure_softwaredeveloper
+ working_hours: resource.timesheet_group1
+-
+ I create a Payslip
-
!record {model: hr.payslip, id: hr_payslip_0}:
employee_id: hr_payroll.hr_employee_richard0
-
+-
+ The selection of an employee fills the contract, structure, worked days and input data fields
+-
+ !python {model: hr.payslip}: |
+ import time
+ from datetime import datetime
+ from dateutil import relativedelta
+ date_from = time.strftime('%Y-%m-01')
+ worked_days_obj = self.pool.get('hr.payslip.worked_days')
+ date_to = str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10]
+ emp_id = self.pool.get('hr.employee').search(cr, uid, [('id', '=', ref("hr_employee_richard0"))])
+ res = self.onchange_employee_id(cr, uid, [], date_from, date_to, ref("hr_employee_richard0"), False, None)
+ vals = {
+ 'employee_id': emp_id[0],
+ 'struct_id': res['value']['struct_id'],
+ 'contract_id': res['value']['contract_id'],
+ 'name': res['value']['name'],
+ }
+ vals['worked_days_line_ids'] = [(0,0,i) for i in res['value']['worked_days_line_ids']]
+ vals['input_line_ids'] = [(0,0,i) for i in res['value']['input_line_ids']]
+ self.write(cr, uid, ref("hr_payslip_0"), vals)
+-
+ I assign the amount to Input data
+-
+ !python {model: hr.payslip.input}: |
+ ids = self.search(cr, uid, [('payslip_id', '=', ref("hr_payslip_0"))])
+ self.write(cr, uid, ids, {'amount': 5.0})
+-
+ I verify the payslip is in draft 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!')
-
I click on 'Compute Sheet' button
-
- !workflow {model: hr.payslip, action: compute_sheet, ref: hr_payslip_0}
--
- just to test
--
!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 the order is now in "Waiting 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!')
--
- I click on Verify Sheet button.
--
- !workflow {model: hr.payslip, action: verify_sheet, ref: hr_payslip_0}
--
- I check that the order is in the "Waiting 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!')
--
- I click on Complete HR Checking button.
--
- !workflow {model: hr.payslip, action: final_verify_sheet, ref: hr_payslip_0}
--
- I check that the order is in "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!')
--
- I click on Pay Salary button
--
- !workflow {model: hr.payslip, action: process_sheet, ref: hr_payslip_0}
--
- I check that the order is in "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!')
+ Then I click on the 'Confirm' button
+-
+ !workflow {model: hr.payslip, action: hr_verify_sheet, ref: hr_payslip_0}
+-
+ I verify that the payslip is in done 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!')
\ No newline at end of file
=== modified file 'hr_payroll_account/__openerp__.py'
--- hr_payroll_account/__openerp__.py 2011-05-12 11:02:43 +0000
+++ hr_payroll_account/__openerp__.py 2011-06-07 06:23:25 +0000
@@ -47,6 +47,9 @@
'demo_xml': [
'hr_payroll_account_demo.xml'
],
+ 'test': [
+ 'test/hr_payroll_account.yml',
+ ],
'installable': True,
'active': False,
'certificate' : '00923971112835220957',
=== added directory 'hr_payroll_account/test'
=== added file 'hr_payroll_account/test/hr_payroll_account.yml'
--- hr_payroll_account/test/hr_payroll_account.yml 1970-01-01 00:00:00 +0000
+++ hr_payroll_account/test/hr_payroll_account.yml 2011-06-07 06:23:25 +0000
@@ -0,0 +1,116 @@
+-
+ I test the 'Payslip' in order to check the hr_payroll_account module in OpenERP
+-
+ I create a bank record
+-
+ !record {model: res.partner.bank, id: res_partner_bank_0}:
+ acc_number: '987654321'
+ partner_id: base.res_partner_desertic_hispafuentes
+ name: Fortis
+ state: bank
+ bank: base.res_bank_1
+-
+ I create a new employee âJohnâ
+-
+ !record {model: hr.employee, id: hr_employee_john}:
+ address_home_id: base.res_partner_address_2
+ address_id: base.res_partner_address_9
+ birthday: '1984-05-01'
+ children: 0.0
+ country_id: base.in
+ department_id: hr.dep_it
+ gender: male
+ marital: single
+ name: John
+ bank_account_id: res_partner_bank_0
+ vehicle_distance: 0.0
+-
+ I create a salary structure for 'Software Developer'
+-
+ !record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper}:
+ name: Salary Structure for Software Developer
+ code: SD
+ company_id: base.main_company
+ parent_id: hr_payroll.structure_base
+ rule_ids:
+ - hr_payroll.hr_payslip_line_houserantallowance1
+ - hr_payroll.hr_payslip_line_convanceallowance1
+ - hr_payroll.hr_payslip_line_professionaltax1
+ - hr_payroll.hr_payslip_line_providentfund1
+ - hr_payroll.hr_salary_rule_meal_voucher
+ - hr_payroll.hr_salary_rule_sales_commission
+-
+ I create a contract for 'John'
+-
+ !record {model: hr.contract, id: hr_contract_john}:
+ 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: Contract for John
+ wage: 5000.0
+ type_id: hr_contract.hr_contract_type_emp
+ employee_id: hr_employee_john
+ struct_id: hr_payroll_structure_softwaredeveloper
+ working_hours: resource.timesheet_group1
+-
+ I create a Payslip
+-
+ !record {model: hr.payslip, id: hr_payslip_0}:
+ employee_id: hr_employee_john
+ journal_id: account.expenses_journal
+-
+ The selection of an employee fills the contract, structure, worked days and input data fields
+-
+ !python {model: hr.payslip}: |
+ import time
+ from datetime import datetime
+ from dateutil import relativedelta
+ date_from = time.strftime('%Y-%m-01')
+ worked_days_obj = self.pool.get('hr.payslip.worked_days')
+ date_to = str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10]
+ res = self.onchange_employee_id(cr, uid, [], date_from, date_to, ref("hr_employee_john"), False, None)
+ vals = {
+ 'struct_id': res['value']['struct_id'],
+ 'contract_id': res['value']['contract_id'],
+ 'name': res['value']['name'],
+ }
+ vals['worked_days_line_ids'] = [(0,0,i) for i in res['value']['worked_days_line_ids']]
+ vals['input_line_ids'] = [(0,0,i) for i in res['value']['input_line_ids']]
+ self.write(cr, uid, ref("hr_payslip_0"), vals)
+-
+ I assign the amount to Input data
+-
+ !python {model: hr.payslip.input}: |
+ ids = self.search(cr, uid, [('payslip_id', '=', ref("hr_payslip_0"))])
+ self.write(cr, uid, ids, {'amount': 5.0})
+-
+ I verify the payslip is in draft 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!')
+-
+ I click on 'Compute Sheet' button
+-
+ !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"),
+ })
+-
+ Then I click on the 'Confirm' button
+-
+ !workflow {model: hr.payslip, action: hr_verify_sheet, ref: hr_payslip_0}
+-
+ I verify that the Accounting Entries are created
+-
+ !python {model: hr.payslip}: |
+ payslip = self.browse(cr, uid, ref("hr_payslip_0"))
+ assert payslip.move_id, "Accounting Entries has not been created"
+-
+ I verify that the payslip is in done 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!')
\ No newline at end of file
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp