[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
This commit is contained in:
Quentin (OpenERP) 2012-12-21 15:49:45 +01:00
parent cfd2267460
commit 9e580d355b
1 changed files with 2 additions and 0 deletions

View File

@ -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