Requirement: The number of decimal point should get changed in view with respect to another value of a field. (Using Odoo 18)
Example:
model 'B' has two field
- value = fields.Float(digits=(4,6))
- decimal_id = fields.Many2one('custom_module')
model 'A' has two fields:-
- number_of_decimal = fields.Selection([('one', 1), ('two', 2), ('three', 3)]).
- value_ids = fields.One2many('custom_module.B', 'decimal_id')
Now in model A's form view, we have number_of_decimal and value_ids. the number of decimals in value, should be equal to one if the number_of_decimal = 'one'. number of decimals in value, should be equal to two if the number_of_decimal == 'two'