blob: cae84ba1ba0867c862350baf13d3d16338550db5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, _
class UoM(models.Model):
_inherit = 'uom.uom'
@api.onchange('rounding')
def _onchange_rounding(self):
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
if self.rounding < 1.0 / 10.0**precision:
return {'warning': {
'title': _('Warning!'),
'message': _(
"This rounding precision is higher than the Decimal Accuracy"
" (%s digits).\nThis may cause inconsistencies in computations.\n"
"Please set a precision between %s and 1."
) % (precision, 1.0 / 10.0**precision),
}}
|