[IMP] marketing: now uses decimal.precision
authorolt@tinyerp.com <>
Tue, 5 Oct 2010 12:29:35 +0000 (14:29 +0200)
committerolt@tinyerp.com <>
Tue, 5 Oct 2010 12:29:35 +0000 (14:29 +0200)
bzr revid: olt@tinyerp.com-20101005122935-qe6yghvx37itxwzw

addons/marketing_campaign/marketing_campaign.py
addons/marketing_campaign/report/campaign_analysis.py

index bdfe825..c62b530 100644 (file)
@@ -28,6 +28,7 @@ from traceback import format_exception
 from sys import exc_info
 from tools.safe_eval import safe_eval as eval
 import re
+from decimal_precision import decimal_precision as dp
 
 from osv import fields, osv
 import netsvc
@@ -108,7 +109,7 @@ Normal - the campaign runs normally and automatically sends all emails and repor
                                    'State',),
         'activity_ids': fields.one2many('marketing.campaign.activity',
                                        'campaign_id', 'Activities'),
-        'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for running this campaign. You may also specify variable cost and revenue on each campaign activity. Cost and Revenue statistics are included in Campaign Reporting."),
+        'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for running this campaign. You may also specify variable cost and revenue on each campaign activity. Cost and Revenue statistics are included in Campaign Reporting.", digits_compute=dp.get_precision('Purchase Price')),
     }
 
     _defaults = {
@@ -399,8 +400,8 @@ class marketing_campaign_activity(osv.osv):
         'from_ids': fields.one2many('marketing.campaign.transition',
                                             'activity_to_id',
                                             'Previous Activities'),
-        'variable_cost': fields.float('Variable Cost', help="Set a variable cost if you consider that every campaign item that has reached this point has entailed a certain cost. You can get cost statistics in the Reporting section"),
-        'revenue': fields.float('Revenue', help="Set an expected revenue if you consider that every campaign item that has reached this point has generated a certain revenue. You can get revenue statistics in the Reporting section"),
+        'variable_cost': fields.float('Variable Cost', help="Set a variable cost if you consider that every campaign item that has reached this point has entailed a certain cost. You can get cost statistics in the Reporting section", digits_compute=dp.get_precision('Purchase Price')),
+        'revenue': fields.float('Revenue', help="Set an expected revenue if you consider that every campaign item that has reached this point has generated a certain revenue. You can get revenue statistics in the Reporting section", digits_compute=dp.get_precision('Sale Price')),
         'signal': fields.char('Signal', size=128,
                               help='An activity with a signal can be called programmatically. Be careful, the workitem is always created when a signal is sent'),
         'keep_if_condition_not_met': fields.boolean("Don't delete workitems",
index 066423c..08f0599 100644 (file)
@@ -20,6 +20,8 @@
 ##############################################################################
 import tools
 from osv import fields, osv
+from decimal_precision import decimal_precision as dp
+
 
 class campaign_analysis(osv.osv):
     _name = "campaign.analysis"
@@ -61,8 +63,8 @@ class campaign_analysis(osv.osv):
         'country_id': fields.related('partner_id','address', 'country_id',
                     type='many2one', relation='res.country',string='Country'),
         'total_cost' : fields.function(_total_cost, string='Cost', method=True,
-                                    type="float" ),
-        'revenue': fields.float('Revenue',digits=(16,2),readonly=True),
+                                    type="float", digits_compute=dp.get_precision('Purchase Price')),
+        'revenue': fields.float('Revenue', readonly=True, digits_compute=dp.get_precision('Sale Price')),
         'count' : fields.integer('# of Actions', readonly=True),
         'state': fields.selection([('todo', 'To Do'),
                                    ('exception', 'Exception'), ('done', 'Done'),