This is a complete reference to all fields that exist in Odoo (as of version 12.0) with the required and optional attributes for each field.
class Many2one(_Relational): class One2many(_RelationalMulti): class Many2many(_RelationalMulti): class Boolean(Field): class Integer(Field): class Float(Field): class Monetary(Field): class Char(Field): class Text(Field): class Html(Field): class Date(Field): class Datetime(Field): class Binary(Field): class Selection(Field):
A relationship field defining that Model A has a single reference to Model B. A good example of this, in
general, is that Sales Order
sale.order has a
partner_id = fields.Many2one
res.partner . This means that each sales order has a single Customer/Partner.
A relationship field defining that Model A has multiple references to Model B and Model B has a
corresponding Many2one. A good example of this, in general, is that Sales Order
order_line = fields.One2many reference to
sale.order.line and the
sale.order.line model has a single reference back to the
order via an
order_id = fields.Many2one.
A relationship field defining that Model A has multiple references to Model B records and Model B has
multiple references to Model A records. A good example of this, in general, is that Sales Order
sale.order has a
tag_ids = fields.Many2many
crm.tag.lead. But a single tag can be assigned to many different order records.
bool type field that stores either a
True or a
int4 type field which stores an integer value.
float8 type field which stores a floating point number.
A special version of a
float8 column which automatically displays on the frontend in a certain
char type column field which will stores string values. This is typically used for short strings
because it has a default max value of 255 characters.
text type column field which will store long-form string values. This is typically used for
longer strings and descriptions because it has no max value for strings.
text type column that stores long-form strings, except it assumes that the field will
be populated with HTML context. This alters the frontend to display formatted HTML context instead of standard
selection or enum type column that defines a set of fixed values that the user can select
from. A good example of this is the
states field on a sales order. There are many different events hard linked to the sales order
states, so we must fix a list of options.
date type column that stores dates without times.
datetime type column that stores datetime values.
bytea type column that stores binary string values. In the case of Odoo it’s base64 encoded
binary strings typically.
These fields are ideal for storing documents or images. The frontend of Odoo will then render these via
Thanks For Reading
I appreciate you taking the time to read any of my articles. If you're looking for more ramblings, take a look at theentire catalog of articles I've written. Or feel free to give me a follow on Twitter, Instagram, or Github to see what else I've got going on. Or see my contact info below if you want to get in touch with me.