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'
Odoo models.py BaseModel的更多相关文章
- 3-app应用操作——Models.py和字段类型
Models.py定义 每一个数据表对应一个model定义,model之间和java一样可以相互之间继承.所有的model都必须继承 from django.db import models#或间接继 ...
- httprunner3源码解读(2)models.py
源码目录结构 我们首先来看下models.py的代码结构 我们可以看到这个模块中定义了12个属性和22个模型类,我们依次来看 属性源码分析 import os from enum import Enu ...
- Python Django CMDB项目实战之-2创建APP、建模(models.py)、数据库同步、高级URL、前端页面展示数据库中数据
基于之前的项目代码来编写 Python Django CMDB项目实战之-1如何开启一个Django-并设置base页index页文章页面 现在我们修改一个文章列表是从数据库中获取数据, 下面我们就需 ...
- 超越村后端开发(2:新建models.py+xadmin的引入)
1.新建Model 1.users数据 1.在apps/users/models.py中: from datetime import datetime from django.db import mo ...
- 不在models.py中的models
概述 如何让你定义的model不在models.py中 在app的models目录中的models 你新建一个app后这个models.py就会自动建立,里面只有几行代码.那么如果是一个中大型项目,每 ...
- Python 模型定义 :通过pymysql和数据模型(models.py)创建mysql表及表结构
一.model的配置 1.创建数据库 2.安装pymysql 3.修改配置文件 数据库连接配置 DATABASES = { 'default': { 'ENGINE': 'django.db.back ...
- Django - models.py 应用
Django - models.py 应用 编写 models.py 文件 from django.db import models # Create your models here. class ...
- 第三百七十六节,Django+Xadmin打造上线标准的在线教育平台—创建用户操作app,在models.py文件生成5张表,用户咨询表、课程评论表、用户收藏表、用户消息表、用户学习表
第三百七十六节,Django+Xadmin打造上线标准的在线教育平台—创建用户操作app,在models.py文件生成5张表,用户咨询表.课程评论表.用户收藏表.用户消息表.用户学习表 创建名称为ap ...
- 第三百七十五节,Django+Xadmin打造上线标准的在线教育平台—创建课程机构app,在models.py文件生成3张表,城市表、课程机构表、讲师表
第三百七十五节,Django+Xadmin打造上线标准的在线教育平台—创建课程机构app,在models.py文件生成3张表,城市表.课程机构表.讲师表 创建名称为app_organization的课 ...
随机推荐
- dos中文乱码怎么办?
最简单的方法: 通过 chcp命令改变代码页,UTF-8的代码页为65001 即chcp 65001 chcp 65001 就是换成UTF-8代码页 chcp 936 可以换回默认的GBK chcp ...
- VS2010-MFC(菜单:菜单及CMenu类的使用)
转自:http://www.jizhuomi.com/software/212.html 上一节讲的是VS2010的菜单资源,本节主要讲菜单及CMenu类的使用. CMenu类的主要成员函数 MFC为 ...
- HTML5伪类选择器表单验证
input : required 选择必填表单域 input : focus : invalid 选择当前聚焦的且含有非法输入值的表单域 input : focus : valid 选择当前聚焦的 ...
- springcloud系列13 config的客户端使用
config客户端的使用: 也是首先要引入依赖: <dependency> <groupId>org.springframework.cloud</groupId> ...
- python语句结构(if判断语句)
一.python语句结构分类 条件控制语句:if 语句 if....elif语句 if嵌套 循环语句:while语句 for循环 控制语句:break.continue.pass语句 二.pyt ...
- java笔试之字符逆序(一)
将一个字符串str的内容颠倒过来,并输出.str的长度不超过100个字符. 如:输入“I am a student”,输出“tneduts a ma I”. package test; import ...
- mac brew 安装 php 环境
548 brew search php 549 brew tap homebrew/dupes 550 brew tap josegonzalez/homebrew-php 551 brew ...
- winform 旋转图片
//img.RotateFlip(RotateFlipType.Rotate90FlipNone); //顺时针旋转90度 RotateFlipType.Rotate90FlipNone //逆时针旋 ...
- Leetcode92. Reverse Linked List II反转链表
反转从位置 m 到 n 的链表.请使用一趟扫描完成反转. 说明: 1 ≤ m ≤ n ≤ 链表长度. 示例: 输入: 1->2->3->4->5->NULL, m = 2 ...
- [转]Java多线程
一.线程的生命周期及五种基本状态 关于Java中线程的生命周期,首先看一下下面这张较为经典的图: 上图中基本上囊括了Java中多线程各重要知识点.掌握了上图中的各知识点,Java中的多线程也就基本上掌 ...