From 3e4190d1ffc782b883f6ef02f049fe36b7af0671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20EL=20KHAYAT?= Date: Tue, 27 Jan 2009 16:15:04 +0100 Subject: [PATCH] Avoid crash when no account bzr revid: nel@tinyerp.com-20090127151504-pivyi1i5kf3nb69v --- addons/account/account_move_line.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index c5e38b8cbaf..030af7cfc54 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -200,7 +200,8 @@ class account_move_line(osv.osv): part = partner_id and self.pool.get('res.partner').browse(cr, uid, partner_id) or False # part = False is acceptable for fiscal position. account = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, account.id) - account = self.pool.get('account.account').browse(cr, uid, account) + if account: + account = self.pool.get('account.account').browse(cr, uid, account) if account and ((not fields) or ('debit' in fields) or ('credit' in fields)): data['account_id'] = account.id @@ -215,7 +216,7 @@ class account_move_line(osv.osv): data['debit'] = s>0 and s or 0.0 data['credit'] = s<0 and -s or 0.0 - if account.currency_id: + if account and account.currency_id: data['currency_id'] = account.currency_id.id acc = account if s>0: