From 7ceed2bb9b25b516caa5128c21fab424a797dbc0 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 12 Jul 2012 12:24:55 +0530 Subject: [PATCH] [IMP] hr_expense : Improved the test cases in accordance with voucher. bzr revid: mdi@tinyerp.com-20120712065455-0xhhss2jcoo4cyxp --- addons/hr_expense/hr_expense.py | 2 +- addons/hr_expense/test/expense_process.yml | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index d5f816268cb..5c8aed03d79 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -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 diff --git a/addons/hr_expense/test/expense_process.yml b/addons/hr_expense/test/expense_process.yml index 5c8a9d53f7c..2f8fffb786d 100644 --- a/addons/hr_expense/test/expense_process.yml +++ b/addons/hr_expense/test/expense_process.yml @@ -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.