Hello,
I would like to set fields.Char size dynamically, registration number of an employee, e.g: 0001 or 0002, which is size of 4 here, so if the manager decided to set the size to 5 then I have to change it in code in that case, but the manager wants it to be in a parameter in the company settings so he could change it whenever he wants to.
I already tried:
case 1: defining size dynamically on python side
my_field = fields.Char(..., size=lambda self: self.get_dynamic_size())
# or
fields.Char(..., size=lambda self: get_dynamic_size(self))
case 2: set maxlength of the field in xml
<field name="my_field" attrs="{'max_length': uid.company_id.get_dynamic_size}"
But none of those actually works
My work around was defining an onchange function to correct the input but this doesn't give the same experience for the user as setting maxlength on the input field