一:模型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 元素简介的更多相关文章

  1. GlyphRun 对象和 Glyphs 元素简介

    原文 GlyphRun 对象和 Glyphs 元素简介 GlyphRun 简介 Windows Presentation Foundation (WPF) 提供高级的文本支持包括直接访问的标志符号级标 ...

  2. WebVTT 及 HTML5 <track> 元素简介

    https://dev.opera.com/articles/zh-cn/an-introduction-to-webvtt-and-track/ 简介 网络视频文本轨道,简称为 WebVTT, 是一 ...

  3. HTML5 <template>标签元素简介

    一.HTML5 template元素初面 <template>元素,基本上可以确定是2013年才出现的.干嘛用的呢,顾名思意,就是用来声明是“模板元素”. 目前,我们在HTML中嵌入模板H ...

  4. HTML5图形绘制学习(1)-- Canvas 元素简介

    Canvas元素是HTML5中新增的一个专门用来进行图形绘制的元素.和其名称Canvas一样,它就相当于一个画布,我们可以在其上描绘各种图形. 这里所说的绘制图型,不是指我们可以进行可视化的图形绘制, ...

  5. 详解HTML5中的进度条progress元素简介及兼容性处理

    一.progress元素基本了解 1.基本知识 progress元素属于HTML5家族,指进度条.IE10+以及其他靠谱浏览器都支持. 注释:Internet Explorer 9 以及更早的版本不支 ...

  6. CSS -- 元素简介

    一.元素分类 在CSS中,html中的标签元素大体被分为三种不同的类型:块状元素.内联元素(又叫行内元素)和内联块状元素. 常用的块状元素有: <div>.<p>.<h1 ...

  7. 元素的BFC特性与自适应布局

    一.BFC元素简介与基本表现. BFC全程"Block Formatting Context",中文为"块级格式化上下文".记住一句话:BFC元素特性表现原则就 ...

  8. HTML5 表单元素和属性

    HTML5 表单元素和属性学习 版权声明:未经博主授权,内容严禁转载 ! 表单元素简介 无论实现提交功能还是展示页面功能,表单在HTML中的作用都十分重要. 在其他版本的HTML中,表单能够包含的元素 ...

  9. HTML5中重新定义的 b 和 i 元素

    HTML5强调元素的语义,而非表现.b和i元素是早期HTML遗留下来的产物,它们分别用于将文本变为粗体和斜体(那时CSS还未出现). 当时的规范建议编码人员用strong替代b,用em替代i.不过,事 ...

随机推荐

  1. Picasso, ImageLoader, Fresco, Glide 优劣

    Fresco:是Facebook 在今年上半年开源的图片缓存优点:1. 图片存储在安卓系统的匿名共享内存, 而不是虚拟机的堆内存中, 图片的中间缓冲数据也存放在本地堆内存,所以, 应用程序有更多的内存 ...

  2. 模仿input闪烁光标

    模仿闪烁的光标 <span class="cursor-blink"> </span> 样式代码: .cursor-blink { display: inl ...

  3. python学习Day5 几种数据类型的使用

    今日内容 数据类型分类: int | complex | float | str | bool | list | dict | tuple | set 3种数据类型的方法:(数字.字符串.列表 ) 可 ...

  4. spring Date格式问题

    起因: 在数据库设计中,日期时间等类型字段一般设置为Datetime格式,所以有时在接口请求实体bean中,对应的接口字段的数据类型可能会被设置为Date类型. 而在java常用场景中的时间格式一般有 ...

  5. VS2019正式版注册码秘钥

    Visual Studio 2019 EnterpriseBF8Y8-GN2QH-T84XB-QVY3B-RC4DF Visual Studio 2019 ProfessionalNYWVH-HT4X ...

  6. nginx开机启动

    centos 7以上是用Systemd进行系统初始化的 Systemd服务文件以.service结尾,比如现在要建立nginx为开机启动,如果用yum install命令安装的,yum命令会自动创建n ...

  7. 【练习】Python第三次

    对函数,内置函数的用法,递归,程序运行顺序的考试 1.列举布尔值为 False 的值 0 False '' [] () {} None 经常使用的场景是 if object 如果object有值就执行 ...

  8. 获取BDC 消息文本的2种方式

    第一种 LOOP AT MESSTAB. MOVE MESSTAB-MSGNR TO MSGNO. CALL FUNCTION 'WRITE_MESSAGE' EXPORTING MSGID = ME ...

  9. MySQL如何解决1209错误

            1209 - The MySQL server is running with the--read-only option so it cannot  execute this sta ...

  10. Exp2 后门原理与实践 20165110

    Exp2 后门原理与实践 一.实验要求 1.使用netcat获取主机操作Shell,cron启动 2.使用socat获取主机操作Shell, 任务计划启动 3.使用MSF meterpreter(或其 ...