[IMP] hr_expense : Improved the test cases in accordance with voucher.

bzr revid: mdi@tinyerp.com-20120712065455-0xhhss2jcoo4cyxp
This commit is contained in:
Divyesh Makwana (Open ERP) 2012-07-12 12:24:55 +05:30
parent 1986c5f582
commit 7ceed2bb9b
2 changed files with 7 additions and 9 deletions

View File

@ -183,7 +183,7 @@ class hr_expense_expense(osv.osv):
'amount': l.unit_amount,
'type': 'dr'
}))
total += l.unit_amount
total += l.total_amount
if not exp.employee_id.address_home_id:
raise osv.except_osv(_('Error !'), _('The employee must have a Home address.'))
acc = exp.employee_id.address_home_id.property_account_payable.id

View File

@ -17,22 +17,20 @@
!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.
I make Voucher for the expense.
-
!python {model: hr.expense.expense}: |
self.invoice(cr, uid, [ref('sep_expenses')])
-
I check invoice details.
I check voucher details.
-
!python {model: hr.expense.expense}: |
sep_expenses = self.browse(cr, uid, ref("sep_expenses"), context=context)
assert sep_expenses.state == 'invoiced', "Expense should be in 'Invoiced' state."
assert sep_expenses.invoice_id, "Expense should have link of Invoice."
assert sep_expenses.invoice_id.currency_id == sep_expenses.currency_id,"Invoice currency is not correspond with supplier invoice currency"
assert sep_expenses.invoice_id.origin == sep_expenses.name,"Invoice origin is not correspond with supplier invoice"
assert sep_expenses.invoice_id.type == 'in_invoice', "Invoice type is not supplier invoice"
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"
assert sep_expenses.voucher_id.name == sep_expenses.name,"Voucher name is not correspond with expense name."
assert sep_expenses.voucher_id.type == 'purchase', "Voucher type is not purchase voucher."
assert sep_expenses.voucher_id.amount == sep_expenses.amount,"Voucher total amount is not correspond with expense total."
assert len(sep_expenses.voucher_id.line_dr_ids) == len(sep_expenses.line_ids),"Lines of Voucher and expense line are not correspond."
#TODO: check invoice line details with Expenses lines
-
I pay the expenses.