[IMP] hr_expense: improve test case of expense process

bzr revid: jap@tinyerp.com-20111208061546-iuy49ixlowv4cxiz
This commit is contained in:
Jagdish Panchal (Open ERP) 2011-12-08 11:45:46 +05:30
parent 201365e2d2
commit ae4fd210a1
4 changed files with 26 additions and 16 deletions

View File

@ -63,8 +63,8 @@ re-invoice your customer's expenses if your work by project.
'hr_expense_demo.xml',
],
'test': [
'test/expense_process.yml',
'test/expense_demo.yml',
'test/expense_process.yml',
],
'installable': True,
'active': False,

View File

@ -2,7 +2,7 @@
<openerp>
<data>
<record id="hr.employee3" model="hr.employee">
<record id="hr.employee4" model="hr.employee">
<field name="address_home_id" ref="base.res_partner_address_1"/>
</record>
@ -34,7 +34,7 @@
</record>
<record id="sep_expenses" model="hr.expense.expense">
<field name="employee_id" ref="hr.employee3"/>
<field name="employee_id" ref="hr.employee4"/>
<field name="name">September Expenses</field>
<field name="date" eval="time.strftime('%Y-09-28')"/>
</record>

View File

@ -1,7 +1,7 @@
-
!record {model: hr.expense.expense, id: hr.employee3, view: False}:
employee_id: 'hr.employee3'
name : 'Antoine Philippe'
!record {model: hr.expense.expense, id: hr_expense01, view: False}:
employee_id: 'hr.employee4'
name : 'John Smith'
-
!record {model: product.product, id: car_travel, view: False}:
hr_expense_ok: 'True'

View File

@ -1,25 +1,35 @@
-
In Order to test process of "Employee Expenses".
I test the process of "Employee Expenses" by processing the expenses of an employee for September month
-
I confirm "Expense Bill of September" for one employee of Marketing Department.
I check that state is 'Draft'.
-
!assert {model: hr.expense.expense, id: sep_expenses, severity: error, string: Expense should be in Draft state}:
- state == 'draft'
-
I change the state.
-
!workflow {model: hr.expense.expense, action: confirm, ref: sep_expenses}
-
I check state of expense after confirmed.
I check that state is 'Confirm'.
-
!assert {model: hr.expense.expense, id: sep_expenses}:
!assert {model: hr.expense.expense, id: sep_expenses, severity: error, string: Expense should be in Confirm state}:
- state == 'confirm'
-
I accept this expense.
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 Invoice for the expense.
-
!python {model: hr.expense.expense}: |
self.invoice(cr, uid, [ref('sep_expenses')])
-
I check invoice details after invoiced.
I check invoice details.
-
!python {model: hr.expense.expense}: |
sep_expenses = self.browse(cr, uid, ref("sep_expenses"), context=context)
@ -31,17 +41,17 @@
assert sep_expenses.invoice_id.amount_total == sep_expenses.amount,"Invoice total amount is not correspond with supplier invoice total"
assert len(sep_expenses.invoice_id.invoice_line) == len(sep_expenses.line_ids),"Lines of Invoice and supplier invoice Line are not correspond"
-
I paid the expense.
I pay the expenses.
-
!python {model: hr.expense.expense}: |
self.expense_paid(cr, uid, [ref('sep_expenses')])
-
I check the expense after paid.
I check that state of expenses is 'Paid'.
-
!assert {model: hr.expense.expense, id: sep_expenses}:
!assert {model: hr.expense.expense, id: sep_expenses, severity: error, string: Expense should be in Paid state}:
- state == 'paid'
-
I print this expense.
I print a report of the expenses.
-
!python {model: hr.expense.expense}: |
import netsvc, tools, os