diff --git a/addons/hr_evaluation/test/test_hr_evaluation.yml b/addons/hr_evaluation/test/test_hr_evaluation.yml index 6e9b11df3bc..cdee65dde26 100644 --- a/addons/hr_evaluation/test/test_hr_evaluation.yml +++ b/addons/hr_evaluation/test/test_hr_evaluation.yml @@ -1,16 +1,14 @@ -- | +- 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. -- + + I create new Department. +- !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. + name: 'R & D' +- + I create a new employee. - !record {model: hr.employee, id: hr_employee_employee0}: address_home_id: base.res_partner_address_1 @@ -20,32 +18,31 @@ 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. -- +- + I create another new employee and assign first one as it's 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 + name: Phil Graves user_id: base.user_demo parent_id: 'hr_employee_employee0' -- | - I Create "Employee Evaluation" survey for Manager's Evaluation Plan. +- + I Create an "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. +- + I Create an "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}: @@ -53,7 +50,7 @@ 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}: @@ -62,30 +59,30 @@ 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. + +- + I set the survey 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. -- +- + I create an 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 @@ -99,54 +96,52 @@ name: Final Interview with manager sequence: 2 survey_id: 'survey_0' - -- | - Now I create Evaluation for "Phil Graves" Employee under "Manager Evaluation Plan". -- + +- + I create an Evaluation for 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. +- + 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. + - state == 'draft' +- + I start the 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')]) + 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. +- + 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. -- +- + I click on "Final Validation" button to finalise 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' -- | + !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 diff --git a/addons/hr_expense/test/test_hr_expense.yml b/addons/hr_expense/test/test_hr_expense.yml index 70e2bfb874d..5fa0175eba1 100644 --- a/addons/hr_expense/test/test_hr_expense.yml +++ b/addons/hr_expense/test/test_hr_expense.yml @@ -1,27 +1,27 @@ -- | - In order to test hr_expenses for OpenERP, I create expense for employee and manage employee's expenses. -- | - Creating unit of measure category "Working Time". +- + In order to test hr_expenses for OpenERP, I create expenses for employee and manage employee's expenses. +- + I create an unit of measure category "Working Time". - !record {model: product.uom.categ, id: product_uom_categ_workingtime0}: name: Working Time. -- | - Given that I have employee "Marc John" and his address. +- + I create a new employee. - !record {model: hr.employee, id: hr.employee1}: address_home_id: base.res_partner_address_1 address_id: base.main_address -- | - I create product unit of measure "Hour". +- + I create product unit of measure "Hour". - !record {model: product.uom, id: product_uom_hour0}: category_id: 'product_uom_categ_workingtime0' factor: 8.0 name: Hour rounding: 0.01 -- | - Creating a product "travel" and select uom "Hour" and category "Working Time". +- + I Create a product "travel". - !record {model: product.product, id: product_product_travel0}: categ_id: product.product_category_services @@ -41,8 +41,8 @@ weight: 0.0 weight_net: 0.0 -- | - Now I create Expense "September Expenses" for Marc John.And select product "travel". +- + I create an expense. - !record {model: hr.expense.expense, id: hr_expense_expense_september0}: company_id: base.main_company @@ -58,38 +58,38 @@ uom_id: product.product_uom_unit unit_amount: 700.0 user_id: base.user_root -- | - I check that expenses on "draft" state. +- + I check that expense is in "Draft" state. - !assert {model: hr.expense.expense, id: hr_expense_expense_september0}: - state == 'draft' -- | +- I confirm this expenses by click on "Confirm" button. - !workflow {model: hr.expense.expense, action: confirm, ref: hr_expense_expense_september0} -- | +- I check that state is "Waiting Confirmation". - !assert {model: hr.expense.expense, id: hr_expense_expense_september0}: - state == 'confirm' -- | +- I accept this expense by click on "Accept" button. - !workflow {model: hr.expense.expense, action: validate, ref: hr_expense_expense_september0} -- | +- I invoiced this expenses by click on "Invoice" button. - !workflow {model: hr.expense.expense, action: invoice, ref: hr_expense_expense_september0} -- | +- I check that state is "Invoiced" - !assert {model: hr.expense.expense, id: hr_expense_expense_september0}: - state == 'invoiced' -- | - Now I check that Invoice is created for that expenses. +- + I check that Invoice is created for the expense. - !python {model: hr.expense.expense}: | exp = self.browse(cr, uid, [ref('hr_expense_expense_september0')])[0] diff --git a/addons/hr_payroll/hr_payroll_demo.xml b/addons/hr_payroll/hr_payroll_demo.xml index 2d77c1d820e..9c2ce90cd7a 100644 --- a/addons/hr_payroll/hr_payroll_demo.xml +++ b/addons/hr_payroll/hr_payroll_demo.xml @@ -8,6 +8,7 @@ Marketing Executive + per @@ -19,6 +20,7 @@ House Rant Allowance + fix @@ -30,6 +32,7 @@ Convance Allowance + fix @@ -41,6 +44,7 @@ Professional Tax + per @@ -52,7 +56,7 @@ Provident Fund - + @@ -62,7 +66,7 @@ Bonamy user - + @@ -74,7 +78,7 @@ - + SLIP/001 @@ -87,6 +91,6 @@ Salary Slip of Bonamy for June-2010 - + diff --git a/addons/hr_payroll/test/payment_advice.yml b/addons/hr_payroll/test/payment_advice.yml index de86d8c27be..a2a9c3d5dbe 100644 --- a/addons/hr_payroll/test/payment_advice.yml +++ b/addons/hr_payroll/test/payment_advice.yml @@ -2,7 +2,7 @@ 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 @@ -27,8 +27,8 @@ salary_account: account.a_recv vehicle_distance: 0.0 - - Then I create a new payment advice record -- + I create a new payment advice record +- !record {model: hr.payroll.advice, id: hr_payroll_advice_advice0}: account_id: account.cash line_ids: @@ -38,15 +38,15 @@ flag: C name: Axis Bank name: advice1 -- - In order to confirm a sheet I click on "Confirm Sheet" button -- +- + I confirmed the sheet by 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 + I check that a state is "Confirm" - !python {model: hr.payroll.advice}: | from tools.translate import _ diff --git a/addons/hr_payroll/test/payroll_register.yml b/addons/hr_payroll/test/payroll_register.yml index 317ad40ac32..f5772602db4 100644 --- a/addons/hr_payroll/test/payroll_register.yml +++ b/addons/hr_payroll/test/payroll_register.yml @@ -2,7 +2,7 @@ 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 @@ -27,7 +27,7 @@ salary_account: account.a_recv vehicle_distance: 0.0 - - I create a payroll register record + I create a payroll register record. - !record {model: hr.payroll.register, id: hr_payroll_register_payroll0}: bank_journal_id: account.bank_journal @@ -38,8 +38,8 @@ bank_journal_id: account.bank_journal journal_id: account.expenses_journal name: payroll1 -- - I click on Compute button +- + I click on Compute button. - !python {model: hr.payroll.register}: | self.compute_sheet(cr, uid, [ref("hr_payroll_register_payroll0")], {"lang": "en_US", @@ -47,7 +47,7 @@ [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 + 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", @@ -60,4 +60,4 @@ !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!') + 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 index 1ecab075da0..f1c860f8edd 100644 --- a/addons/hr_payroll/test/payslip.yml +++ b/addons/hr_payroll/test/payslip.yml @@ -1,8 +1,16 @@ - 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 + state: bank - 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 @@ -24,10 +32,11 @@ name: Richard pg_joining: '2009-12-01' property_bank_account: account.cash + bank_account_id: res_partner_bank_0 salary_account: account.a_recv vehicle_distance: 0.0 - - I create a new payroll structure for software developer + I create a new payroll structure for software developer - !record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper0}: code: SD @@ -75,58 +84,60 @@ 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} -- +- + 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 an order which was in the "New Slip" state has transit to "Wating for Verification" state + 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!') + assert(payslip_brw.state == 'draft'), _('State not changed!') +- + I click on Verify Sheet button. - - 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 + 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!') + assert(payslip_brw.state == 'hr_check'), _('State not changed!') - - Then I click on Complete HR Checking button + 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 + 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!') -- - Then I click on Pay Salary button -- + 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 an order which was in the "Confirm Sheet" state has transit to "Paid Salary" state + 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!') + assert(payslip_brw.state == 'done'), _('State not changed!') diff --git a/addons/hr_recruitment/test/test_hr_recruitment.yml b/addons/hr_recruitment/test/test_hr_recruitment.yml index 3b865efe113..f5689b67787 100644 --- a/addons/hr_recruitment/test/test_hr_recruitment.yml +++ b/addons/hr_recruitment/test/test_hr_recruitment.yml @@ -1,91 +1,86 @@ -- | - In order to test hr_recruitment module for OpenERP, I will create applicants form, Manages job positions and the recruitement process. -- | - I create job position for employee to manage job position. - - | - For that First I create Department "R & D" in Department form for which I make recruitment. -- + In order to test hr_recruitment module for OpenERP, I will create applicants form, Manages job positions and the recruitment process. +- + + I create a department. +- !record {model: hr.department, id: hr_department_rd0}: manager_id: base.user_root name: 'R & D ' - -- | - Now I will create new Job Position. I will check successfull creation of new Job Position by adding the information. -- + +- + I create new Job Position. +- !record {model: hr.job, id: hr_job_jea0}: department_id: 'hr_department_rd0' - description: 'Position of Junier Application Engineer ' + description: 'Position of Jr. Application Engineer' expected_employees: 5 - name: 'JEA ' -- | - Given that I have stage "Initial Jobs Demand". -- + name: 'JAE ' +- + I create a recruitment stage "Initial Jobs Demand". +- !record {model: hr.recruitment.stage, id: hr_recrutiment_stage_first0}: name: 'Initial Jobs Demand' - sequence: 1 -- | - I create applicants for "Fresher" and specify job information for that applicant. -- + sequence: 1 +- + I create an applicant. +- !record {model: hr.applicant, id: hr_applicant_fresher0}: availability: 0.0 department_id: hr.dep_it name: Fresher partner_address_id: base.res_partner_address_tang partner_id: base.res_partner_asus - partner_name: Jose - partner_phone: '999666735' + partner_name: Marion Jones + partner_phone: '1111112223' response: 0.0 salary_expected: 0.0 salary_proposed: 0.0 - stage_id: crm.stage_lead3 - type_id: hr_recruitment.type_job2 - stage_id: hr_recrutiment_stage_first0 - -- | - I check that applicant is on "draft" state. + stage_id: hr_recrutiment_stage_first0 + type_id: hr_recruitment.degree_licenced + +- + I check that applicant is on "draft" state. - !assert {model: hr.applicant, id: hr_applicant_fresher0}: - - state == 'draft' - -- | - I start progress by click on "In Progress" button. -- + - state == 'draft' + +- + I change the state by click on "In Progress" button. +- !python {model: hr.applicant}: | self.case_open(cr, uid, [ref("hr_applicant_fresher0")], {"active_ids": [ref("hr_recruitment.menu_crm_case_categ0_act_job")], - }) + }) -- | - Given that I have case category "Employee". +- + I create a new case category. - !record {model: crm.case.categ, id: crm_case_categ_employee0}: name: 'Employee' - -- | - I make phonecall for this applicant by click on "Schedule a Phone Call" button. + - - !record {model: hr.recruitment.job2phonecall, id: hr_recruitment_forinterview0}: + I schedule a phonecall for this applicant by click on "Schedule a Phone Call" button. +- + !record {model: hr.recruitment.job2phonecall, id: hr_recruitment_forinterview0}: user_id: base.user_root deadline: '05/28/2010 11:51:00' note: 'For interview.' category_id: 'crm_case_categ_employee0' - -- | + +- I click on "Schedule phonecall" button of this wizard. - !python {model: hr.recruitment.job2phonecall}: | - self.make_phonecall(cr, uid, [ref('hr_recruitment_forinterview0')], {'active_ids': [ref('hr_applicant_fresher0')]}) - -- | - I schedule meeting for interview of this applicant by click on "Schdule Meeting" button. -- + self.make_phonecall(cr, uid, [ref('hr_recruitment_forinterview0')], {'active_ids': [ref('hr_applicant_fresher0')]}) + +- + I schedule meeting for interview of this applicant by click on "Schedule Meeting" button. +- !python {model: hr.applicant}: | self.action_makeMeeting(cr, uid, [ref('hr_recruitment_forinterview0')]) -- | - I can see that Meeting's calendar view is shown. - then I click on the date on which I want schedule meeting. - I fill proper data for that meeting and save it. -- +- + I create an entry for the meeting with the applicant. +- !record {model: crm.meeting, id: crm_meeting_fresher0}: alarm_id: base_calendar.alarm1 count: 0.0 @@ -101,15 +96,14 @@ rrule_type: none state: open user_id: base.user_root - -- | - After Meeting of this applicant , I hired employee by click on "Hired" button of this form. -- + +- + On a successful meeting with the applicant, I hired employee by click on "Hired" button. +- !python {model: hr.applicant}: | self.case_close(cr, uid, [ref('hr_applicant_fresher0')]) -- | - I check that applicant state is "done". +- + I check that applicant state is "Hired". - !assert {model: hr.applicant, id: hr_applicant_fresher0}: - state == 'done' - \ No newline at end of file diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index a848fc6d352..730adebe049 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -154,9 +154,10 @@ class account_invoice(osv.osv): inv = self.browse(cr, uid, [id])[0] if inv.type == 'in_invoice': + obj_analytic_account = self.pool.get('account.analytic.account') for il in iml: if il['account_analytic_id']: - to_invoice = self.pool.get('account.analytic.account').read(cr, uid, [il['account_analytic_id']], ['to_invoice'])[0]['to_invoice'] + to_invoice = obj_analytic_account.read(cr, uid, [il['account_analytic_id']], ['to_invoice'])[0]['to_invoice'] if to_invoice: il['analytic_lines'][0][2]['to_invoice'] = to_invoice[0] return iml 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 431c30d8cb1..51d507f1df0 100644 --- a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml +++ b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml @@ -1,8 +1,8 @@ -- | +- 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. -- +- + I create an account analytic line. +- !record {model: account.analytic.line, id: account_analytic_line_developyamlforhrmodule0}: account_id: account.analytic_sednacom amount: -1.0 @@ -17,17 +17,16 @@ unit_amount: 5.00 user_id: base.user_root -- | - Give partner name and price list in analytic account. -- +- + Assign 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 @@ -36,54 +35,50 @@ 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. + +- + I check that Invoice is created 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. -- +- + I create final invoice for this 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. -- +- + 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 + +- + 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 1ed01c53281..57a1e4aaaa2 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -166,7 +166,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 IN %s AND product_id=%s and to_invoice=%s ORDER BY account_analytic_line.date", (account.id, tuple(data['ids']), product_id, factor_id)) + cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id IN %s AND product_id=%s and to_invoice=%s ORDER BY account_analytic_line.date", (account.id, tuple(context['active_ids']), product_id, factor_id)) line_ids = cr.dictfetchall() note = [] @@ -188,7 +188,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note)) invoice_line_obj.create(cr, uid, curr_line, context=context) - cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id IN %s" ,(last_invoice, account.id,tuple(data['ids']))) + cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id IN %s" ,(last_invoice, account.id, tuple(context['active_ids']))) invoice_obj.button_reset_taxes(cr, uid, [last_invoice], context) diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml index c21a5b36ebb..1486d7f9bb4 100644 --- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml +++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml @@ -99,6 +99,7 @@ - !python {model: hr_timesheet_sheet.sheet}: | uid = ref('base.user_root') + import netsvc for sheet in self.browse(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')]): di = sheet.user_id.company_id.timesheet_max_difference if (abs(sheet.total_difference) < di) or not di: