[IMP] add direct currency_id field insted of related field.
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Wed, 23 Oct 2013 06:10:53 +0000 (11:40 +0530)
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Wed, 23 Oct 2013 06:10:53 +0000 (11:40 +0530)
bzr revid: tpa@tinyerp.com-20131023061053-3avp9mp31v7vl9o6

addons/crm/crm.py
addons/sale_crm/sale_crm.py

index 8f0e6a8..fe67db2 100644 (file)
@@ -200,7 +200,8 @@ class crm_case_section(osv.osv):
         'monthly_planned_revenue': fields.function(_get_opportunities_data,
             type="string", readonly=True, multi='_get_opportunities_data',
             string='Planned Revenue per Month'),
-        'currency_symbol': fields.function(_get_currency_symbol, string='Currency Symbol', method=True, type='char'),
+        'currency_id': fields.many2one('res.currency', 'Currency', required=True),
+        'currency_symbol': fields.function(_get_currency_symbol, string="Current User's Currency Symbol", method=True, type='char'),
     }
 
     def _get_stage_common(self, cr, uid, context):
@@ -211,6 +212,7 @@ class crm_case_section(osv.osv):
         'active': 1,
         'stage_ids': _get_stage_common,
         'use_leads': True,
+        'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
     }
 
     _sql_constraints = [
index 29aa81a..7287e7d 100644 (file)
@@ -88,8 +88,6 @@ class crm_case_section(osv.osv):
             type='string', readonly=True,
             string='Rate of sent invoices per duration'),
         'create_uid': fields.many2one('res.users', 'Create User'),
-        'company_id': fields.related('create_uid', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
-        'currency_id': fields.related('company_id', 'currency_id', type='many2one', relation='res.currency', required=True, readonly=True, string='Currency'),
     }
 
     def action_forecast(self, cr, uid, id, value, context=None):