From 9e580d355b5831086dfbc3677044d68eb3c6cf18 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 21 Dec 2012 15:49:45 +0100 Subject: [PATCH] [IMP] hr_expense: raise an error when no journal can be found at the time of the expense accounting entries creation bzr revid: qdp-launchpad@openerp.com-20121221144945-gy67wln705ewgkxw --- addons/hr_expense/hr_expense.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 6381c507f97..7557bb1abfe 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -168,6 +168,8 @@ class hr_expense_expense(osv.osv): journal_id = voucher_obj._get_journal(cr, uid, context={'type': 'purchase', 'company_id': company_id}) if journal_id: journal = account_journal.browse(cr, uid, journal_id, context=context) + if not journal: + raise osv.except_osv(_('Error!'), _("No expense journal found. Please make sure you have a journal with type 'purchase' configured.")) for line in exp.line_ids: if line.product_id: acc = line.product_id.property_account_expense