odoo/addons/hr_expense/test/expense_process.yml

44 lines
1.6 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."
-
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)