[FIX] analytic: fix crash when trying to set currency_id to False in an analytic account

bzr revid: qdp-launchpad@openerp.com-20121005143606-1evrpd8g3drg0v8m
This commit is contained in:
Quentin (OpenERP) 2012-10-05 16:36:06 +02:00
parent 050f8daa8c
commit 46c83756da
1 changed files with 2 additions and 1 deletions

View File

@ -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 = {}