From cec3603d0e5fd10a7cbd1da54f1358ae1e744bc9 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 6 Jul 2010 14:29:22 +0530 Subject: [PATCH 1/2] [IMP] stock: Remove unused improrts bzr revid: mra@mra-laptop-20100706085922-8cdbqvibguukoz2v --- addons/stock/stock.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index cf3026494aa..6873508023f 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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 From 4d68c0c8c2184bd37d7deaff383ac56f29fada3c Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 6 Jul 2010 14:37:09 +0530 Subject: [PATCH 2/2] [IMP] hr_payroll:Added yaml for hr_payroll bzr revid: mtr@mtr-20100706090709-hmefb20mdmxb9tb4 --- addons/hr_payroll/__openerp__.py | 6 + addons/hr_payroll/test/payment_advice.yml | 54 ++++++++ addons/hr_payroll/test/payroll_register.yml | 63 ++++++++++ addons/hr_payroll/test/payslip.yml | 132 ++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100644 addons/hr_payroll/test/payment_advice.yml create mode 100644 addons/hr_payroll/test/payroll_register.yml create mode 100644 addons/hr_payroll/test/payslip.yml diff --git a/addons/hr_payroll/__openerp__.py b/addons/hr_payroll/__openerp__.py index 5c7b1436864..c8be8df2ff6 100644 --- a/addons/hr_payroll/__openerp__.py +++ b/addons/hr_payroll/__openerp__.py @@ -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' diff --git a/addons/hr_payroll/test/payment_advice.yml b/addons/hr_payroll/test/payment_advice.yml new file mode 100644 index 00000000000..de86d8c27be --- /dev/null +++ b/addons/hr_payroll/test/payment_advice.yml @@ -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!') diff --git a/addons/hr_payroll/test/payroll_register.yml b/addons/hr_payroll/test/payroll_register.yml new file mode 100644 index 00000000000..317ad40ac32 --- /dev/null +++ b/addons/hr_payroll/test/payroll_register.yml @@ -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!') diff --git a/addons/hr_payroll/test/payslip.yml b/addons/hr_payroll/test/payslip.yml new file mode 100644 index 00000000000..1ecab075da0 --- /dev/null +++ b/addons/hr_payroll/test/payslip.yml @@ -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!')