From 649a7fd09f1f73f2423c69a2c9b3de816af196f8 Mon Sep 17 00:00:00 2001 From: ced <> Date: Fri, 22 Dec 2006 10:06:58 +0000 Subject: [PATCH] ACCOUNT: better fix for currency bzr revid: ced-a1e2f71a57e10ae55b368b452240c7bc2f968ed1 --- addons/account/invoice.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index fc30219caef..fcf2f6e98f9 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -62,7 +62,11 @@ class account_invoice(osv.osv): return cr.fetchone()[0] def _get_currency(self, cr, uid, context): - return pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0].company_id.currency_id.id + user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0] + if user.company: + return user.company_id.currency_id.id + else + return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=',1.0)])[0] def _get_journal_analytic(self, cr, uid, type_inv, context={}): type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'}