diff options
| author | Ajay Chauhan (OpenERP) <cha@tinyerp.com> | 2012-10-08 10:26:51 +0530 |
|---|---|---|
| committer | Ajay Chauhan (OpenERP) <cha@tinyerp.com> | 2012-10-08 10:26:51 +0530 |
| commit | 14fdc7497ca9de58afeb4d9ecdfe7fcff33eeefb (patch) | |
| tree | 1afdde972b6de4edb2e08e69e3959cb9daf9ac3d /addons/analytic/analytic.py | |
| parent | 05fc9d4baf4c9314f94d58f226b1009f3603ff3e (diff) | |
| parent | 46c83756dad86dfea2391bd33e5c5c4d09fac800 (diff) | |
[MERGE] merge with lp:openobject-addons
bzr revid: cha@tinyerp.com-20121008045651-kt3esedbe5vy5dhk
Diffstat (limited to 'addons/analytic/analytic.py')
| -rw-r--r-- | addons/analytic/analytic.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index ff09349b8a2..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 = {} @@ -163,7 +164,7 @@ class account_analytic_account(osv.osv): 'date': fields.date('Date End', select=True), 'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts. 'state': fields.selection([('template', 'Template'),('draft','New'),('open','In Progress'), ('cancelled', 'Cancelled'),('pending','To Renew'),('close','Closed')], 'Status', required=True,), - 'currency_id': fields.function(_currency, fnct_inv=_set_company_currency, + 'currency_id': fields.function(_currency, fnct_inv=_set_company_currency, #the currency_id field is readonly except if it's a view account and if there is no company store = { 'res.company': (_get_analytic_account, ['currency_id'], 10), }, string='Currency', type='many2one', relation='res.currency'), |
