odoo8 元素简介
一:模型module:
1. 字段类型
(1)可控字段:
fileds.char()
fileds.Boolean()
fileds.Date()
(2)保留字段:(系统自动生成)
- id (Id)
- the unique identifier for a record in its model
- create_date (Datetime)
- creation date of the record
- create_uid (Many2one)
- user who created the record
- write_date (Datetime)
- last modification date of the record
- write_uid (Many2one)
- user who last modified the record
2. 字段属性
- string (unicode, default: field’s name)
- 在用户界面显示的标签名
- required (bool, default: False)
- 如果是True, 则不可以为空值
- help (unicode, default: '')
- 当用户悬停在UI字段上时,显示的提示。
- index (bool, default: False)
- 要求odoo为此字段添加一个数据库索引。
二:视图views
1. 基本视图:
(1)树状视图Tree views
<tree string="Idea list">
<field name="name"/>
<field name="inventor_id"/>
</tree> (2)表单视图Form views
<form string="Idea form">
<group colspan="4">
<group colspan="2" col="2">
<separator string="General stuff" colspan="2"/>
<field name="name"/>
<field name="inventor_id"/>
</group> <group colspan="2" col="2">
<separator string="Dates" colspan="2"/>
<field name="active"/>
<field name="invent_date" readonly="1"/>
</group> <notebook colspan="4">
<page string="Description">
<field name="description" nolabel="1"/>
</page>
</notebook> <field name="state"/>
</group>
</form> (3)搜索视图
<search>
<field name="name"/>
<field name="inventor_id"/>
</search>
三:模型关系
1. 多对一:
(1)定义方式:
Many2one(other_model, ondelete='set null')
(2)取出方式
print foo.other_id.name 2. 一对多
(1)定义方式:
One2many(other_model, related_field)
(2)取出方式
for other in foo.other_ids:
print other.name
2. 多对多
(1)定义方式:
Many2many(other_model)
(2)取出方式
for other in foo.other_ids:
print other.name 待续
翻译自:
http://odoo-master.readthedocs.io/en/8.0/howtos/backend.html#build-an-odoo-module
odoo8 元素简介的更多相关文章
- GlyphRun 对象和 Glyphs 元素简介
原文 GlyphRun 对象和 Glyphs 元素简介 GlyphRun 简介 Windows Presentation Foundation (WPF) 提供高级的文本支持包括直接访问的标志符号级标 ...
- WebVTT 及 HTML5 <track> 元素简介
https://dev.opera.com/articles/zh-cn/an-introduction-to-webvtt-and-track/ 简介 网络视频文本轨道,简称为 WebVTT, 是一 ...
- HTML5 <template>标签元素简介
一.HTML5 template元素初面 <template>元素,基本上可以确定是2013年才出现的.干嘛用的呢,顾名思意,就是用来声明是“模板元素”. 目前,我们在HTML中嵌入模板H ...
- HTML5图形绘制学习(1)-- Canvas 元素简介
Canvas元素是HTML5中新增的一个专门用来进行图形绘制的元素.和其名称Canvas一样,它就相当于一个画布,我们可以在其上描绘各种图形. 这里所说的绘制图型,不是指我们可以进行可视化的图形绘制, ...
- 详解HTML5中的进度条progress元素简介及兼容性处理
一.progress元素基本了解 1.基本知识 progress元素属于HTML5家族,指进度条.IE10+以及其他靠谱浏览器都支持. 注释:Internet Explorer 9 以及更早的版本不支 ...
- CSS -- 元素简介
一.元素分类 在CSS中,html中的标签元素大体被分为三种不同的类型:块状元素.内联元素(又叫行内元素)和内联块状元素. 常用的块状元素有: <div>.<p>.<h1 ...
- 元素的BFC特性与自适应布局
一.BFC元素简介与基本表现. BFC全程"Block Formatting Context",中文为"块级格式化上下文".记住一句话:BFC元素特性表现原则就 ...
- HTML5 表单元素和属性
HTML5 表单元素和属性学习 版权声明:未经博主授权,内容严禁转载 ! 表单元素简介 无论实现提交功能还是展示页面功能,表单在HTML中的作用都十分重要. 在其他版本的HTML中,表单能够包含的元素 ...
- HTML5中重新定义的 b 和 i 元素
HTML5强调元素的语义,而非表现.b和i元素是早期HTML遗留下来的产物,它们分别用于将文本变为粗体和斜体(那时CSS还未出现). 当时的规范建议编码人员用strong替代b,用em替代i.不过,事 ...
随机推荐
- 学习笔记:python3,PIP安装第三方库(2017)
https://pip.pypa.io/en/latest/quickstart/ pip的使用文档 http://www.lfd.uci.edu/~gohlke/pythonlibs/ .whl ...
- Ubuntu中通过SuperVisor添加守护进程
1. 用途 守护进程用于保持一个指定程序(dll)时刻保持运行.在命令行终端中通过dotnet run命令执行的程序,在退出命令行终端后,程序自动终止.添加守护进程后,即使终端退出,程序仍可后台执行. ...
- PHP截取特定字符串前后
$email = '13366540193@163.com' ;$domain = strstr ( $email , '@' );echo $domain ; // 打印 @163. ...
- New York is 3 hours ahead of California
New York is 3 hours ahead of California, 纽约时间比加州时间早三个小时, but it does not make California slow. 但加州时间 ...
- React State(状态)
function FormattedDate(props){ return ( <h1>现在是{props.date}</h1> ) } class Clock extends ...
- Docker技术应用场景(转载)
场景一:节省项目环境部署时间 1.单项目打包 每次部署项目到测试.生产等环境,都要部署一大堆依赖的软件.工具,而且部署期间出现问题几率很大,不经意就花费了很长时间. Docker主要理念就是环境打包部 ...
- mysql 线程操作
show processlist;//查询mysql所有连接线程 SELECT CONCAT('KILL ',id,';') FROM information_schema.`PROCESSLIST` ...
- abaqus2016安装过程中出现error:unable to add abaqus command directory to PATH variable
请问abaqus2016安装过程中出现error:unable to add abaqus command directory to PATH variable是什么原因,怎么解决啊,总是安装失败 这 ...
- ios 信任charles https 证书
https://www.charlesproxy.com/documentation/using-charles/ssl-certificates/ https://support.apple.com ...
- 转载——JavaScript学习笔记:取数组中最大值和最小值
转载自:http://www.w3cplus.com/javascript/calculate-the-max-min-value-from-an-array.html. 取数组中最大值 可以先把思路 ...