[IMP] hr_expense: raise an error when no journal can be found at the time of the...
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 21 Dec 2012 14:49:45 +0000 (15:49 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 21 Dec 2012 14:49:45 +0000 (15:49 +0100)
bzr revid: qdp-launchpad@openerp.com-20121221144945-gy67wln705ewgkxw

addons/hr_expense/hr_expense.py

index 6381c50..7557bb1 100644 (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