From 87f2ff759d912f82b1fc6374bf5ae70ff029e8aa Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Fri, 28 May 2010 16:26:57 +0530 Subject: [PATCH 001/120] [IMP]: Minor Improvement in comment of yaml file. bzr revid: atp@tinyerp.co.in-20100528105657-vhre832jnwh7elze --- addons/hr/test/test_hr.yml | 22 +++++++++--------- addons/hr_contract/test/test_hr_contract.yml | 6 ++--- addons/hr_holidays/test/test_hr_holiday.yml | 23 +++++++++---------- .../test/test_hr_recruitment.yml | 6 ++--- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/addons/hr/test/test_hr.yml b/addons/hr/test/test_hr.yml index 494111737b1..74d7c8de8d1 100644 --- a/addons/hr/test/test_hr.yml +++ b/addons/hr/test/test_hr.yml @@ -1,15 +1,15 @@ - | - In order to test the hr module in OpenERP, I will create new Employee , Department and Job Position. + In order to test hr module in OpenERP, I will create new Employee , Department and Job Position. - | - First I create Department "R & D" in Department form. + I create "R & D" Department in Department form. - !record {model: hr.department, id: hr_department_rd0}: manager_id: base.user_root name: 'R & D ' - | - Now, I create a new employee “employee1”. + Now, I create a new employee “Mark Johnson”. select "R & D" Department which I had created. - !record {model: hr.employee, id: hr_employee_employee0}: @@ -22,7 +22,7 @@ department_id: 'hr_department_rd0' - | - In order to check the wizard “Employee Hierarchy” I will create new employee “employee2” and select "employee1" as + In order to check the wizard “Employee Hierarchy” , I will create new employee “Phil Graves ” and select "Mark Johnson" as Manager. - !record {model: hr.employee, id: hr_employee_employee1}: @@ -33,11 +33,11 @@ user_id: base.user_demo parent_id: 'hr_employee_employee0' - | - Now I will open up form view of “employee1” and test the wizard “Employee Hierarchy” so it display the employee - hierarchy starting from “employee1”. + I will open up form view of “Mark Johnson” and test the wizard “Employee Hierarchy” so it display the employee + hierarchy starting from “Mark Johnson”. - | - Now I will create new Job Position. I will check successfull creation of new Job Position by adding the information. + I will create new Job Position. I will check successfull creation of new Job Position by adding the information. - !record {model: hr.job, id: hr_job_jea0}: department_id: 'hr_department_rd0' @@ -51,17 +51,17 @@ - state == 'open' - | - I create Employee for this position in this Job Position form. + I create Employee for job position. - !record {model: hr.job, id: hr_job_jea0}: employee_ids: - address_home_id: base.res_partner_address_1 - name: employee3 + name: Manuel Lehba department_id: 'hr_department_rd0' gender: male parent_id: 'hr_employee_employee0' -- - I check that "NO of Employee" is "1" +- | + I check that "Number of Employees" field have some value. - !assert {model: hr.job, id: hr_job_jea0}: - no_of_employee != False diff --git a/addons/hr_contract/test/test_hr_contract.yml b/addons/hr_contract/test/test_hr_contract.yml index 87c44722e2c..cbcc7e67fda 100644 --- a/addons/hr_contract/test/test_hr_contract.yml +++ b/addons/hr_contract/test/test_hr_contract.yml @@ -3,7 +3,7 @@ I will create contract for "Mark Johnson" employee. - | - First I create Employee "Mark Johnson" + I create Employee "Mark Johnson" to assign contract. - !record {model: hr.employee, id: hr_employee_employee0}: address_home_id: base.res_partner_address_1 @@ -30,9 +30,9 @@ type: gross - | - Now I start by create contract for "Mark Johnson". + Now I start by creating contract for "Mark Johnson". Select wage type "Monthly Gross Wage" and Wage period "monthly" - which I have given. + which I had given. - !record {model: hr.contract, id: hr_contract_contract0}: advantages_gross: 0.0 diff --git a/addons/hr_holidays/test/test_hr_holiday.yml b/addons/hr_holidays/test/test_hr_holiday.yml index 960d12f23bd..68d58b1791b 100644 --- a/addons/hr_holidays/test/test_hr_holiday.yml +++ b/addons/hr_holidays/test/test_hr_holiday.yml @@ -1,6 +1,5 @@ - | - In order to test the hr_holiday in OpenERP, I will Manage leaves for employee, - Leave requests. + In order to test the hr_holiday in OpenERP, I will Allocate leaves for Employee and manage leaves and leaves requests. - | For that First I create new user "user1" to make leave request. - @@ -15,7 +14,7 @@ name: user1 password: user1 - | - Now, I create a new employee “Mark Johnshon” as Manager to validate employee leave. + I create a new employee “Mark Johnshon” as Manager to validate employee leave. - !record {model: hr.employee, id: hr_employee_employee0}: address_home_id: base.res_partner_address_1 @@ -24,11 +23,11 @@ name: Mark Johnson user_id: base.user_root - | - create another employee "Brijesh Patel" as "user1" who make leave request. + Create another employee "Phil Graves" as "user1" who make leave request. - - !record {model: hr.employee, id: hr_employee_brijeshpatel0}: + !record {model: hr.employee, id: hr_employee_philgraves0}: address_home_id: base.res_partner_address_8 - name: Brijesh Patel + name: Phil Graves parent_id: 'hr_employee_employee0' user_id: 'res_users_user0' - | @@ -40,11 +39,11 @@ limit: 1 - | - After that I allocate leave request for employee "Brijesh Patel". + After that I allocate leave request for employee "Phil Graves". - !record {model: hr.holidays, id: hr_holidays_allocateleaveforuser0}: allocation_type: employee - employee_id: 'hr_employee_brijeshpatel0' + employee_id: 'hr_employee_philgraves0' holiday_status_id: hr_holidays_status_fullleave0 name: Allocate leave for user1 number_of_days_temp: 12.0 @@ -62,13 +61,13 @@ !workflow {model: hr.holidays, action: validate, ref: hr_holidays_allocateleaveforuser0} - | - Now employee "Brijesh Patel" want to leave. so, I connect as user1 which is username of this employee and want to make leave request. + Now employee "Phil Graves" want to leave. so, I connect as user1 which is username of this employee and want to make leave request. - !record {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}: allocation_type: employee date_from: '2010-05-20 11:48:00' date_to: '2010-05-21 11:48:00' - employee_id: 'hr_employee_brijeshpatel0' + employee_id: 'hr_employee_philgraves0' holiday_status_id: 'hr_holidays_status_fullleave0' name: I want to leave for go to hospital notes: I want to leave for go to hospital. so please accept my leave. @@ -82,12 +81,12 @@ - state == 'draft' - | - Now I confirm my leave Request by click on "Confirm" button. + I confirm my leave Request by click on "Confirm" button. - !workflow {model: hr.holidays, action: confirm, ref: hr_holidays_iwanttoleaveforgotohospital0} - | - Now I connect as Admin user and Open Leave request of "Brijesh Patel". + I connect as Admin user and Open Leave request of "Phil Graves". and "validate" it by click on "validate" button. - !workflow {model: hr.holidays, action: validate, ref: hr_holidays_iwanttoleaveforgotohospital0} diff --git a/addons/hr_recruitment/test/test_hr_recruitment.yml b/addons/hr_recruitment/test/test_hr_recruitment.yml index bf5da78c69a..3b865efe113 100644 --- a/addons/hr_recruitment/test/test_hr_recruitment.yml +++ b/addons/hr_recruitment/test/test_hr_recruitment.yml @@ -1,10 +1,10 @@ - | - In order to test hr_recruitment module for OpenERP object, I create applicants form and Manages job positions and the recruitement process. + In order to test hr_recruitment module for OpenERP, I will create applicants form, Manages job positions and the recruitement process. - | - I create job possition for employee to manage job position. + I create job position for employee to manage job position. - | - First I create Department "R & D" in Department form for which I make recruitment. + For that First I create Department "R & D" in Department form for which I make recruitment. - !record {model: hr.department, id: hr_department_rd0}: manager_id: base.user_root From a7172a010ac4c3dd5b59b2c92e4bdf4a29d8f283 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 31 May 2010 13:11:35 +0530 Subject: [PATCH 002/120] [ADD]: hr_timesheet_invoice: create yaml for hr_timesheet_invoice module. bzr revid: atp@tinyerp.co.in-20100531074135-m3eaf6rf7gul520r --- addons/hr_timesheet_invoice/__openerp__.py | 4 +- .../test/test_hr_timesheet_invoice.yml | 89 +++++++++++++++++++ .../wizard/hr_timesheet_invoice_create.py | 20 ++--- 3 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml diff --git a/addons/hr_timesheet_invoice/__openerp__.py b/addons/hr_timesheet_invoice/__openerp__.py index 72148b83f63..9e4d4186bba 100644 --- a/addons/hr_timesheet_invoice/__openerp__.py +++ b/addons/hr_timesheet_invoice/__openerp__.py @@ -44,7 +44,9 @@ reports, eso.""", 'wizard/hr_timesheet_invoice_create_view.xml', 'wizard/hr_timesheet_invoice_create_final_view.xml', ], - 'demo_xml': ['hr_timesheet_invoice_demo.xml'], + 'demo_xml': ['hr_timesheet_invoice_demo.xml', + ], + 'test': ['test/test_hr_timesheet_invoice.yml'], 'installable': True, 'active': False, 'certificate': '0056091842381', diff --git a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml new file mode 100644 index 00000000000..3cf1a55e96e --- /dev/null +++ b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml @@ -0,0 +1,89 @@ +- | + In order to test hr_timesheet_invoice in OpenERP, I create account line to manage invoice based on costs. +- | + In order to test flow, I create analytic line for sednacom analytic account. +- + !record {model: account.analytic.line, id: account_analytic_line_developyamlforhrmodule0}: + account_id: account.analytic_sednacom + amount: -1.0 + company_id: base.main_company + date: '2010-05-30' + general_account_id: account.a_expense + journal_id: hr_timesheet.analytic_journal + name: develop yaml for hr module + product_id: hr_timesheet.product_consultant + product_uom_id: product.uom_hour + to_invoice: hr_timesheet_invoice.timesheet_invoice_factor2 + unit_amount: 5.00 + user_id: base.user_root + +- + Give partner name and price list in analytic account. +- + !record {model: account.analytic.account, id: account.analytic_sednacom}: + partner_id: base.res_partner_9 + pricelist_id: product.list0 + +- + I create invoice on analytic Line using "Invoice analytic Line" wizard. + Give date , detail of each work , time spend on that work on this wizard. +- + !record {model: hr.timesheet.invoice.create, id: hr_timesheet_invoice_create_0}: + accounts: + - account.analytic_sednacom + date: 1 + name: 1 + price: 1 + product: hr_timesheet.product_consultant + time: 1 + +- + I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice. +- + !python {model: hr.timesheet.invoice.create}: | + self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0")]}) + +- | + I check that Invoice is create for this timesheet. +- + !python {model: account.analytic.line}: | + exp = self.browse(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')])[0] + + analytic_account_obj = self.pool.get('account.analytic.account') + + data = self.pool.get('hr.timesheet.invoice.create').read(cr, uid, [ref("hr_timesheet_invoice_create_0")], [], context)[0] + + account_ids = data['accounts'] + for account in analytic_account_obj.browse(cr, uid, account_ids, context): + partner = account.partner_id.id + + invoice_obj = self.pool.get('account.invoice') + invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)]) + invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0] + + for invoice in invoice_id.invoice_line: + product = invoice.product_id.id + + product_exp = data['product'] + + assert product == product_exp +- + I creating a final invoice for "Sednacom" analytic account. +- + !record {model: hr.timesheet.invoice.create.final, id: hr_timesheet_invoice_create_final_0}: + balance_product: hr_timesheet.product_consultant + date: 1 + name: 1 + price: 1 + time: 1 +- + I click on "Create Invoice" button to create Invoice. +- + !python {model: hr.timesheet.invoice.create.final}: | + self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_final_0")], {"active_ids": [ref("account.analytic_sednacom")]}) + + +- | + I can also make some theoretical revenue reports. +- | + I can also see timesheet profit using Timesheet profit report. \ No newline at end of file diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 89ff5e92697..4cd54f5935d 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -71,8 +71,8 @@ class hr_timesheet_invoice_create(osv.osv_memory): result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') res = mod_obj.read(cr, uid, result, ['res_id']) - data = self.read(cr, uid, ids, [], context)[0] + account_ids = data['accounts'] for account in analytic_account_obj.browse(cr, uid, account_ids, context): partner = account.partner_id @@ -119,11 +119,11 @@ class hr_timesheet_invoice_create(osv.osv_memory): "GROUP BY product_id,to_invoice", (account.id,context['active_ids'],)) for product_id,factor_id,qty in cr.fetchall(): - product = pool.get('product.product').browse(cr, uid, product_id, context2) + product = self.pool.get('product.product').browse(cr, uid, product_id, context2) if not product: raise osv.except_osv(_('Error'), _('At least one line has no product !')) factor_name = '' - factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2) + factor = self.pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2) if not data['product']: if factor.customer_name: @@ -131,16 +131,16 @@ class hr_timesheet_invoice_create(osv.osv_memory): else: factor_name = product.name else: - factor_name = pool.get('product.product').name_get(cr, uid, [data['product']], context=context)[0][1] + factor_name = self.pool.get('product.product').name_get(cr, uid, [data['product']], context=context)[0][1] if account.pricelist_id: pl = account.pricelist_id.id - price = pool.get('product.pricelist').price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl] + price = self.pool.get('product.pricelist').price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl] else: price = 0.0 taxes = product.taxes_id - tax = pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes) + tax = self.pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes) account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id curr_line = { 'price_unit': price, @@ -159,7 +159,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): # # Compute for lines # - cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id = ANY (%s) AND product_id=%s and to_invoice=%s", (account.id, data['ids'], product_id, factor_id)) + cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id = %s AND product_id=%s and to_invoice=%s", (account.id, data['id'], product_id, factor_id)) line_ids = cr.dictfetchall() note = [] @@ -170,7 +170,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): details.append(line['date']) if data['time']: if line['product_uom_id']: - details.append("%s %s" % (line['unit_amount'], pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name)) + details.append("%s %s" % (line['unit_amount'], self.pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name)) else: details.append("%s" % (line['unit_amount'], )) if data['name']: @@ -180,8 +180,8 @@ class hr_timesheet_invoice_create(osv.osv_memory): note.append(u' - '.join(map(lambda x: unicode(x) or '',details))) curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note)) - pool.get('account.invoice.line').create(cr, uid, curr_line) - cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =ANY(%s)" ,(last_invoice, account.id,data['ids'])) + self.pool.get('account.invoice.line').create(cr, uid, curr_line) + cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =%s" ,(last_invoice, account.id,data['id'])) self.pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context) From 43b774e633fc300f9430cecc9154394d730dc35c Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 31 May 2010 13:40:25 +0530 Subject: [PATCH 003/120] [ADD]: hr_attendance: add yaml for hr_attendance module. bzr revid: atp@tinyerp.co.in-20100531081025-al9hw6umhed1t6vg --- addons/hr_attendance/__openerp__.py | 1 + .../hr_attendance/test/test_hr_attendance.yml | 109 ++++++++++++++++++ .../wizard/hr_attendance_sign_in_out.py | 42 +++---- 3 files changed, 132 insertions(+), 20 deletions(-) create mode 100644 addons/hr_attendance/test/test_hr_attendance.yml diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py index c59ba3dcbdb..c0db422b997 100644 --- a/addons/hr_attendance/__openerp__.py +++ b/addons/hr_attendance/__openerp__.py @@ -44,6 +44,7 @@ 'wizard/hr_attendance_sign_in_out_view.xml', ], 'demo_xml': ['hr_attendance_demo.xml'], + 'test': ['test/test_hr_attendance.yml'], 'installable': True, 'active': False, 'certificate': '0063495605613', diff --git a/addons/hr_attendance/test/test_hr_attendance.yml b/addons/hr_attendance/test/test_hr_attendance.yml new file mode 100644 index 00000000000..5c1132525f5 --- /dev/null +++ b/addons/hr_attendance/test/test_hr_attendance.yml @@ -0,0 +1,109 @@ +- | + In order to test hr_attendance module in OpenERP, I create new attendance and perform Sign In/Sign Out operation. + +- | + First I create Employee "Mark Johnson". +- + !record {model: hr.employee, id: hr_employee_employee0}: + address_home_id: base.res_partner_address_1 + company_id: base.main_company + gender: male + name: Mark Johnson + user_id: base.user_root + +- | + Given that I have Attendance Reason "Good Morning" for Sign In. +- + !record {model: hr.action.reason, id: hr_action_reason_goodmorning0}: + name: Good Morning + action_type: sign_in +- | + I also create another Attendance Reason for Sign Out. +- + !record {model: hr.action.reason, id: hr_action_reason_goodnight0}: + name: Good Night + action_type: sign_out +- | + Now , When I came in office , I create Atendances and perform "Sign In" action with proper reason. +- + !record {model: hr.attendance, id: hr_attendance_0}: + action: sign_in + action_desc: 'hr_action_reason_goodmorning0' + employee_id: 'hr_employee_employee0' + name: '2010-05-18 19:08:08' +- | + I check that Employee is in "Present" state. +- + !assert {model: hr.employee, id: hr_employee_employee0}: + - state == 'present' + +- | + When I left office , I create attendance and perform "Sign Out". +- + !record {model: hr.attendance, id: hr_attendance_1}: + action: sign_out + employee_id: 'hr_employee_employee0' + name: '2010-05-18 19:10:55' +- | + I check that Employee is in "Absent" state. +- + !assert {model: hr.employee, id: hr_employee_employee0}: + - state == 'absent' + +- | + I can also fill my attendance using "Sign In/Sign Out" wizard. +- + !record {model: hr.sign.in.out, id: hr_sign_in_out_markjohnson0}: + name: Mark Johnson + state: absent + +- | + I click on "Sign In" button of this wizard to perform present action. +- + !python {model: hr.sign.in.out}: | + obj_attendance = self.pool.get('hr.employee') + emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")]) + if emp_id: + employee = obj_attendance.read(cr, uid, emp_id)[0] + self.write(cr, uid, [ref('hr_sign_in_out_markjohnson0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}) + self.si_check(cr, uid, [ref("hr_sign_in_out_markjohnson0")], {"active_id": ref("hr_employee_employee0")}) + +- | + I check that Employee is in "Present" state. +- + !assert {model: hr.employee, id: hr_employee_employee0}: + - state == 'present' + +- | + I forgot to "Sign Out" in Yesterday and want to sign in Today using This wizard. +- + !record {model: hr.sign.in.out, id: hr_sign_in_out_markjohnson0}: + name: Mark Johnson + state: present +- | + I click on "Sign In" button of this wizard. that will Open new form which ask for Last Sign Out date. +- + !python {model: hr.sign.in.out}: | + obj_attendance = self.pool.get('hr.employee') + emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")]) + if emp_id: + employee = obj_attendance.read(cr, uid, emp_id)[0] + self.write(cr, uid, [ref('hr_sign_in_out_markjohnson0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}) + self.si_check(cr, uid, [ref("hr_sign_in_out_markjohnson0")]) +- | + I select Last Sign Out date in "hr sign out ask" wizard. +- + !record {model: hr.sign.in.out.ask, id: hr_sign_in_out_ask_markjohnson0}: + last_time: !eval time.strftime('%Y-%m-%d %H:%M:%S') + name: Mark Johnson +- | + Now I click on "Sign In" button of this wizard. +- + !python {model: hr.sign.in.out.ask}: | + obj_attendance = self.pool.get('hr.employee') + emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")]) + if emp_id: + employee = obj_attendance.read(cr, uid, emp_id)[0] + self.write(cr, uid, [ref('hr_sign_in_out_ask_markjohnson0')], {'emp_id': emp_id[0]}) + #self.sign_in(cr, uid, [ref("hr_sign_in_out_ask_markjohnson0")], {"active_ids": [ref("hr_attendance.menu_hr_attendance_sigh_in_out")]}) + \ No newline at end of file diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py index 9ad27298159..2259d699f07 100644 --- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py +++ b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py @@ -33,16 +33,16 @@ class hr_si_so_ask(osv.osv_memory): 'emp_id': fields.char('Empoyee ID', size=32, required=True, readonly=True), } def _get_empname(self, cr, uid, context=None): - service = netsvc.LocalService('object_proxy') - emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)]) + emp_obj = self.pool.get('hr.employee') + emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)]) if emp_id: - employee = service.execute(cr.dbname, uid, 'hr.employee', 'read', emp_id)[0] + employee = emp_obj.read(cr, uid, emp_id)[0] return employee['name'] return '' def _get_empid(self, cr, uid, context=None): - service = netsvc.LocalService('object_proxy') - emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)]) + emp_obj = self.pool.get('hr.employee') + emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)]) if emp_id: return emp_id[0] return False @@ -74,10 +74,10 @@ class hr_sign_in_out(osv.osv_memory): } def _get_empid(self, cr, uid, context=None): - service = netsvc.LocalService('object_proxy') - emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)]) + emp_obj = self.pool.get('hr.employee') + emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)]) if emp_id: - employee = service.execute(cr.dbname, uid, 'hr.employee', 'read', emp_id)[0] + employee = emp_obj.read(cr, uid, emp_id)[0] return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]} return {} @@ -88,12 +88,13 @@ class hr_sign_in_out(osv.osv_memory): return res def si_check(self, cr, uid, ids, context=None): - service = netsvc.LocalService('object_proxy') + + att_obj = self.pool.get('hr.attendance') obj_model = self.pool.get('ir.model.data') data = self.read(cr, uid, ids, [])[0] emp_id = data['emp_id'] - att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id)], limit=1, order='name desc') - last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id) + att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id)], limit=1, order='name desc') + last_att = att_obj.read(cr, uid, att_id) if last_att: last_att = last_att[0] cond = not last_att or last_att['action'] == 'sign_out' @@ -113,12 +114,13 @@ class hr_sign_in_out(osv.osv_memory): } def so_check(self, cr, uid, ids, context=None): - service = netsvc.LocalService('object_proxy') + + att_obj = self.pool.get('hr.attendance') obj_model = self.pool.get('ir.model.data') data = self.read(cr, uid, ids, [])[0] emp_id = data['emp_id'] - att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id),('action','!=','action')], limit=1, order='name desc') - last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id) + att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action','!=','action')], limit=1, order='name desc') + last_att = att_obj.read(cr, uid, att_id) if last_att: last_att = last_att[0] if not att_id and not last_att: @@ -151,31 +153,31 @@ class hr_sign_in_out(osv.osv_memory): } def sign_in(self, cr, uid, data, context=None): - service = netsvc.LocalService('object_proxy') + att_obj = self.pool.get('hr.attendance') emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past')) - service.execute(cr.dbname, uid, 'hr.attendance', 'create', { + att_obj.create(cr, uid, { 'name': data['last_time'], 'action': 'sign_out', 'employee_id': emp_id }) try: - success = service.execute(cr.dbname, uid, 'hr.employee', 'attendance_action_change', [emp_id], 'sign_in') + success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in') except: raise osv.except_osv(_('UserError'), _('A sign-in must be right after a sign-out !')) return {} # To do: Return Success message def sign_out(self, cr, uid, data, context=None): - service = netsvc.LocalService('object_proxy') + att_obj = self.pool.get('hr_attendance') emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past')) - service.execute(cr.dbname, uid, 'hr.attendance', 'create', {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id}) + att_obj.create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id}) try: - success = service.execute(cr.dbname, uid, 'hr.employee', 'attendance_action_change', [emp_id], 'sign_out') + success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out') except: raise osv.except_osv(_('UserError'), _('A sign-out must be right after a sign-in !')) return {} # To do: Return Success message From b5462c9b1bf8bafa47998abfb96358c06f285472 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 31 May 2010 13:47:27 +0530 Subject: [PATCH 004/120] [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 From fc672aacedf9e8a7ab09490a8837cd0bf4c733ce Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 31 May 2010 13:53:51 +0530 Subject: [PATCH 005/120] [IMP]: Minor Improvement in yaml file for hr_timesheet_invoice module. bzr revid: atp@tinyerp.co.in-20100531082351-cfgsfdh5wcw3h7vp --- .../test/test_hr_timesheet_invoice.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml index 3cf1a55e96e..431c30d8cb1 100644 --- a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml +++ b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml @@ -17,14 +17,14 @@ unit_amount: 5.00 user_id: base.user_root -- +- | Give partner name and price list in analytic account. - !record {model: account.analytic.account, id: account.analytic_sednacom}: partner_id: base.res_partner_9 pricelist_id: product.list0 -- +- | I create invoice on analytic Line using "Invoice analytic Line" wizard. Give date , detail of each work , time spend on that work on this wizard. - @@ -37,7 +37,7 @@ product: hr_timesheet.product_consultant time: 1 -- +- | I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice. - !python {model: hr.timesheet.invoice.create}: | @@ -67,7 +67,7 @@ product_exp = data['product'] assert product == product_exp -- +- | I creating a final invoice for "Sednacom" analytic account. - !record {model: hr.timesheet.invoice.create.final, id: hr_timesheet_invoice_create_final_0}: @@ -76,7 +76,7 @@ name: 1 price: 1 time: 1 -- +- | I click on "Create Invoice" button to create Invoice. - !python {model: hr.timesheet.invoice.create.final}: | From 65afc2f1f46e95769fb65b217ab254aac0513723 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 31 May 2010 17:55:32 +0530 Subject: [PATCH 006/120] [ADD]: hr_evaluation: add yaml file for hr_evaluation module. bzr revid: atp@tinyerp.co.in-20100531122532-vqkf1mc12xwlt4h6 --- addons/hr_evaluation/__openerp__.py | 4 +- .../hr_evaluation/test/test_hr_evaluation.yml | 152 ++++++++++++++++++ 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 addons/hr_evaluation/test/test_hr_evaluation.yml diff --git a/addons/hr_evaluation/__openerp__.py b/addons/hr_evaluation/__openerp__.py index 36b54b63d0b..f4d0f4ae14f 100644 --- a/addons/hr_evaluation/__openerp__.py +++ b/addons/hr_evaluation/__openerp__.py @@ -35,12 +35,14 @@ is done by the manager.Every evaluation filled by the employees can be viewed in the form of """, "init_xml" : [], - "demo_xml" : ["hr_evaluation_demo.xml"], + "demo_xml" : ["hr_evaluation_demo.xml", + ], "update_xml" : [ "security/ir.model.access.csv", "wizard/hr_evaluation_mail_view.xml", "hr_evaluation_view.xml", "report/hr_evaluation_report_view.xml"], + "test": ["test/test_hr_evaluation.yml"], "active": False, "installable": True } diff --git a/addons/hr_evaluation/test/test_hr_evaluation.yml b/addons/hr_evaluation/test/test_hr_evaluation.yml new file mode 100644 index 00000000000..6e9b11df3bc --- /dev/null +++ b/addons/hr_evaluation/test/test_hr_evaluation.yml @@ -0,0 +1,152 @@ +- | + In order to test hr_evaluation module for OpenERP, I will create plan then create evaluation under that plan. +- + | + Given that I have "R & D" Department for employee. +- + !record {model: hr.department, id: hr_department_rd0}: + manager_id: base.user_root + name: 'R & D ' +- + | + Given that I have Employee “Mark Johnson” which take Interview. + select "R & D" Department. +- + !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 + department_id: 'hr_department_rd0' +- | + I create new employee “Phil Graves ” and select "Mark Johnson" as + Manager. +- + !record {model: hr.employee, id: hr_employee_employee1}: + address_home_id: base.res_partner_address_3000 + company_id: base.main_company + gender: male + name: Phil Graves + user_id: base.user_demo + parent_id: 'hr_employee_employee0' + +- | + I Create "Employee Evaluation" survey for Manager's Evaluation Plan. +- + !record {model: 'survey', id: survey_0}: + title: 'Employee Evaluation' + max_response_limit: 20 + response_user: 2 +- | + I Create "Employee Evaluation" page in "Employee Evaluation" survey. +- + !record {model: 'survey.page', id: survey_employee_page_0}: + title: 'Employee Evaluation' + survey_id: survey_0 +- | + I Create "What is your Name" question in "Employee Evaluation" survey page. +- + !record {model: 'survey.question', id: survey_p_question_0}: + question: 'What is your Name?' + type: 'single_textbox' + sequence: 1 + page_id: survey_employee_page_0 +- | + I Create "What is your gender" Question in "Employee Evaluation" survey page. +- + !record {model: 'survey.question', id: survey_p_question_1}: + question: 'What is your gender?' + type: multiple_choice_only_one_ans + sequence: 2 + is_require_answer: true + page_id: survey_employee_page_0 +- | + I Create "Male" answer in question "What is your gender?" +- + !record {model: 'survey.answer', id: survey_p_1_1}: + answer: 'Male' + sequence: 1 + question_id : survey_p_question_1 +- | + I Create "Female" answer in question "What is your gender?" +- + !record {model: 'survey.answer', id: survey_p_1_2}: + answer: 'Female' + sequence: 2 + question_id : survey_p_question_1 + +- | + Now Survey set in open state. +- + !python {model: survey}: | + self.survey_open(cr, uid, [ref("survey_0")], context) + +- | + I creating a Evaluation plan and select "Employee Evaluation" survey for "Send to Subordinates" and "Final interview with Manager" Phase. +- + !record {model: hr_evaluation.plan, id: hr_evaluation_plan_managersplan0}: + company_id: base.main_company + month_first: 3 + month_next: 6 + name: Manager's Plan + phase_ids: + - action: bottom-up + name: Send to Subordinates + survey_id: 'survey_0' + - action: top-down + name: Final Interview with manager + sequence: 2 + survey_id: 'survey_0' + +- | + Now I create Evaluation for "Phil Graves" Employee under "Manager Evaluation Plan". +- + !record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}: + date: '2010-06-28' + employee_id: 'hr_employee_employee1' + plan_id: 'hr_evaluation_plan_managersplan0' + progress: 0.0 + state: draft +- | + I check that Evaluation is in "Draft" state. +- + !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}: + - state == 'draft' +- | + I start Evaluation process by click on "Start Evaluation" button. +- + !python {model: hr_evaluation.evaluation}: | + self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')]) + +- | + After that Manager Evaluation plan is In Progress. + I close this servey request by giving answer of survey question. +- + !python {model: hr.evaluation.interview}: | + self.survey_req_done(cr, uid, [ref('hr_evaluation_evaluation_0')]) +- | + I click on "Final Validation" button to finalize Evaluation. +- + !python {model: hr_evaluation.evaluation}: | + self.button_final_validation(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")], + {"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]}) + +- | + I check that state is "Final Validation". +- + !assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}: + - state == 'progress' +- | + Give Rating "Meet expectations" by selecting overall Rating. +- + !record {model: hr_evaluation.evaluation, id: hr_evaluation.hr_evaluation_evaluation_0}: + rating: '2' + +- | + I close this Evaluation by click on "Done" button of this wizard. +- + !python {model: hr_evaluation.evaluation}: | + self.button_done(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")], {"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]}) + \ No newline at end of file From 77d67280068dfe30eafc03c08fa2cec6e954a5c3 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 31 May 2010 17:59:43 +0530 Subject: [PATCH 007/120] [ADD]: hr_timesheet_sheet: develop yaml for hr_timesheet_sheet module. bzr revid: atp@tinyerp.co.in-20100531122943-5vc1sbbecjn98pwf --- addons/hr_timesheet_sheet/__openerp__.py | 5 +- .../hr_timesheet_sheet/hr_timesheet_sheet.py | 3 + .../test/test_hr_timesheet_sheet.yml | 139 ++++++++++++++++++ 3 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml diff --git a/addons/hr_timesheet_sheet/__openerp__.py b/addons/hr_timesheet_sheet/__openerp__.py index 997b9f74898..2b247969821 100644 --- a/addons/hr_timesheet_sheet/__openerp__.py +++ b/addons/hr_timesheet_sheet/__openerp__.py @@ -55,7 +55,10 @@ The validation can be configured in the company: 'process/hr_timesheet_sheet_process.xml', 'report/timesheet_report_view.xml', ], - 'demo_xml': ['hr_timesheet_sheet_demo.xml'], + 'demo_xml': ['hr_timesheet_sheet_demo.xml', + 'test/test_hr_timesheet_sheet.yml' + ], + 'test':[], 'installable': True, 'active': False, 'certificate': '0073297700829', diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 5ace7f64ebd..c1302a7061d 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -151,13 +151,16 @@ class hr_timesheet_sheet(osv.osv): raise osv.except_osv(_('Error !'), _('You can not duplicate a timesheet !')) def button_confirm(self, cr, uid, ids, context=None): + if context is None: context = {} for sheet in self.browse(cr, uid, ids, context=context): di = sheet.user_id.company_id.timesheet_max_difference + if (abs(sheet.total_difference) < di) or not di: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'hr_timesheet_sheet.sheet', sheet.id, 'confirm', cr) + else: raise osv.except_osv(_('Warning !'), _('Please verify that the total difference of the sheet is lower than %.2f !') %(di,)) return True diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml new file mode 100644 index 00000000000..bb163b3c68e --- /dev/null +++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml @@ -0,0 +1,139 @@ +- | + In order, to test hr_timesheet_sheet module in OpenERP, I create timesheet and check validation process done by + manager. + +- | + 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 create new user "user1". +- + !record {model: res.users, id: res_users_user0}: + company_id: base.main_company + context_lang: en_US + groups_id: + - hr.group_hr_user + - hr_attendance.group_hr_attendance + - base.group_user + - base.group_extended + - hr.group_hr_manager + login: user1 + name: user1 + password: user1 + +- | + create another employee "Francline" as "user1". +- + !record {model: hr.employee, id: hr_employee_fracline0}: + address_home_id: base.res_partner_address_8 + name: Francline + parent_id: 'hr_employee_employee0' + user_id: 'res_users_user0' + +- | + Given that I have Timesheet journal for employee. + +- + !record {model: account.analytic.journal, id: analytic_journal}: + code: TS + name: Timesheet Journal + type: general + +- | + 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}: + product_id: product_consultant + journal_id: analytic_journal +- | + And also assing product and journal to "francline" employee. +- + !record {model: hr.employee, id: hr_employee_fracline0}: + product_id: product_consultant + journal_id: analytic_journal + +- | + I connect as "francline" and create my current timesheet. +- + !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}: + date_current: '2010-05-26' + date_from: '2010-05-01' + date_to: '2010-05-31' + name: Week-22(2010) + state: new + user_id: 'res_users_user0' +- | + Now , When I came in office , I create Attendances and perform "Sign In" action with proper reason. +- + !record {model: hr.attendance, id: hr_attendance_0}: + action: sign_in + employee_id: 'hr_employee_fracline0' + name: '2010-05-26 10:08:08' + +- | + When I left office , I create attendance and perform "Sign Out". +- + !record {model: hr.attendance, id: hr_attendance_1}: + action: sign_out + employee_id: 'hr_employee_fracline0' + name: '2010-05-26 15:10:55' + +- + I create Timesheet Entry for time spend on today work. +- + + !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet.sheet1}: + timesheet_ids: + - account_id: account.analytic_sednacom + date: '05/26/2010' + name: 'Develop yaml for hr module' + unit_amount: 5.00 + amount: -90.00 + product_id: hr_timesheet.product_consultant + general_account_id: account.a_expense + user_id: res_users_user0 + journal_id: hr_timesheet.analytic_journal + +- | + I confirm my timesheet at end of period by click on "Confirm" button which is signal of workflow. +- + !python {model: hr_timesheet_sheet.sheet}: | + uid = ref('res_users_user0') + self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')]) +- | + I check that state is "Confirmed". +- + !assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}: + - state == 'confirm' +- | + "Mark Johnson" check timesheet and time spend on project by "francline" employee. + And then accept it request by click on "Accept" button. + If "Maximal difference between timesheet and attendances" is more than 1 then manage can "Refuse" his request. +- + !python {model: hr_timesheet_sheet.sheet}: | + #self.write(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {'state': 'done'}) + \ No newline at end of file From 71ce875c62786a526476aee9137dc8e2e4aa0a40 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Tue, 1 Jun 2010 11:43:10 +0530 Subject: [PATCH 008/120] [IMP]: hr_timesheet_sheet: add yaml file in test tag in __openerp__.py file inplace of demo. bzr revid: atp@tinyerp.co.in-20100601061310-ftn7jw8t57y83qkk --- addons/hr_timesheet_sheet/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/__openerp__.py b/addons/hr_timesheet_sheet/__openerp__.py index 2b247969821..fb1d4696939 100644 --- a/addons/hr_timesheet_sheet/__openerp__.py +++ b/addons/hr_timesheet_sheet/__openerp__.py @@ -56,9 +56,9 @@ The validation can be configured in the company: 'report/timesheet_report_view.xml', ], 'demo_xml': ['hr_timesheet_sheet_demo.xml', - 'test/test_hr_timesheet_sheet.yml' + ], - 'test':[], + 'test':['test/test_hr_timesheet_sheet.yml'], 'installable': True, 'active': False, 'certificate': '0073297700829', From 7538b0a2802c9e6a3c84c4bc2f6be3428c121a3a Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Wed, 2 Jun 2010 16:28:32 +0530 Subject: [PATCH 009/120] Task-ID 847 :sends an email to the scrum master and/or the product owner with the detail of the scrum daily meeting and add the missing demo data bzr revid: sbh@tinyerp.com-20100602105832-u3stwm4astvzh23o --- addons/scrum/scrum.py | 40 +++++++++++++++++++++ addons/scrum/scrum_demo.xml | 72 +++++++++++++++++++++++++++++++++++-- addons/scrum/scrum_view.xml | 3 ++ 3 files changed, 113 insertions(+), 2 deletions(-) diff --git a/addons/scrum/scrum.py b/addons/scrum/scrum.py index bccc991565f..9339b0cd622 100644 --- a/addons/scrum/scrum.py +++ b/addons/scrum/scrum.py @@ -24,6 +24,8 @@ import netsvc from osv import fields, osv, orm from mx import DateTime import re +import tools +from tools.translate import _ class scrum_project(osv.osv): _inherit = 'project.project' @@ -287,5 +289,43 @@ class scrum_meeting(osv.osv): _defaults = { 'date' : time.strftime('%Y-%m-%d'), } + + def button_send_to_master(self, cr, uid, ids, context={}): + meeting_id=self.browse(cr,uid,ids)[0] + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) + email=meeting_id and meeting_id.sprint_id.scrum_master_id.user_email + body = "" + if email: + self.email_send(cr,uid,ids,email) + else: + raise osv.except_osv(_('Warining !'), _('%s User no Email Address!' % meeting_id.sprint_id.scrum_master_id.name)) + return True + + + + def button_send_product_owner(self, cr, uid, ids, context={}): + meeting_id=self.browse(cr,uid,ids)[0] + email=meeting_id.sprint_id.product_owner_id.user_email + if email: + self.email_send(cr,uid,ids,email) + else: + raise osv.except_osv(_('Warining !'), _('%s User no Email Address!' % meeting_id.sprint_id.scrum_master_id.name)) + + return True + + def email_send(self, cr, uid, ids,email, context={}): + email_from=tools.config.get('email_from', False) + meeting_id=self.browse(cr,uid,ids)[0] + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) + user_email= email_from or user.address_id.email or email_from + body="" + + body+="Hello " + meeting_id.sprint_id.scrum_master_id.name+",\n" +" \n Daily Meeting Details of date %s for the Sprint %s " % (meeting_id.date, meeting_id.sprint_id.name) + body += '\n\nDate :%s' % (meeting_id.date) + '\n\nTasks since yesterday \n\n:%s' % (meeting_id.question_yesterday) + '\n\n Task for Today :\n\n%s' % (meeting_id.question_today )+ '\n\n Blocks encountered \n :%s' % (meeting_id.question_blocks or 'No Blocks') + body+="'\n\nThanks\n"+ user.name + sub_name=meeting_id.name or 'Scrum Meeting of %s '%meeting_id.date + tools.email_send(user_email , [email],sub_name, body, reply_to=None,openobject_id = str(meeting_id.id)) + return True + scrum_meeting() diff --git a/addons/scrum/scrum_demo.xml b/addons/scrum/scrum_demo.xml index 9f41f17a86b..34f3991894b 100644 --- a/addons/scrum/scrum_demo.xml +++ b/addons/scrum/scrum_demo.xml @@ -32,6 +32,7 @@ 6.0 This new system will enable you to migrate automatically from an old version of Open ERP to a new one. This system will migrate not only the Open ERP system but also the customers particularities. This happens without any kind of script or programming. It has been possible to carry out such a system thanks to the descriptive approach of Open ERP components. + done @@ -40,6 +41,7 @@ 111.0 The accounting module of Open ERP (financial accounting and management accounting) is being reshaped. New functionnalities will be added: intangible assets, a new way of presenting ledgers and bookings, new stock valuation calculation, and lots of predefined reports. + open @@ -48,18 +50,21 @@ 4.0 We have to develop a plug-in system which will enable to install/remove modules. The basic version of Open ERP will include only the required minimum, and you will select the modules thanks to the plug-in manager. This allows you to limit your system to your real needs: quality management, localisations, project and service management, marketing campaigns, and so on... + open Review all terms 8.0 + done Bugfixes 6.0 + open @@ -74,6 +79,7 @@ 4.0 Restrucutre the Open ERP menu to be more like others ERP. + open @@ -91,6 +97,8 @@ Review all English Terms + done + @@ -98,6 +106,8 @@ Review all french terms + done + @@ -105,6 +115,8 @@ Analytic Accounting features + done + @@ -112,6 +124,7 @@ Test and improve automatic migration system + open @@ -119,6 +132,7 @@ General accounting features + open @@ -133,7 +147,9 @@ Cash book, general ledger, accounts list, aged trial balance - Accounting Report General + Accounting Report General + open + @@ -148,6 +164,7 @@ Accounting Report Analytic + open @@ -155,6 +172,8 @@ Bugfix - memory leak + done + @@ -162,6 +181,8 @@ Bugfix - Translations + open + @@ -169,6 +190,7 @@ Finish the automated plugin system + pending @@ -183,6 +205,7 @@ Test 3.2.0 before releasing + open @@ -191,8 +214,53 @@ default values, onchange, required, add on top or bottom and shortcuts (Ctrl S, Ctrl X, ...) Editable trees + open - + + +@MRA: review work of team member check backlogs account reconcile process +@PSI: Account Modules YAML case => running + + +@MRA: review and check work of team +@PSI: Account Modules YAML case == continue + + 2010-06-02 + + + + Learn how to migration + + + + 2010-06-02 14:09:49 + + + + Create a script for migration and testing + + + + 2010-06-02 14:13:13 + + + + + Create a script for migration and testing + + + + 2010-06-02 14:13:13 + + + + Add on top or bottom and shortcuts + + + + 2010-06-02 14:13:13 + + diff --git a/addons/scrum/scrum_view.xml b/addons/scrum/scrum_view.xml index dc015c3f38a..a33774e44f4 100644 --- a/addons/scrum/scrum_view.xml +++ b/addons/scrum/scrum_view.xml @@ -328,6 +328,9 @@ + +