New implementation of KM cost to property support the decimal precision at 3 digits (without changing the decimal precision of all prices in Odoo)

This commit is contained in:
Alexis de Lattre
2017-06-08 11:25:21 +02:00
parent aca7911d81
commit 19909b6761
13 changed files with 186 additions and 208 deletions

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, SUPERUSER_ID
# I can't create decimal precision via hr_expense_data.xml because it's
# too "late" in the module installation process: in this case,
# demo data and post_install.py data have a unit_amount truncated at 2 digits
# That's why I create the decimal precision via a pre_init_hook
def create_decimal_precision(cr):
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
env['decimal.precision'].create({
'name': 'Expense Unit Price',
'digits': 3,
})