From ec5a77d50fa765afb9b676989231da20052d29a9 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 20 Apr 2010 14:37:27 +0530 Subject: [PATCH] [FIX] Account : Notified the user if there are no sale/purchase journals defined bzr revid: jvo@tinyerp.com-20100420090727-fw4y34jdd9ot6hro --- addons/account/invoice.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 20eea676611..c66dda115b2 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -324,6 +324,17 @@ class account_invoice(osv.osv): 'user_id': lambda s,cr,u,c: u, } + def create(self, cr, uid, vals, context={}): + try: + res = super(account_invoice, self).create(cr, uid, vals, context) + return res + except Exception,e: + if '"journal_id" viol' in e.args[0]: + raise except_orm(_('Configuration Error!'), + _('There is no Accounting Journal of type Sale/Purchase defined!')) + else: + raise except_orm(_('UnknownError'), str(e)) + def unlink(self, cr, uid, ids, context=None): invoices = self.read(cr, uid, ids, ['state']) unlink_ids = []