zoukankan      html  css  js  c++  java
  • Odoo models.py BaseModel

    class BaseModel(object):
        """ Base class for OpenERP models.
    
        OpenERP models are created by inheriting from this class' subclasses:
    
        *   :class:`Model` for regular database-persisted models 常用数据库模型
    
        *   :class:`TransientModel` for temporary data, stored in the database but
            automatically vacuumed every so often 临时模型
    
        *   :class:`AbstractModel` for abstract super classes meant to be shared by
            multiple inheriting model 抽象模型 不保存
    
        The system automatically instantiates every model once per database. Those
        instances represent the available models on each database, and depend on
        which modules are installed on that database. The actual class of each
        instance is built from the Python classes that create and inherit from the
        corresponding model.
    
        Every model instance is a "recordset", i.e., an ordered collection of
        records of the model. Recordsets are returned by methods like
        :meth:`~.browse`, :meth:`~.search`, or field accesses. Records have no
        explicit representation: a record is represented as a recordset of one
        record.
    
        To create a class that should not be instantiated, the _register class
        attribute may be set to False.
        """
        __metaclass__ = MetaModel
        _auto = True # create database backend
        _register = False # Set to false if the model shouldn't be automatically discovered.
        _name = None
        _columns = {}
        _constraints = []
        _custom = False
        _defaults = {}
        _rec_name = None
        _parent_name = 'parent_id'
        _parent_store = False
        _parent_order = False
        _date_name = 'date'
        _order = 'id'
        _sequence = None
        _description = None
        _needaction = False
        _translate = True # set to False to disable translations export for this model
    
        # dict of {field:method}, with method returning the (name_get of records, {id: fold})
        # to include in the _read_group, if grouped on this field
        _group_by_full = {}
    
        # Transience
        _transient = False # True in a TransientModel
    
        # structure:
        #  { 'parent_model': 'm2o_field', ... }
        _inherits = {}
    
        # Mapping from inherits'd field name to triple (m, r, f, n) where m is the
        # model from which it is inherits'd, r is the (local) field towards m, f
        # is the _column object itself, and n is the original (i.e. top-most)
        # parent model.
        # Example:
        #  { 'field_name': ('parent_model', 'm2o_field_to_reach_parent',
        #                   field_column_obj, origina_parent_model), ... }
        _inherit_fields = {}
    
        _table = None
        _log_create = False
        _sql_constraints = []
    
        # model dependencies, for models backed up by sql views:
        # {model_name: field_names, ...}
        _depends = {}
    
        CONCURRENCY_CHECK_FIELD = '__last_update'
  • 相关阅读:
    PowerDesigner学习 ---- 系列文章
    PowerDesigner基础使用 ---- 入门学习
    PowerDesigner ---- 数据库设计(概念模型CDM和物理模型PDM)
    PowerDesigner V16.5 安装及汉化
    在树莓派是安装并配置NTP服务
    RESTful Web API 理解
    Linux或树莓派3——挂载U盘、移动硬盘并设置rwx权限
    开启树莓派自带的VNC功能
    c#代码获取web.config配置文件里面设置的 <compilation debug="true"节点
    WebService的web客户端同步、异步、多线程向服务端传入参数的数据交互方式
  • 原文地址:https://www.cnblogs.com/dancesir/p/7026165.html
Copyright © 2011-2022 走看看