diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index e765989040b..d9e9bf3907b 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -23,6 +23,8 @@ from osv import osv, fields
from osv.orm import intersect
import tools.sql
from tools.translate import _
+from decimal_precision import decimal_precision as dp
+
class account_analytic_account(osv.osv):
_name = "account.analytic.account"
@@ -351,22 +353,47 @@ class account_analytic_account(osv.osv):
return res
_columns ={
- 'ca_invoiced': fields.function(_ca_invoiced_calc, method=True, type='float', string='Invoiced Amount', help="Total customer invoiced amount for this account."),
- 'total_cost': fields.function(_total_cost_calc, method=True, type='float', string='Total Costs', help="Total of costs for this account. It includes real costs (from invoices) and indirect costs, like time spent on timesheets."),
- 'ca_to_invoice': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Amount', help="If invoice from analytic account, the remaining amount you can invoice to the customer based on the total costs."),
- 'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue', help="Based on the costs you had on the project, what would have been the revenue if all these costs have been invoiced at the normal sale price provided by the pricelist."),
- 'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot', help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."),
- 'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date', help="Date of the last invoice created for this analytic account."),
- 'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost', help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."),
- 'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work', help="Date of the latest work done on this account."),
- 'hours_qtt_non_invoiced': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Hours', help="Number of hours (from journal of type 'general') that can be invoiced if you invoice based on analytic account."),
- 'hours_qtt_invoiced': fields.function(_hours_qtt_invoiced_calc, method=True, type='float', string='Invoiced Hours', help="Number of hours that can be invoiced plus those that already have been invoiced."),
- 'remaining_hours': fields.function(_remaining_hours_calc, method=True, type='float', string='Remaining Hours', help="Computed using the formula: Maximum Quantity - Hours Tot."),
- 'remaining_ca': fields.function(_remaining_ca_calc, method=True, type='float', string='Remaining Revenue', help="Computed using the formula: Max Invoice Price - Invoiced Amount."),
- 'revenue_per_hour': fields.function(_revenue_per_hour_calc, method=True, type='float', string='Revenue per Hours (real)', help="Computed using the formula: Invoiced Amount / Hours Tot."),
- 'real_margin': fields.function(_real_margin_calc, method=True, type='float', string='Real Margin', help="Computed using the formula: Invoiced Amount - Total Costs."),
- 'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin', help="Computed using the formula: Theorial Revenue - Total Costs"),
- 'real_margin_rate': fields.function(_real_margin_rate_calc, method=True, type='float', string='Real Margin Rate (%)', help="Computes using the formula: (Real Margin / Total Costs) * 100."),
+ 'ca_invoiced': fields.function(_ca_invoiced_calc, method=True, type='float', string='Invoiced Amount',
+ help="Total customer invoiced amount for this account.",
+ digits_compute=dp.get_precision('Account')),
+ 'total_cost': fields.function(_total_cost_calc, method=True, type='float', string='Total Costs',
+ help="Total of costs for this account. It includes real costs (from invoices) and indirect costs, like time spent on timesheets.",
+ digits_compute=dp.get_precision('Account')),
+ 'ca_to_invoice': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Amount',
+ help="If invoice from analytic account, the remaining amount you can invoice to the customer based on the total costs.",
+ digits_compute=dp.get_precision('Account')),
+ 'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue',
+ help="Based on the costs you had on the project, what would have been the revenue if all these costs have been invoiced at the normal sale price provided by the pricelist.",
+ digits_compute=dp.get_precision('Account')),
+ 'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot',
+ help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."),
+ 'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date',
+ help="Date of the last invoice created for this analytic account."),
+ 'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost',
+ help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."),
+ 'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work',
+ help="Date of the latest work done on this account."),
+ 'hours_qtt_non_invoiced': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Hours',
+ help="Number of hours (from journal of type 'general') that can be invoiced if you invoice based on analytic account."),
+ 'hours_qtt_invoiced': fields.function(_hours_qtt_invoiced_calc, method=True, type='float', string='Invoiced Hours',
+ help="Number of hours that can be invoiced plus those that already have been invoiced."),
+ 'remaining_hours': fields.function(_remaining_hours_calc, method=True, type='float', string='Remaining Hours',
+ help="Computed using the formula: Maximum Quantity - Hours Tot."),
+ 'remaining_ca': fields.function(_remaining_ca_calc, method=True, type='float', string='Remaining Revenue',
+ help="Computed using the formula: Max Invoice Price - Invoiced Amount.",
+ digits_compute=dp.get_precision('Account')),
+ 'revenue_per_hour': fields.function(_revenue_per_hour_calc, method=True, type='float', string='Revenue per Hours (real)',
+ help="Computed using the formula: Invoiced Amount / Hours Tot.",
+ digits_compute=dp.get_precision('Account')),
+ 'real_margin': fields.function(_real_margin_calc, method=True, type='float', string='Real Margin',
+ help="Computed using the formula: Invoiced Amount - Total Costs.",
+ digits_compute=dp.get_precision('Account')),
+ 'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin',
+ help="Computed using the formula: Theorial Revenue - Total Costs",
+ digits_compute=dp.get_precision('Account')),
+ 'real_margin_rate': fields.function(_real_margin_rate_calc, method=True, type='float', string='Real Margin Rate (%)',
+ help="Computes using the formula: (Real Margin / Total Costs) * 100.",
+ digits_compute=dp.get_precision('Account')),
'month_ids': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
'user_ids': fields.function(_analysis_all, method=True, multi='analytic_analysis', type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
}
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index cf96028f01c..66c74a72bc9 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -25,6 +25,7 @@ import operator
from osv import fields, osv
import decimal_precision as dp
+
class account_analytic_account(osv.osv):
_name = 'account.analytic.account'
_description = 'Analytic Account'
@@ -272,7 +273,7 @@ class account_analytic_line(osv.osv):
_columns = {
'name' : fields.char('Description', size=256, required=True),
'date' : fields.date('Date', required=True, select=1),
- 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.'),
+ 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')),
'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'),
'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True),
'user_id' : fields.many2one('res.users', 'User'),
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index b71e2daa447..7ccd07351f0 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -724,7 +724,7 @@ true, it will allow you to hide the event alarm information without removing it.
if alarm_ids:
alarm_obj.unlink(cr, uid, alarm_ids)
cr.execute('Update %s set base_calendar_alarm_id=NULL, alarm_id=NULL\
- where id=%%d' % model_obj._table,(datas.id,))
+ where id=%%s' % model_obj._table,(datas.id,))
return True
res_alarm()
diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py
index bcc624d6a67..d22fa98f6e4 100644
--- a/addons/caldav/calendar.py
+++ b/addons/caldav/calendar.py
@@ -716,7 +716,7 @@ class basic_calendar_line(osv.osv):
"""
cr.execute("SELECT COUNT(id) FROM basic_calendar_lines \
- WHERE name='%s' AND calendar_id=%s",
+ WHERE name=%s AND calendar_id=%s",
(vals.get('name'), vals.get('calendar_id')))
res = cr.fetchone()
if res:
diff --git a/addons/event/event.py b/addons/event/event.py
index 7a6e904f6e3..ea4a9cf9b8b 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -28,6 +28,7 @@ import time
import tools
import decimal_precision as dp
+
class event_type(osv.osv):
""" Event Type """
_name = 'event.type'
@@ -225,7 +226,7 @@ class event_event(osv.osv):
'product_id': fields.many2one('product.product', 'Product', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="The invoices of this event registration will be created with this Product. Thus it allows you to set the default label and the accounting info you want by default on these invoices."),
'note': fields.text('Notes', help="Description or Summary of Event", readonly=False, states={'done': [('readonly', True)]}),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."),
- 'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify for each registration a specific amount if you want to"),
+ 'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify for each registration a specific amount if you want to", digits_compute=dp.get_precision('Sale Price')),
'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who are giving speech on event."),
'speaker_ids':fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}),
@@ -306,8 +307,8 @@ class event_registration(osv.osv):
'partner_id': fields.many2one('res.partner', 'Partner', states={'done': [('readonly', True)]}),
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
"contact_id": fields.many2one('res.partner.contact', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
- "unit_price": fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Event Price'), readonly=True, states={'draft': [('readonly', False)]}),
- 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute= dp.get_precision('Event Price')),
+ "unit_price": fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}),
+ 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute=dp.get_precision('Sale Price')),
"badge_ids": fields.one2many('event.registration.badge', 'registration_id', 'Badges', readonly=False, states={'done': [('readonly', True)]}),
"event_product": fields.char("Invoice Name", size=128, readonly=True, states={'draft': [('readonly', False)]}),
"tobe_invoiced": fields.boolean("To be Invoiced", readonly=True, states={'draft': [('readonly', False)]}),
diff --git a/addons/event/wizard/partner_event_registration.py b/addons/event/wizard/partner_event_registration.py
index 8462a812313..00f106ab8ae 100644
--- a/addons/event/wizard/partner_event_registration.py
+++ b/addons/event/wizard/partner_event_registration.py
@@ -24,6 +24,7 @@ import netsvc
import tools
from osv import fields, osv
from tools.translate import _
+from decimal_precision import decimal_precision as dp
class partner_event_registration(osv.osv_memory):
@@ -36,7 +37,7 @@ class partner_event_registration(osv.osv_memory):
_columns = {
'event_id': fields.many2one('event.event', 'Event'),
'event_type': fields.many2one('event.type', 'Type', readonly=True),
- 'unit_price': fields.float('Registration Cost'),
+ 'unit_price': fields.float('Registration Cost', digits_compute=dp.get_precision('Sale Price')),
'start_date': fields.datetime('Start date', required=True, help="Beginning Date of Event", readonly=True),
'end_date': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True),
'nb_register': fields.integer('Number of Registration'),
diff --git a/addons/hr_timesheet_invoice/report/report_analytic.py b/addons/hr_timesheet_invoice/report/report_analytic.py
index 0b3d1440f23..d2db7fd4027 100644
--- a/addons/hr_timesheet_invoice/report/report_analytic.py
+++ b/addons/hr_timesheet_invoice/report/report_analytic.py
@@ -21,6 +21,8 @@
from osv import fields,osv
import tools
+from decimal_precision import decimal_precision as dp
+
class report_analytic_account_close(osv.osv):
_name = "report.analytic.account.close"
@@ -70,8 +72,8 @@ class report_account_analytic_line_to_invoice(osv.osv):
'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True),
'product_uom_id':fields.many2one('product.uom', 'UoM', readonly=True),
'unit_amount': fields.float('Units', readonly=True),
- 'sale_price': fields.float('Sale price', readonly=True),
- 'amount': fields.float('Amount', readonly=True),
+ 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Sale Price')),
+ 'amount': fields.float('Amount', readonly=True, digits_compute=dp.get_precision('Account')),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
}
diff --git a/addons/marketing_campaign/report/campaign_analysis_view.xml b/addons/marketing_campaign/report/campaign_analysis_view.xml
index aa994fcfc48..fd5a8c0908f 100644
--- a/addons/marketing_campaign/report/campaign_analysis_view.xml
+++ b/addons/marketing_campaign/report/campaign_analysis_view.xml
@@ -84,8 +84,8 @@