odoo identifier

Book class (models.Model):
  _name = "library.book"
  _description = "Book"
  _order = "name, date_published desc"
  when # _order set your browser to model default sort records or list view. Its value is the SQL statement string order by use, so you can pass any value in line with SQL syntax, it has intelligent mode and supports translation and many-to-one field name.
  # _Rec_name described when referring to the association fields (e.g., many-to-one association) as a record. Default name field models commonly used, but you can specify any other field
  # _table is a table corresponding to the model data. The default table name defined automatically by the ORM underscore the module name is replaced by point, but can be specified by the attribute table
  # _log_access = False is not set to automatically create an audit trail field: create_uid, create_date, write_uid and write_date.
  # _Auto = False setting does not automatically create a model corresponding data table. If necessary, a database object may be created by overriding the init () method: table or view.

Tips: Only the model name keyword divided by the dot notation, such as other modules, XML identifier, so the data table with an underscore (_) (.).

 

id better not contained in the view file. "" symbols, <record id = "view_tree_book" model = "ir.ui.view"> before encountered because the view id as an example view.tree_book lead to not function properly.

Guess you like

Origin www.cnblogs.com/fly-kaka/p/11003520.html