Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2475 Zobrazení

In Odoo 17.0 (on-premise), I'm wondering if there's some way to limit the characters that can be entered into the text and multi-line text fields?

I'm finding that some customers are entering too much text in some fields, enough so that the text begins to overlap the next field, and the final document is difficult to read.  I've noticed that for multi-line text fields, this is accentuated if the person signing the field has the zoom setting in their browser much lower than 100%, because the size of the text does not scale in line with the zoom setting.

Limiting the characters that can be entered in a field is one way I've thought that might help reduce the chances of this happening.

Is there some way to customize the fields, either directly or with development of a customization module?

Avatar
Zrušit
Nejlepší odpověď

Hello Bill Ennals,

To limit the characters in a Text field (fields.Text) in Odoo 17.0, you'll need to create a constraint in a custom module, as Text fields don't inherently have a character limit option.


code : 

@api.constrains('x_custom_text_field')

 def _check_text_field_length(self):

  ​for record in self: if record.x_custom_text_field and len(record.x_custom_text_field) > 500: # Set your desired limit 

​​raise ValidationError("The text is too long. Please limit it to 500 characters.")


Hope this helps!

Thanks & Regards,

Name : Yahoo Baba

Email:  yahoobaba077@gmail.com

Avatar
Zrušit
Autor

Thanks for the prompt reply Yahoo Baba. Do you think the 'Text' fields in Odoo Sign are actually standard text fields though? It seems to me that each field that can receive input in Odoo Sign is a model record (sign.item) in itself, but I can't figure out where/how the entered text is stored. I would guess in the database, but perhaps not...perhaps in an attachment on the sign.item record?

Can anyone else enlighten me?

Related Posts Odpovědi Zobrazení Aktivita
1
srp 25
2352
2
srp 25
951
2
bře 25
1827
1
lis 25
2392
0
srp 25
1559