-
  I test "Payslip" in order to check the hr_payroll module in OpenERP
-
  I create a new employee "Richard"
-
  !record {model: hr.employee, id: hr_employee_richard0}:
    birthday: '1984-05-01'
    country_id: base.be
    department_id: hr.dep_rd
    gender: male
    name: Richard
-
  I create a salary structure for "Software Developer"
-
  !record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper}:
    name: Salary Structure for Software Developer
    code: SD
    company_id: base.main_company
    rule_ids:
      - hr_salary_rule_houserentallowance1
      - hr_salary_rule_convanceallowance1
      - hr_salary_rule_professionaltax1
      - hr_salary_rule_providentfund1
      - hr_salary_rule_meal_voucher
      - hr_salary_rule_sales_commission
-
  I create a contract for "Richard"
-
  !record {model: hr.contract, id: hr_contract_richard}:
    date_end: !eval "(datetime.now() + timedelta(days=365)).strftime('%Y-%m-%d')"
    date_start: !eval time.strftime('%Y-%m-%d')
    name: Contract for Richard
    wage: 5000.0
    type_id: hr_contract.hr_contract_type_emp
    employee_id: hr_employee_richard0
    struct_id: hr_payroll_structure_softwaredeveloper
    working_hours: resource.timesheet_group1
-
  I create a Employee Payslip
-
  !record {model: hr.payslip, id: hr_payslip_0}:
    employee_id: hr_payroll.hr_employee_richard0
-
  I assign the amount to Input data
-
  !python {model: hr.payslip.input}: |
    ids = self.search(cr, uid, [('payslip_id', '=', ref("hr_payslip_0"))])
    self.write(cr, uid, ids, {'amount': 5.0})
-
  I verify the payslip is in draft state
-
  !python {model: hr.payslip}: |
    payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
    assert (payslip_brw.state == 'draft'), 'State not changed!'
-
  I click on 'Compute Sheet' button on payslip
-
  !python {model: hr.payslip}: |
    self.compute_sheet(cr, uid, [ref("hr_payslip_0")], {"lang": "en_US", "tz": False,
      "active_model": "ir.ui.menu", "department_id": False, "active_ids": [ref("hr_payroll.menu_department_tree")],
      "section_id": False, "active_id": ref("hr_payroll.menu_department_tree"),
      })
-
  Then I click on the 'Confirm' button on payslip
-
  !workflow {model: hr.payslip, action: hr_verify_sheet, ref: hr_payslip_0}
-
  I verify that the payslip is in done state
-
  !python {model: hr.payslip}: |
    from tools.translate import _
    payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
    assert(payslip_brw.state == 'done'), _('State not changed!')
-
  I want to check refund payslip so I click on refund button.
-
  !python {model: hr.payslip}: |
    self.refund_sheet(cr, uid, [ref("hr_payslip_0")], None)
-
  I check on new payslip Credit Note is checked or not.
-
  !python {model: hr.payslip}: |
    payslip_obj = self.browse(cr, uid, ref("hr_payslip_0"), None)
    payslip_ids = self.search(cr, uid, [('name','like','Refund: '+payslip_obj.name),('credit_note','=',True)], None)
    assert payslip_ids, "Payslip not refunded!"
-
  I want to generate a payslip from Payslip run.
-
  !record {model: hr.payslip.run, id: hr_payslip_run_PayslipforEmployee0}:
    date_end: '2011-09-30'
    date_start: '2011-09-01'
    name: Payslip for Employee
-
  I create record for generating the payslip for this Payslip run.
-
  !record {model: hr.payslip.employees, id: hr_payslip_employees0}:
    employee_ids:
      - hr_employee_richard0
-
  I generate the payslip by clicking on Generat button wizard.
-
  !python {model: hr.payslip.employees}: |
     self.compute_sheet(cr, uid, [ref('hr_payslip_employees0')], context={'active_id': ref('hr_payslip_run_PayslipforEmployee0')})
-
  I open Contribution Register and from there I print the Payslip Lines report.
-
  !record {model: payslip.lines.contribution.register, id: payslip_lines_contribution_register0}:
    date_from: '2011-09-30'
    date_to: '2011-09-01'
-
  I print the report.
-
  !python {model: payslip.lines.contribution.register}: |
    self.print_report(cr, uid, [ref('payslip_lines_contribution_register0')], context={'active_ids': [ref('hr_houserent_register')]})

