From b5462c9b1bf8bafa47998abfb96358c06f285472 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 31 May 2010 13:47:27 +0530 Subject: [PATCH] [ADD]: hr_timesheet: add yaml for hr_timesheet module. bzr revid: atp@tinyerp.co.in-20100531081727-8h30d52ydh6fls44 --- addons/hr_timesheet/__openerp__.py | 1 + .../hr_timesheet/test/test_hr_timesheet.yml | 97 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 addons/hr_timesheet/test/test_hr_timesheet.yml diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py index 312f17b44b3..66bcfe46a43 100644 --- a/addons/hr_timesheet/__openerp__.py +++ b/addons/hr_timesheet/__openerp__.py @@ -50,6 +50,7 @@ to set up a management by affair. 'wizard/hr_timesheet_sign_in_out_view.xml', ], 'demo_xml': ['hr_timesheet_demo.xml'], + 'test': ['test/test_hr_timesheet.yml'], 'installable': True, 'active': False, 'certificate': '0071405533469', diff --git a/addons/hr_timesheet/test/test_hr_timesheet.yml b/addons/hr_timesheet/test/test_hr_timesheet.yml new file mode 100644 index 00000000000..6bae0704e8a --- /dev/null +++ b/addons/hr_timesheet/test/test_hr_timesheet.yml @@ -0,0 +1,97 @@ +- | + In order to test hr_timesheet Module in OpenERP, I make "Sign In or Sign Out for Project" to encode and + track time spent on the different projects. + +- | + Now, I create a new employee “Mark Johnson” to test Timesheet. + +- + !record {model: hr.employee, id: hr_employee_employee0}: + address_home_id: base.res_partner_address_1 + company_id: base.main_company + gender: male + marital: hr.hr_employee_marital_status_single + name: Mark Johnson + user_id: base.user_root + +- | + I start by "Sign In/Sign Out by Project" wizard and click on "Sign In/Sign Out" button of this wizard. +- + !python {model: hr.sign.in.project}: | + self.check_state(cr, uid, [ref("hr_employee_employee0")]) +- | + I select start date and Perform start work on project. +- + !record {model: hr.sign.in.project, id: hr_employee_employee0}: + name: employee1 + server_date: '2010-05-20 16:10:59' + state: absent +- | + I click on "Start Working" button of this wizard to start work on Project. +- + !python {model: hr.sign.in.project}: | + self.sign_in_result(cr, uid, [ref("hr_employee_employee0")], context) +- | + My work is done and I want to stop work.for that I click on "Sign In/Sign Out" button of "Sign In/Sign Out by Project" wizard. + Which check state in hr attendace form for user. +- + !python {model: hr.sign.in.project}: | + obj_attendance = self.pool.get('hr.employee') + emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "employee1")]) + if emp_id: + employee = obj_attendance.read(cr, uid, emp_id)[0] + self.write(cr, uid, [ref('hr_employee_employee0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}) + self.check_state(cr, uid, [ref("hr_employee_employee0")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")] + }) + +- | + Given that I have product for "Consultancy - Senior Developer". + +- + !record {model: product.product, id: product_consultant}: + categ_id: product.product_category_10 + default_code: DEV + list_price: 75.0 + name: Consultancy - Senior Developer + procure_method: make_to_order + purchase_ok: False + standard_price: 30.0 + supply_method: produce + type: service + uom_id: product.uom_hour + uom_po_id: product.uom_hour + + +- | + I assing product and journal to "Mark Johnson" +- + !record {model: hr.employee, id: hr_employee_employee0}: + journal_id: analytic_journal + product_id: product_consultant + +- | + This will Open "hr sign out project" form. I select analytical project2 development account. +- + !record {model: hr.sign.out.project, id: hr_employee_employee0}: + account_id: account.analytic_project_2_development + analytic_amount: 7.0 + date: '2010-05-21 16:40:00' + date_start: '2010-05-19 16:37:00' + info: Create Yaml for hr module + name: Mark Johnson + server_date: '2010-05-19 16:40:15' + state: present + +- | + My work for this project is over and I stop work by click on "Stop Work" button of this wizard. +- + !python {model: hr.sign.out.project}: | + emp_obj = self.pool.get('hr.employee') + emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid), ('name', '=', 'employee1')]) + if emp_id: + employee = emp_obj.read(cr, uid, emp_id)[0] + self.write(cr, uid, [ref('hr_employee_employee0')], {'emp_id': emp_id[0] }) + #self.sign_out_result(cr, uid, [ref('hr_employee_employee0')]) + +- | + I can see employee timesheet for particular month using "Employee Timesheet" report. \ No newline at end of file