From 46c83756dad86dfea2391bd33e5c5c4d09fac800 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 5 Oct 2012 16:36:06 +0200 Subject: [PATCH] [FIX] analytic: fix crash when trying to set currency_id to False in an analytic account bzr revid: qdp-launchpad@openerp.com-20121005143606-1evrpd8g3drg0v8m --- addons/analytic/analytic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index d71b480f799..1ce483a26cd 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -125,7 +125,8 @@ class account_analytic_account(osv.osv): if account.company_id: if account.company_id.currency_id.id != value: raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really usefull for consolidation purposes of several companies charts with different currencies, for example.")) - return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, )) + if value: + return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, )) def _currency(self, cr, uid, ids, field_name, arg, context=None): result = {}