Created
March 18, 2021 22:21
-
-
Save ray-odoo/e2b28fa4fe1c61d318d225523901de69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.odoo.com/documentation/14.0/reference/orm.html#fields | |
# simple Char field | |
name = fields.Char(string="Name", required="True", readonly="False", invisible="False", help="The name field help string", ) | |
# note that required, readonly and invisible might be better defined in the View where they can be controlled via attrs | |
# to set a default | |
default='' # the name of the value | |
# to define which groups the field is restricted to | |
groups='' # comma-separated list of group xml ids | |
# for other types, use: | |
fields.Boolean | |
fields.Char | |
fields.Float # this field type you probably want to define digits or reference a decimal precision | |
fields.Integer | |
fields.Binary # use attachment="False" if you don't want an ir.attachment record created | |
fields.Html | |
fields.Image | |
fields.Monetary # there needs to be a currency_id field on the model to use this field | |
fields.Selection # use selection=[('first','First Option'),('second','Second Option')] | |
fields.Text | |
fields.Date | |
fields.Datetime | |
fields.Many2one | |
fields.One2many | |
fields.Many2many |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment