Dưới đây là một model mẫu đầy đủ tham số cho 1 field trong việc tạo addons của odoo ( 11 trở lên – bé hơn thì ko rõ)
from openerp import models, fields
class AModel(models.Model):
_name = 'a_name'
_description = 'Tax Code'
_rec_name = 'code'
name_code = fields.Char(
string="Name", # Optional label of the field
compute="_compute_name_custom", # Transform the fields in computed fields
store=True, # If computed it will store the result
select=True, # Force index on field
readonly=True, # Field will be readonly in views
inverse="_write_name" # On update trigger
required=True, # Mandatory field
translate=True, # Translation enable
help='blabla', # Help tooltip text
company_dependent=True, # Transform columns to ir.property
search='_search_function' # Custom search function mainly used with compute
)
# The string key is not mandatory
# by default it wil use the property name Capitalized
name = fields.Char() # Valid definition
