Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
13915 Vistas

Hi all,

What are the practical differences of declaring a field of type 'char' vs. a 'text' type.

Thanks.

Edit: grr I need more karma to accept answers. But thanks Ray, that is what I was looking for! Also, I saw the ORM documentation but never made the connection that those are the same field types used in the database models (duh!).

Avatar
Descartar
Mejor respuesta
class odoo.fields.Char

Basic string field, can be length-limited, usually displayed as a single-line string in clients.

Parameters
  • size (int) – the maximum size of values stored for that field
  • trim (bool) – states whether the value is trimmed or not (by default, True). Note that the trim operation is applied only by the web client.
  • translate (bool or callable) – enable the translation of the field’s values; use translate=True to translate field values as a whole; translate may also be a callable such that translate(callback, value) translates value by using callback(term) to retrieve the translation of terms.

class odoo.fields.Text

Very similar to Char but used for longer contents, does not have a size and usually displayed as a multiline text box.

Parameters
translate (bool or callable) – enable the translation of the field’s values; use translate=True to translate field values as a whole; translate may also be a callable such that translate(callback, value) translates value by using callback(term) to retrieve the translation of terms.


From https://www.odoo.com/documentation/14.0/reference/orm.html



Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
may 25
1369
1
abr 25
1068
3
sept 24
13794
2
feb 24
2234
1
jul 23
2526