49 lines
2.1 KiB
YAML
49 lines
2.1 KiB
YAML
-
|
|
In order to test the process of "Employee Expenses" by processing the expenses, I confirm Expense Bill of an employee for September month.
|
|
-
|
|
!workflow {model: hr.expense.expense, action: confirm, ref: sep_expenses}
|
|
-
|
|
I check that state is 'Confirm'.
|
|
-
|
|
!assert {model: hr.expense.expense, id: sep_expenses, severity: error, string: Expense should be in Confirm state}:
|
|
- state == 'confirm'
|
|
-
|
|
I approve the September expenses.
|
|
-
|
|
!workflow {model: hr.expense.expense, action: validate, ref: sep_expenses}
|
|
-
|
|
I check that state is 'Approved'
|
|
-
|
|
!assert {model: hr.expense.expense, id: sep_expenses, severity: error, string: Expense should be in Approved state}:
|
|
- state == 'accepted'
|
|
-
|
|
I make Receipt for the expense.
|
|
-
|
|
!workflow {model: hr.expense.expense, action: done, ref: sep_expenses}
|
|
-
|
|
I check receipt details.
|
|
-
|
|
!python {model: hr.expense.expense}: |
|
|
sep_expenses = self.browse(cr, uid, ref("sep_expenses"), context=context)
|
|
assert sep_expenses.state == 'done', "Expense should be in 'Done' state."
|
|
assert sep_expenses.voucher_id, "Expense should have link of Purchase Receipt."
|
|
assert sep_expenses.voucher_id.type == 'purchase', "Receipt type is not purchase receipt."
|
|
assert sep_expenses.voucher_id.amount == sep_expenses.amount,"Receipt total amount is not correspond with expense total."
|
|
assert len(sep_expenses.voucher_id.line_dr_ids) == len(sep_expenses.line_ids),"Lines of Receipt and expense line are not correspond."
|
|
|
|
-
|
|
I duplicate the expenses and cancel duplicated.
|
|
-
|
|
!python {model: hr.expense.expense}: |
|
|
duplicate_id = self.copy(cr, uid, ref('sep_expenses'), context=context)
|
|
self.expense_canceled(cr, uid, [duplicate_id])
|
|
-
|
|
I print a report of the expenses.
|
|
-
|
|
!python {model: hr.expense.expense}: |
|
|
import os
|
|
from openerp import netsvc, tools
|
|
(data, format) = netsvc.LocalService('report.hr.expense').create(cr, uid, [ref('hr_expense.sep_expenses')], {}, {})
|
|
if tools.config['test_report_directory']:
|
|
file(os.path.join(tools.config['test_report_directory'], 'hr_expense-report.'+format), 'wb+').write(data)
|