[FIX] Account : Notified the user if there are no sale/purchase journals defined

bzr revid: jvo@tinyerp.com-20100420090727-fw4y34jdd9ot6hro
This commit is contained in:
Jay (Open ERP)
2010-04-20 14:37:27 +05:30
parent f056f20e61
commit ec5a77d50f
+11
View File
@@ -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 = []