'checking the process of payslip.'

def test_00_hr_payslip(self):

    date_from = time.strftime('%Y-%m-01')
    date_to = str((datetime.now() + relativedelta.relativedelta(months=(+ 1), day=1, days=(-1))))[:10]
    res = self.hr_payslip.onchange_employee_id(date_from, date_to, self.hr_employee_john.id)
    vals = {'struct_id': res['value']['struct_id'], 'contract_id': res['value']['contract_id'], 'name': res['value']['name']}
    vals['worked_days_line_ids'] = [(0, 0, i) for i in res['value']['worked_days_line_ids']]
    vals['input_line_ids'] = [(0, 0, i) for i in res['value']['input_line_ids']]
    vals.update({'contract_id': self.hr_contract_john.id})
    self.hr_payslip.write(vals)
    payslip_input = self.env['hr.payslip.input'].search([('payslip_id', '=', self.hr_payslip.id)])
    payslip_input.write({'amount': 5.0})
    self.assertEqual(self.hr_payslip.state, 'draft', 'State    not    changed!')
    context = {'lang': 'en_US', 'tz': False, 'active_model': 'hr.payslip', 'department_id': False, 'active_ids': [self.payslip_action_id], 'section_id': False, 'active_id': self.payslip_action_id}
    self.hr_payslip.with_context(context).compute_sheet()
    self.hr_payslip.action_payslip_cancel()
    self.assertEqual(self.hr_payslip.state, 'cancel', 'Payslip    is    rejected.')
    self.hr_payslip.action_payslip_draft()
    self.hr_payslip.action_payslip_done()
    self.assertTrue(self.hr_payslip.move_id, 'Accounting    Entries    has    not    been    created')
    self.assertEqual(self.hr_payslip.state, 'done', 'State    not    changed!')
