OpenERP Server Developers Documentation 之 Module 之 Views and Events 之 二
2014-08-18 18:04
337 查看
树视图
当我们在一个列表视图中和查询页面中工作时将使用这些视图(为了马上看到多种资源)。这些视图比form表单简单多了并有更少的选项。
查询视图
查询视图是OpenERP 6.0以上的新功能。其创建了定制化的查询面板,并且与表单视图声明很相似,除了试图类型和根元素变为search,而不是form
下面的是查询视图中支持的一列新元素和功能。
Group tag(组标签)
不像组元素,查询视图分组支持一行中不限定数量的条件(字段或过滤器),并且仅适用以下属性。
expand : 开启分组中的扩展器图标(默认是1是扩展,0是缩减)
string : 分组的标签
上述是一个扩展分组
Filter tag(过滤器标签)
过滤器在查询面板过滤器元素中以一个切换按钮显示。过滤器元素能在当前领域或者查询视图上下文中添加新的值。过滤器也可以作为一个子元素添加,指明它们专门满足这个过滤器(这种情况下按钮图标将很小)
在下面的图片中,红色部分包含了表单顶层的过滤器,同时蓝色部分高亮显示了一个字段和其子过滤器。
Group by (分组)
上面的过滤器分组记录了共享了同样的project_id值。分组是延迟加载的,所以当分组扩展时,内部分组才加载。分组头行包含了那个分组中所有记录的普通值,并且视图中当前显示的数字字段被那个分组的值得总和替代。
它也可能通过指定一列字段而不是一个字符串根据多个值分组。这种情况下将显示嵌套分组。
Fileds(字段)
视图中的字段元素用于获取用户提供的值来搜索。结果是,作为分组元素,其与表单视图字段不同。
一个查询字段可以获取过滤器,一般都包含过滤器和字段并且管理相同和关联的字段。 那些内部过滤器渲染成一个小的按钮,靠近这个字段的右边,并且不必有一个String属性
一个查询字段构建了一个领域,由[(field_name,operator,field_value)]. 这个领域可以通过两种方式重写:@operator 替换了这个字段的默认操作符(取决于它的类型)。@filter_domain
让你提供一个完全自定义的领域,替换了默认领域的创建。
一个查询字段默认地不创建一个上下文,但是了你可以提供一个@context,其将评估和平成更加宽泛的上下文(与一个过滤器元素一起)
为了获取@context 或@filter_domain字段的值,可以使用变量self:
或者
Range fileds(date,datetime,time)区间字段
区间字段由两个小部件组成(from和and),而不是仅仅一个。
这就导致了一些特性(与非区间字段对比):
不能通过@operator重写区间字段的操作符。作为一个领域由两个部分构成并且每个部分使用一个不同的操作符
不是一个简单的值(integer,string,float)在@filter_domain中使用self并且@context是一个字典
因为一个区间字段的每个输入部件可能为空(但字段本身任旧有效),当使用self的时候必须注意:其有两个字符串的关键字”from“和”to“,但是了这些关键字的任何一个可能完全没有或者设置值为false。
Actions for Search view(搜索视图的动作)
声明了一个搜索视图后,它将自动用于同一模式下的所有树形视图。如果单一模式下有多个搜索视图,将使用有最高优先级的那个(按照最低排序)。另一个选项是明确地选择你想使用的搜索视图,通过设置那个动作的search_view_id 字段。
另外,为了在action的上下文中传递默认的表单值,Operator6.0现在支持为查询视图传递初始化值。上下文关键字需要匹配search_default_XXX格式,xxx可能与查询视图中的一个字段或者过滤器的名字关联(由于过滤器的name属性不是必须的,这里只是为了过滤器有一个精确的名字设置)。这个值应该是查询字段的初始化值,或者仅仅是过滤器的布尔值来切换它们。
Custom Filters (定制化过滤器)
6.0版本,所有的查询视图有定制化查询过滤器功能,如下所示。用户可以使用当前模式的可用字段的一些,使用AND/OR操作符连接来定义自己的过滤器。也可能保存任何查询上下文(当前匹配的领域和上下文值得组合)作为定制的过滤器,可以在任何时候调用。过滤器也可以在用户主页中直接简化变成可用的。
在上述例子中,我们使用Salesman = Demo user 和 Country = Belgium 过滤partner。我们可以保存查询条件作为一个快捷键或者以过滤器保存。
过滤器是用户指定的并且可以在过滤器的下拉列表中借助过滤器管理选项修改
Graph views(图表过滤器)
对于表单类型的视图,图标是一种新的视图模式。例如,如果线上的销售订单必须以列表或者图标显示,在action(线上打开销售订单的动作)中如此定义。不要这样设置视图模式("tree,form,graph" or "form,graph”)-必须是“graph,tree”来首先显示图标或者“tree,graph”来首先显示列表。(视图模式对于“form,tree”视图多余的并且应该有一个独立的菜单项)。
view_type(视图类型)
tree = (tree with shortcuts at the left), form = (switchable view form/list)
view_model(模式)
tree,graph : sequences of the views when switching(转换时视图顺序)
稍后,用户将可以从一个视图转换到另一个视图。不像表单和树,OpenERP不能为图标类型根据需要自动创建视图,所以了你必须定义了这个图表的视图
图表视图
图表类型视图只是图表的一列字段
图标签
图表的默认类型是一个饼图--可以通过以下代码变成条形饼图,将<graph string="Sales Order Lines">改为<graph string="Sales Order Lines" type="bar"> 。你也可能改变这个操作方向 垂直或者水平方向。
例子
Field tag (字段标签)
第一个字段是X轴。第二个是Y轴,第三个是Z轴,这是对应三维图的。
group:如果设置为true,客户端将对这个字段的相同值的所有条目分为一组。对于每个其他的字段,其将应用一个操作符。
operator(操作符):应用的操作符是另一个分组字段。默认是“+”。允许的字段是:+(加法),*(乘法),**(指数运算),min(列表的最小数量),max(列表的最大数量)
定义对象的统计
--------------------
-------------------
计算对象统计的最简单的方法是:
定义一个统计对象,其是一个PostgreSQL视图
创建这个对象的树视图和图表视图
你可以获取所有模块表单的一个例子:例如,report_crm
控制视图动作
当定义一个视图,下面的元素可以添加到视图的打开的元素中。(比如<form>,<tree>...)
create
设置为false来隐藏那个连接/按钮,允许你创建了一个新的记录
delete
设置为false来隐藏连接/按钮,允许你移除一个记录。
edit
设置false来隐藏连接/按钮,允许你编辑一个记录。
这些属性对于form,tree,kanban和gantt视图都是可用的。它们通常根据用户的访问权限自动加载,但是了可以在视图定义中全局性强制设置。针对这些属性一个可能的使用情况是在一个表单视图内定义一个针对one2many关系的内部树视图,在其内部不能添加或者移除先关的记录,但是可以编辑存在的(可以通过另一种方式创建,比如一个wizard)。
Calendar Views(日历视图)
日历视图为数据提供了时间轴/日程安排的视图。
View Specification(视图规范)
这里是一个视图例子:
这里是calendar标签支持的属性。
String :视图的标题字符串
date_start:datetime字段为日历条目指定开始时间。这个属性是必须的
date_stop:指定结束日期的datetime。如果date_delay属性被设置了则忽略这个字段。
date_delay:一个数字记录来设置一个记录的时间(单位:小时)。这个属性将覆盖date-stop并且date_stop将被忽略。
day_length:一个指定工作日长度的整形值。默认是8小时。
color:一个字段,一般是many2one,用来绘制calendar/gantt条目。
mode:设置默认view/zoom模式的字符串值。对于日历视图,这个可以是以下值(默认是month):day,week,month
Screenshots(画面)
月日历
周日历
Gantt Views(甘特视图)
甘特视图为数据提供了等时线视图。一般地,其用于显示项目任务和资源配置。
一个甘特视图是一个项目中所有任务的图表显示。图上的每一条行是任务计划完成的时间长度的图表显示。
资源任务摘要栏位于所有分组任务之上,代表资源如何高效分配在任务中
摘要图的颜色编码如下:
灰色表示这个资源没有分配任何任务
蓝色表示这个资源在那个时间分配了
红色表示这个资源超额分配
View Specification(视图规范)
下面是一个视图例子:
被gantt标签接受的属性与calendar标签接受的属性相似。level标签通过一些many2one字段分组记录。,当前只支持一种级别
这里是一列支持gantt标签的属性:
string:视图的标题字符串
date_start:指定gantt条目开始时间的datetime字段。这个属性石必选的
date_stop:指定结束日期的datetime字段。如果指定date_delay属性则忽略
date_delay:指定记录时间(单位:小时)的numeric字段。此属性将覆盖date_stop并且忽略它。
day_length:指定工作日长度的整形值,默认是8小时。
color:一个字段,一般是many2one,绘制日历/甘特图条目
mode:设置默认的视图/图片模式的字符串值。对于gantt视图,可以是以下值之一:day,3days,week,3weeks,month,3months,year,3years,5years
level标签支持以下属性:
对象
一个openerp对象,与新的视图有many2one关系
link(连接)
连接给定对象的当前对象的字段名
domain
用于过滤对象记录的领域
Drag and Drop(拖曳)
左边面板显示了由给定level字段分组的任务列表。你可以拖曳它们来重新排序或者改变记录的分组。
The main content pane displays horizontal bars plotted on a timeline grid. A group of bars are summarized with a top summary bar displaying resource allocation of all the underlying tasks.
你可以通过水平拖动任务改变任务的开启时间。同时通过拖曳一个条形到右边来改变结束时间。
注意
时间计算要考虑day_length,一个条形可以跨越更多天数,如果一个任务的全部时间比day_length值更大。
Screenshots(画面)
Design Elements(设计元素)
文件描述表单的视图:
视图定义主要包含三类标签:
拥有属性ir.ui.view的<record>标签,其自身包含了视图定义
属性为model="ir.actions.act_window"的<record>标签,连接action到这些视图
<menuitem>标签,在菜单中创建选项,并且使用action连接
New :你可以在menuitem 标签中使用分组属性分组可访问的菜单。
New:可以使用shortcut标签添加快捷键
例子:
注意你应该在菜单项上添加一个id属性,其与菜单属性相关联。
priority字段的默认值是16,当没有指定时,系统将使用低一点优先级的视图。
视图类型
树视图
你可以指定列表中包含的列,还有一些列表的外观细节。搜索字段没有在这里指定。它们在表单视图字段的select属性中指定。
这个例子只是一个平的列表,但是了你也可以通过指定field_parent显示一个真正的树形结构。虽然名字有点令人误解。你指定的字段必须包含所有子条目的列表。
在树元素上,支持以下属性:
colors
应用不同颜色到列表的条目上。默认是黑色的、
toolbar
如果你想在工具栏区域的顶层显示树结构,设置这个值为1。当你点击工具栏的一个条目时,所有其子节点必须在主干树中显示。对于平列表忽略此值。
Grouping Elements(分组元素)
Separator(分隔符)
添加一条分割线
例子:
string属性定义了标签并且colspan属性定义了其水平长度(列的数量)
Notebook(笔记本)
<notebook>: 使用笔记本你可以在不同的栏分布视图字段(每个用一个page标签定义)你可以设置tabpos属性设置tab,分别在up,down,left,right
例子:
组
<group>:分组成几列并且根据需要拆分组
colspan:使用列数
rowspan:使用行数
expand : 是否扩展组
col:提供(给其子节点)的列数
string : (可选)如果设置了,一个结构将使用包含了字符串的标签围在字段分组周围。否则,其将不可见。
例子:
Page
定义一个新的笔记本页面视图
例子
定义页面名字
数据元素
field标签字段:
select=“1” 标记这个字段为这个资源查询视图的查询条件之一。1表示基本查询包含这个字段,并且2表示高级查询包含这个字段
colspan=“4”字段必须扩展的列数
readonly=“1” 设置小部件为只读
required=“1”这个字段为必须的。如果一个字段被标记为必选的,用户必须填充,如果没有,系统将不会保存这个资源。这个属性替代这个对象中定义的必选值。
nolable=“1”:隐藏字段的标签(但在查询视图中不隐藏)
invisible=“True”:隐藏标签和字段
password=“true”:用星号“*”替换字段值
string=“”:改变字段标签。注意此标签页用于查询视图:看上面的select属性
domain:能约束领域 例子,domain="[('partner_id','=',partner_id)]"
widget(小部件):能改变小部件 例子:widget="one2many_list" one2one_list,one2many_list,many2one_list,many2many,url,email,image,float_time,reference。
mode:切换视图的顺序 例子:mode="tree,graph"
on_change:定义了当字段内容改变时的调用函数 例子:on_change="onchange_partner(type,partner_id)" 详情看ViewsSpecialProperties
attrs:允许依靠相同窗口的其他字段定义一个字段的属性。(它能用于page,group,button,和notebook表)例子:<field
digits="(14, 3)" name="volume"
attrs="{'readonly':[('type','=','service')]}"/>
eval:如同Python代码一样评估内容(看下面的例子)
default_focus:当表单第一次打开时设置这个字段的焦点(光标位置)为1。视图中有这个值为1的属性可能仅有一个字段
Example
这里是销售订单对象视图的源代码。
eval属性
eval属性如Python代码一样评估。允许定义不是字符串的值。
一般地,<field>标签里面的值默认为字符串类型
Example 1:
<field name="value">2.3</field>
这个值是字符串“2.3”,而不是浮点型2.3.
Example 2:
同理此值是字符串“False”,而不是布尔值False。这里有点棘手,因为Python的转换规则将任何非空字符串设置为True,所以上述代码可能返回的结果与期望值相反。
如果你想得到float类型的值,一个布尔值或者另外的类型,除了字符串,你需要使用eval属性:
Button(按钮)
给当前视图添加一个按钮。允许用户在当前记录上执行不同的actions。在点击按钮后,应该总是重新加载这个记录。
按钮有以下属性:
@type
定义了当按钮激活的时候执行action的类型
workflow(默认的)
按钮在使用按钮的@name(作为工作流名字)的当前模式发送工作流信号并提供记录id作为参数(在列表中)
工作流信号可能返回一个action标示符,应该被执行。否则将返回false。
Object
这个按钮将执行当前模式@name命名的方法,并提供记录id作为参数。可能返回一个action描述符来执行
action
按钮触发action(ir.actions.actions)执行。action的id是按钮的名字。
从这里开始,下面的是普通的动作执行工作流。
@special
当前仅有一个可能值:cancel,指明弹出应该关闭,不执行任何RPC调用或者action解析。
注意:
只有在弹出类型窗口才有意义(比如:wizard),否则,等待。
Warning
@special和@type是不能同时使用的。
@name
按钮标示符,用于指示调用哪个方法,此方法用来发送信号或者执行action。
@confirm
执行按钮任务前弹出的一个确认窗口。如果解除了确认,按钮任务就不会执行。
@string
显示在按钮上的标签
@icon
现在按钮上的图标。如果没有设置,按钮上显示的仅仅是文本内容
@states,
@attrs,
@invisible
标准OpenERP意义的属性视图
@default_focus
如果设置值为1,在那个form表单中按下RETURN键 自动选择之前使用的按钮。
可能会被客户端忽略
在6.0版本中
标签
使用字符串属性增加一个简单标签作为标题
例子:
<label
string="Test"/>
New Line
即使视图中所有列没有填充,强制返回那一行。
例子:
<newline/>
视图中的继承
当你在一些普通或者特殊的模块中创建一个继承对象时,最好从一个已存在的视图中继承(而不是替换)来添加/修改/删除一些字段和保存。
例子:
这里要在基本模块的res.partner.form视图的笔记本中添加一个页面。
继承引擎将解析存在的视图并且查询根节点
<field
name="arch" type="xml">
其将添加或者编辑这个标签的内容。如果这个标签有一些属性,其将查找匹配这些属性节点的父视图。
你将在position属性上使用这些值:
inside(默认的):在标签内部添加值
after:在标签后面添加内容
before:在标签前面添加值
replace:替换标签内容
替换内容:
使用relation_ids字段替换笔记簿中Extra Info栏的内容
父视图和继承的视图使用--update=all 参数更新,如同其他视图一样。
内容删除
为从表单中删除一个字段,使用position="replace"属性的空元素。例如:
内容插入
在指定标签使用position="before"属性给表单添加元素
在lang字段前添加relation_ids字段
在指定标签后给表单添加一个字段,使用position="after"属性
在lang字段后面添加relation_ids字段
Multiple Changes(多次变化)
为了多处发生变化,用一个数据元素封装字段
从lang的普通位置删除lang字段,并在website字段后显示
XPath Element
有时候一个视图通过名字简单定义一个定义一个target字段太复杂。例如,这个字段可能位于两个地方。当处理这种情况时,你可使用xpath元素来描述变化发生的地方。
在地址列表的表单和树视图email字段后面添加age字段
指定你想使用的视图
有时候你想指定一个视图而不是用默认的
如果一个对象对应着几个表单视图或者树视图
如果你想通过关联id来改变使用的表单或者树视图(one2many例子)
使用priority字段
在视图定义中,这个字段是可用的,默认值为16.一般地,OpenERP将显示使用最高优先级的模式(最小值)。例如,假设对于一个模式我们有两个视图。模式客户端有两个字段:firstname和lastname。我们将定义两个视图,一个显示首先firstname,另一个首先显示lastName。
闲杂,每次OpenERP得为独享client显示一个表单视图,在两个视图之间有一个选择。其将总是使用第二个视图,因为有高点的优先级。除非你告诉它使用第一个。
Specify per-action view
为说明这点,我们将创建两个表单项来显示client对象的表单视图
如你所见,我们可以指定一个视图。这意味着当我们打开第二个菜单时,OpenERP将使用表单视图client_form_view_1,而不仅仅取决于优先级。
注意
如果你要关联一个在其他模块定义的视图,记得使用ref属性的模块名(module.view_id)
指定关联字段的视图
使用上下文
虽然view_id在菜单/action中工作的很好,但是如何指定一个视图使用one2many字段?当你有一个one2many字段时,使用两个视图。一个树视图(蓝色),和当你点击红色按钮时显示的表单视图
当你在一个表单视图中添加一个one2many字段,你应该做这些:
如果你想指定要使用的视图,你可以添加一个上下文属性,并为每类支持的视图指定一个视图id,如同action中的view_id属性一样,除了提供的视图id必须是全限定模块名,甚至是必须属于同一个模块。
注意
你得将模块名放在view_id中,因为当视图显示的时候已经评估,并且当XML文件解析时没有评估,所以了模块名信息不可用。结果是将使用默认的视图(看下面的)
如果你没有指定视图,OpenERP将按照以下顺序选择一个:
将使用定义在字段中的<form>或者<tree>视图
或者,使用这个对象优先级最高的视图
最后,创建默认的空视图,含有所有字段
注意
上下文关键字命名为<视图类型>_view_ref
注意
默认地,OpenERP从不使用不是为你的对象定义的视图。如果你有两个模块,有相同的字段,但是了有不同的model名字,OpenERP将从不使用其中一个的视图,甚至是一个模型继承了另一个模型
你可以强制性手动控制一个视图,要不在action或者在上下文中。
使用子视图
在关联字段的情况下,你可以直接在一个字段里面直接创建一个视图。
如果开发人员想在另一个模块中继承这个视图,你需要继承其父视图并且修改其子字段。在子视图中,你通常需要使用XPath Element来确切描述在哪里放置你的新字段。
像这样定义子视图不利的一面是其不能继承自身,其仅能被其父视图继承。你的视图将更灵活 如果分开定义子视图并之后指定哪个子视图定义 one2many 字段部分。
当我们在一个列表视图中和查询页面中工作时将使用这些视图(为了马上看到多种资源)。这些视图比form表单简单多了并有更少的选项。
查询视图
查询视图是OpenERP 6.0以上的新功能。其创建了定制化的查询面板,并且与表单视图声明很相似,除了试图类型和根元素变为search,而不是form
下面的是查询视图中支持的一列新元素和功能。
Group tag(组标签)
不像组元素,查询视图分组支持一行中不限定数量的条件(字段或过滤器),并且仅适用以下属性。
expand : 开启分组中的扩展器图标(默认是1是扩展,0是缩减)
string : 分组的标签
<group expand="1" string="Group By"> <filter string="Users" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/> <filter string="Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}"/> <separator orientation="vertical"/> <filter string="Deadline" icon="terp-project" domain="[]" context="{'group_by':'date_deadline'}"/> </group>
上述是一个扩展分组
Filter tag(过滤器标签)
过滤器在查询面板过滤器元素中以一个切换按钮显示。过滤器元素能在当前领域或者查询视图上下文中添加新的值。过滤器也可以作为一个子元素添加,指明它们专门满足这个过滤器(这种情况下按钮图标将很小)
在下面的图片中,红色部分包含了表单顶层的过滤器,同时蓝色部分高亮显示了一个字段和其子过滤器。
<filter string="Current" domain="[('state','in',('open','draft'))]" help="Draft, Open and Pending Tasks" icon="terp-project"/> <field name="project_id" select="1" widget="selection"> <filter domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-project"/> </field>
Group by (分组)
<filter string="Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}"/>
上面的过滤器分组记录了共享了同样的project_id值。分组是延迟加载的,所以当分组扩展时,内部分组才加载。分组头行包含了那个分组中所有记录的普通值,并且视图中当前显示的数字字段被那个分组的值得总和替代。
它也可能通过指定一列字段而不是一个字符串根据多个值分组。这种情况下将显示嵌套分组。
<filter string="Project" icon="terp-project" domain="[]" context="{'group_by': ['project_id', 'user_id'] }"/>
Fileds(字段)
视图中的字段元素用于获取用户提供的值来搜索。结果是,作为分组元素,其与表单视图字段不同。
一个查询字段可以获取过滤器,一般都包含过滤器和字段并且管理相同和关联的字段。 那些内部过滤器渲染成一个小的按钮,靠近这个字段的右边,并且不必有一个String属性
一个查询字段构建了一个领域,由[(field_name,operator,field_value)]. 这个领域可以通过两种方式重写:@operator 替换了这个字段的默认操作符(取决于它的类型)。@filter_domain
让你提供一个完全自定义的领域,替换了默认领域的创建。
一个查询字段默认地不创建一个上下文,但是了你可以提供一个@context,其将评估和平成更加宽泛的上下文(与一个过滤器元素一起)
为了获取@context 或@filter_domain字段的值,可以使用变量self:
<field name="location_id" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>
或者
<field name="journal_id" widget="selection" context="{'journal_id':self, 'visible_id':self, 'normal_view':False}"/>
Range fileds(date,datetime,time)区间字段
区间字段由两个小部件组成(from和and),而不是仅仅一个。
这就导致了一些特性(与非区间字段对比):
不能通过@operator重写区间字段的操作符。作为一个领域由两个部分构成并且每个部分使用一个不同的操作符
不是一个简单的值(integer,string,float)在@filter_domain中使用self并且@context是一个字典
因为一个区间字段的每个输入部件可能为空(但字段本身任旧有效),当使用self的时候必须注意:其有两个字符串的关键字”from“和”to“,但是了这些关键字的任何一个可能完全没有或者设置值为false。
Actions for Search view(搜索视图的动作)
声明了一个搜索视图后,它将自动用于同一模式下的所有树形视图。如果单一模式下有多个搜索视图,将使用有最高优先级的那个(按照最低排序)。另一个选项是明确地选择你想使用的搜索视图,通过设置那个动作的search_view_id 字段。
另外,为了在action的上下文中传递默认的表单值,Operator6.0现在支持为查询视图传递初始化值。上下文关键字需要匹配search_default_XXX格式,xxx可能与查询视图中的一个字段或者过滤器的名字关联(由于过滤器的name属性不是必须的,这里只是为了过滤器有一个精确的名字设置)。这个值应该是查询字段的初始化值,或者仅仅是过滤器的布尔值来切换它们。
<record id="action_view_task" model="ir.actions.act_window"> <field name="name">Tasks</field> <field name="res_model">project.task</field> <field name="view_type">form</field> <field name="view_mode">tree,form,calendar,gantt,graph</field> <field eval="False" name="filter"/> <field name="view_id" ref="view_task_tree2"/> <field name="context">{"search_default_current":1,"search_default_user_id":uid}</field> <field name="search_view_id" ref="view_task_search_form"/> </record>
Custom Filters (定制化过滤器)
6.0版本,所有的查询视图有定制化查询过滤器功能,如下所示。用户可以使用当前模式的可用字段的一些,使用AND/OR操作符连接来定义自己的过滤器。也可能保存任何查询上下文(当前匹配的领域和上下文值得组合)作为定制的过滤器,可以在任何时候调用。过滤器也可以在用户主页中直接简化变成可用的。
在上述例子中,我们使用Salesman = Demo user 和 Country = Belgium 过滤partner。我们可以保存查询条件作为一个快捷键或者以过滤器保存。
过滤器是用户指定的并且可以在过滤器的下拉列表中借助过滤器管理选项修改
Graph views(图表过滤器)
对于表单类型的视图,图标是一种新的视图模式。例如,如果线上的销售订单必须以列表或者图标显示,在action(线上打开销售订单的动作)中如此定义。不要这样设置视图模式("tree,form,graph" or "form,graph”)-必须是“graph,tree”来首先显示图标或者“tree,graph”来首先显示列表。(视图模式对于“form,tree”视图多余的并且应该有一个独立的菜单项)。
<field name="view_type">form</field> <field name="view_mode">tree,graph</field>
view_type(视图类型)
tree = (tree with shortcuts at the left), form = (switchable view form/list)
view_model(模式)
tree,graph : sequences of the views when switching(转换时视图顺序)
稍后,用户将可以从一个视图转换到另一个视图。不像表单和树,OpenERP不能为图标类型根据需要自动创建视图,所以了你必须定义了这个图表的视图
<record model="ir.ui.view" id="view_order_line_graph"> <field name="name">sale.order.line.graph</field> <field name="model">sale.order.line</field> <field name="type">graph</field> <field name="arch" type="xml"> <graph string="Sales Order Lines"> <field name="product_id" group="True"/> <field name="price_unit" operator="*"/> </graph> </field> </record>
图表视图
图表类型视图只是图表的一列字段
图标签
图表的默认类型是一个饼图--可以通过以下代码变成条形饼图,将<graph string="Sales Order Lines">改为<graph string="Sales Order Lines" type="bar"> 。你也可能改变这个操作方向 垂直或者水平方向。
例子
<graph string="Sales Order Lines" orientation="horizontal" type="bar">
Field tag (字段标签)
第一个字段是X轴。第二个是Y轴,第三个是Z轴,这是对应三维图的。
group:如果设置为true,客户端将对这个字段的相同值的所有条目分为一组。对于每个其他的字段,其将应用一个操作符。
operator(操作符):应用的操作符是另一个分组字段。默认是“+”。允许的字段是:+(加法),*(乘法),**(指数运算),min(列表的最小数量),max(列表的最大数量)
定义对象的统计
--------------------
-------------------
计算对象统计的最简单的方法是:
定义一个统计对象,其是一个PostgreSQL视图
创建这个对象的树视图和图表视图
你可以获取所有模块表单的一个例子:例如,report_crm
控制视图动作
当定义一个视图,下面的元素可以添加到视图的打开的元素中。(比如<form>,<tree>...)
create
设置为false来隐藏那个连接/按钮,允许你创建了一个新的记录
delete
设置为false来隐藏连接/按钮,允许你移除一个记录。
edit
设置false来隐藏连接/按钮,允许你编辑一个记录。
这些属性对于form,tree,kanban和gantt视图都是可用的。它们通常根据用户的访问权限自动加载,但是了可以在视图定义中全局性强制设置。针对这些属性一个可能的使用情况是在一个表单视图内定义一个针对one2many关系的内部树视图,在其内部不能添加或者移除先关的记录,但是可以编辑存在的(可以通过另一种方式创建,比如一个wizard)。
Calendar Views(日历视图)
日历视图为数据提供了时间轴/日程安排的视图。
View Specification(视图规范)
这里是一个视图例子:
<calendar color="user_id" date_delay="planned_hours" date_start="date_start" string="Tasks"> <field name="name"/> <field name="project_id"/> </calendar>
这里是calendar标签支持的属性。
String :视图的标题字符串
date_start:datetime字段为日历条目指定开始时间。这个属性是必须的
date_stop:指定结束日期的datetime。如果date_delay属性被设置了则忽略这个字段。
date_delay:一个数字记录来设置一个记录的时间(单位:小时)。这个属性将覆盖date-stop并且date_stop将被忽略。
day_length:一个指定工作日长度的整形值。默认是8小时。
color:一个字段,一般是many2one,用来绘制calendar/gantt条目。
mode:设置默认view/zoom模式的字符串值。对于日历视图,这个可以是以下值(默认是month):day,week,month
Screenshots(画面)
月日历
周日历
Gantt Views(甘特视图)
甘特视图为数据提供了等时线视图。一般地,其用于显示项目任务和资源配置。
一个甘特视图是一个项目中所有任务的图表显示。图上的每一条行是任务计划完成的时间长度的图表显示。
资源任务摘要栏位于所有分组任务之上,代表资源如何高效分配在任务中
摘要图的颜色编码如下:
灰色表示这个资源没有分配任何任务
蓝色表示这个资源在那个时间分配了
红色表示这个资源超额分配
View Specification(视图规范)
下面是一个视图例子:
<gantt color="user_id" date_delay="planned_hours" date_start="date_start" string="Tasks"> <level object="project.project" link="project_id" domain="[]"> <field name="name"/> </level> </gantt>
被gantt标签接受的属性与calendar标签接受的属性相似。level标签通过一些many2one字段分组记录。,当前只支持一种级别
这里是一列支持gantt标签的属性:
string:视图的标题字符串
date_start:指定gantt条目开始时间的datetime字段。这个属性石必选的
date_stop:指定结束日期的datetime字段。如果指定date_delay属性则忽略
date_delay:指定记录时间(单位:小时)的numeric字段。此属性将覆盖date_stop并且忽略它。
day_length:指定工作日长度的整形值,默认是8小时。
color:一个字段,一般是many2one,绘制日历/甘特图条目
mode:设置默认的视图/图片模式的字符串值。对于gantt视图,可以是以下值之一:day,3days,week,3weeks,month,3months,year,3years,5years
level标签支持以下属性:
对象
一个openerp对象,与新的视图有many2one关系
link(连接)
连接给定对象的当前对象的字段名
domain
用于过滤对象记录的领域
Drag and Drop(拖曳)
左边面板显示了由给定level字段分组的任务列表。你可以拖曳它们来重新排序或者改变记录的分组。
The main content pane displays horizontal bars plotted on a timeline grid. A group of bars are summarized with a top summary bar displaying resource allocation of all the underlying tasks.
你可以通过水平拖动任务改变任务的开启时间。同时通过拖曳一个条形到右边来改变结束时间。
注意
时间计算要考虑day_length,一个条形可以跨越更多天数,如果一个任务的全部时间比day_length值更大。
Screenshots(画面)
Design Elements(设计元素)
文件描述表单的视图:
<?xml version="1.0"?> <openerp> <data> [view definitions] </data> </openerp>
视图定义主要包含三类标签:
拥有属性ir.ui.view的<record>标签,其自身包含了视图定义
属性为model="ir.actions.act_window"的<record>标签,连接action到这些视图
<menuitem>标签,在菜单中创建选项,并且使用action连接
New :你可以在menuitem 标签中使用分组属性分组可访问的菜单。
New:可以使用shortcut标签添加快捷键
例子:
<shortcut name="Draft Purchase Order (Proposals)" model="purchase.order" logins="demo" menu="m"/>
注意你应该在菜单项上添加一个id属性,其与菜单属性相关联。
<record model="ir.ui.view" id="v"> <field name="name">sale.order.form</field> <field name="model">sale.order</field> <field name="priority" eval="2"/> <field name="arch" type="xml"> <form string="Sale Order"> ......... </form> </field> </record>
priority字段的默认值是16,当没有指定时,系统将使用低一点优先级的视图。
视图类型
树视图
你可以指定列表中包含的列,还有一些列表的外观细节。搜索字段没有在这里指定。它们在表单视图字段的select属性中指定。
<record id="view_location_tree2" model="ir.ui.view"> <field name="name">stock.location.tree</field> <field name="model">stock.location</field> <field name="type">tree</field> <field name="priority" eval="2"/> <field name="arch" type="xml"> <tree colors="blue:usage=='view';darkred:usage=='internal'"> <field name="complete_name"/> <field name="usage"/> <field name="stock_real" invisible="'product_id' not in context"/> <field name="stock_virtual" invisible="'product_id' not in context"/> </tree> </field> </record>
这个例子只是一个平的列表,但是了你也可以通过指定field_parent显示一个真正的树形结构。虽然名字有点令人误解。你指定的字段必须包含所有子条目的列表。
<record id="view_location_tree" model="ir.ui.view"> <field name="name">stock.location.tree</field> <field name="model">stock.location</field> <field name="type">tree</field> <field name="field_parent">child_ids</field> <field name="arch" type="xml"> <tree toolbar="1"> <field icon="icon" name="name"/> </tree> </field> </record>
在树元素上,支持以下属性:
colors
应用不同颜色到列表的条目上。默认是黑色的、
toolbar
如果你想在工具栏区域的顶层显示树结构,设置这个值为1。当你点击工具栏的一个条目时,所有其子节点必须在主干树中显示。对于平列表忽略此值。
Grouping Elements(分组元素)
Separator(分隔符)
添加一条分割线
例子:
<separator string="Links" colspan="4"/>
string属性定义了标签并且colspan属性定义了其水平长度(列的数量)
Notebook(笔记本)
<notebook>: 使用笔记本你可以在不同的栏分布视图字段(每个用一个page标签定义)你可以设置tabpos属性设置tab,分别在up,down,left,right
例子:
<notebook colspan="4">....</notebook>
组
<group>:分组成几列并且根据需要拆分组
colspan:使用列数
rowspan:使用行数
expand : 是否扩展组
col:提供(给其子节点)的列数
string : (可选)如果设置了,一个结构将使用包含了字符串的标签围在字段分组周围。否则,其将不可见。
例子:
<group col="3" colspan="2"> <field name="invoiced" select="2"/> <button colspan="1" name="make_invoice" states="confirmed" string="Make Invoice" type="object"/> </group>
Page
定义一个新的笔记本页面视图
例子
<page string="Order Line"> ... </page>:
定义页面名字
数据元素
field标签字段:
select=“1” 标记这个字段为这个资源查询视图的查询条件之一。1表示基本查询包含这个字段,并且2表示高级查询包含这个字段
colspan=“4”字段必须扩展的列数
readonly=“1” 设置小部件为只读
required=“1”这个字段为必须的。如果一个字段被标记为必选的,用户必须填充,如果没有,系统将不会保存这个资源。这个属性替代这个对象中定义的必选值。
nolable=“1”:隐藏字段的标签(但在查询视图中不隐藏)
invisible=“True”:隐藏标签和字段
password=“true”:用星号“*”替换字段值
string=“”:改变字段标签。注意此标签页用于查询视图:看上面的select属性
domain:能约束领域 例子,domain="[('partner_id','=',partner_id)]"
widget(小部件):能改变小部件 例子:widget="one2many_list" one2one_list,one2many_list,many2one_list,many2many,url,email,image,float_time,reference。
mode:切换视图的顺序 例子:mode="tree,graph"
on_change:定义了当字段内容改变时的调用函数 例子:on_change="onchange_partner(type,partner_id)" 详情看ViewsSpecialProperties
attrs:允许依靠相同窗口的其他字段定义一个字段的属性。(它能用于page,group,button,和notebook表)例子:<field
digits="(14, 3)" name="volume"
attrs="{'readonly':[('type','=','service')]}"/>
eval:如同Python代码一样评估内容(看下面的例子)
default_focus:当表单第一次打开时设置这个字段的焦点(光标位置)为1。视图中有这个值为1的属性可能仅有一个字段
<field name="name" default_focus=”1”/>
Example
这里是销售订单对象视图的源代码。
<?xml version="1.0"?> <openerp> <data> <record id="view_partner_form" model="ir.ui.view"> <field name="name">res.partner.form</field> <field name="model">res.partner</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="Partners"> <group colspan="4" col="6"> <field name="name" select="1"/> <field name="ref" select="1"/> <field name="customer" select="1"/> <field domain="[('domain', '=', 'partner')]" name="title"/> <field name="lang" select="2"/> <field name="supplier" select="2"/> </group> <notebook colspan="4"> <page string="General"> <field colspan="4" mode="form,tree" name="address" nolabel="1" select="1"> <form string="Partner Contacts"> <field name="name" select="2"/> <field domain="[('domain', '=', 'contact')]" name="title"/> <field name="function"/> <field name="type" select="2"/> <field name="street" select="2"/> <field name="street2"/> <newline/> <field name="zip" select="2"/> <field name="city" select="2"/> <newline/> <field completion="1" name="country_id" select="2"/> <field name="state_id" select="2"/> <newline/> <field name="phone"/> <field name="fax"/> <newline/> <field name="mobile"/> <field name="email" select="2" widget="email"/> </form> <tree string="Partner Contacts"> <field name="name"/> <field name="zip"/> <field name="city"/> <field name="country_id"/> <field name="phone"/> <field name="email"/> </tree> </field> <separator colspan="4" string="Categories"/> <field colspan="4" name="category_id" nolabel="1" select="2"/> </page> <page string="Sales & Purchases"> <separator string="General Information" colspan="4"/> <field name="user_id" select="2"/> <field name="active" select="2"/> <field name="website" widget="url"/> <field name="date" select="2"/> <field name="parent_id"/> <newline/> </page> <page string="History"> <field colspan="4" name="events" nolabel="1" widget="one2many_list"/> </page> <page string="Notes"> <field colspan="4" name="comment" nolabel="1"/> </page> </notebook> </form> </field> </record> <menuitem action="action_partner_form" id="menu_partner_form" parent="base.menu_base_partner" sequence="2"/> </data> </openerp>
eval属性
eval属性如Python代码一样评估。允许定义不是字符串的值。
一般地,<field>标签里面的值默认为字符串类型
Example 1:
<field name="value">2.3</field>
这个值是字符串“2.3”,而不是浮点型2.3.
Example 2:
<field name="value">False</field>
同理此值是字符串“False”,而不是布尔值False。这里有点棘手,因为Python的转换规则将任何非空字符串设置为True,所以上述代码可能返回的结果与期望值相反。
如果你想得到float类型的值,一个布尔值或者另外的类型,除了字符串,你需要使用eval属性:
<field name="value" eval="2.3" /> <field name="value" eval="False" />
Button(按钮)
给当前视图添加一个按钮。允许用户在当前记录上执行不同的actions。在点击按钮后,应该总是重新加载这个记录。
按钮有以下属性:
@type
定义了当按钮激活的时候执行action的类型
workflow(默认的)
按钮在使用按钮的@name(作为工作流名字)的当前模式发送工作流信号并提供记录id作为参数(在列表中)
工作流信号可能返回一个action标示符,应该被执行。否则将返回false。
Object
这个按钮将执行当前模式@name命名的方法,并提供记录id作为参数。可能返回一个action描述符来执行
action
按钮触发action(ir.actions.actions)执行。action的id是按钮的名字。
从这里开始,下面的是普通的动作执行工作流。
@special
当前仅有一个可能值:cancel,指明弹出应该关闭,不执行任何RPC调用或者action解析。
注意:
只有在弹出类型窗口才有意义(比如:wizard),否则,等待。
Warning
@special和@type是不能同时使用的。
@name
按钮标示符,用于指示调用哪个方法,此方法用来发送信号或者执行action。
@confirm
执行按钮任务前弹出的一个确认窗口。如果解除了确认,按钮任务就不会执行。
@string
显示在按钮上的标签
@icon
现在按钮上的图标。如果没有设置,按钮上显示的仅仅是文本内容
@states,
@attrs,
@invisible
标准OpenERP意义的属性视图
@default_focus
如果设置值为1,在那个form表单中按下RETURN键 自动选择之前使用的按钮。
可能会被客户端忽略
在6.0版本中
<button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-execute"/> <button name="_action_open_window" string="Open Margins" type="object" default_focus=”1”/>
标签
使用字符串属性增加一个简单标签作为标题
例子:
<label
string="Test"/>
New Line
即使视图中所有列没有填充,强制返回那一行。
例子:
<newline/>
视图中的继承
当你在一些普通或者特殊的模块中创建一个继承对象时,最好从一个已存在的视图中继承(而不是替换)来添加/修改/删除一些字段和保存。
例子:
<record model="ir.ui.view" id="view_partner_form"> <field name="name">res.partner.form.inherit</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <notebook position="inside"> <page string="Relations"> <field name="relation_ids" colspan="4" nolabel="1"/> </page> </notebook> </field> </record>
这里要在基本模块的res.partner.form视图的笔记本中添加一个页面。
继承引擎将解析存在的视图并且查询根节点
<field
name="arch" type="xml">
其将添加或者编辑这个标签的内容。如果这个标签有一些属性,其将查找匹配这些属性节点的父视图。
你将在position属性上使用这些值:
inside(默认的):在标签内部添加值
after:在标签后面添加内容
before:在标签前面添加值
replace:替换标签内容
替换内容:
<record model="ir.ui.view" id="view_partner_form1"> <field name="name">res.partner.form.inherit1</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <page string="Extra Info" position="replace"> <field name="relation_ids" colspan="4" nolabel="1"/> </page> </field> </record>
使用relation_ids字段替换笔记簿中Extra Info栏的内容
父视图和继承的视图使用--update=all 参数更新,如同其他视图一样。
内容删除
为从表单中删除一个字段,使用position="replace"属性的空元素。例如:
<record model="ir.ui.view" id="view_partner_form2"> <field name="name">res.partner.form.inherit2</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <field name="lang" position="replace"/> </field> </record>
内容插入
在指定标签使用position="before"属性给表单添加元素
<record model="ir.ui.view" id="view_partner_form3"> <field name="name">res.partner.form.inherit3</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <field name="lang" position="before"> <field name="relation_ids"/> </field> </field> </record>
在lang字段前添加relation_ids字段
在指定标签后给表单添加一个字段,使用position="after"属性
<record model="ir.ui.view" id="view_partner_form4"> <field name="name">res.partner.form.inherit4</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <field name="lang" position="after"> <field name="relation_ids"/> </field> </field> </record>
在lang字段后面添加relation_ids字段
Multiple Changes(多次变化)
为了多处发生变化,用一个数据元素封装字段
<record model="ir.ui.view" id="view_partner_form5"> <field name="name">res.partner.form.inherit5</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <data> <field name="lang" position="replace"/> <field name="website" position="after"> <field name="lang"/> </field> </data> </field> </record>
从lang的普通位置删除lang字段,并在website字段后显示
XPath Element
有时候一个视图通过名字简单定义一个定义一个target字段太复杂。例如,这个字段可能位于两个地方。当处理这种情况时,你可使用xpath元素来描述变化发生的地方。
<record model="ir.ui.view" id="view_partner_form6"> <field name="name">res.partner.form.inherit6</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <data> <xpath expr="//field[@name='address']/form/field[@name='email']" position="after"> <field name="age"/> </xpath> <xpath expr="//field[@name='address']/tree/field[@name='email']" position="after"> <field name="age"/> </xpath> </data> </field> </record>
在地址列表的表单和树视图email字段后面添加age字段
指定你想使用的视图
有时候你想指定一个视图而不是用默认的
如果一个对象对应着几个表单视图或者树视图
如果你想通过关联id来改变使用的表单或者树视图(one2many例子)
使用priority字段
在视图定义中,这个字段是可用的,默认值为16.一般地,OpenERP将显示使用最高优先级的模式(最小值)。例如,假设对于一个模式我们有两个视图。模式客户端有两个字段:firstname和lastname。我们将定义两个视图,一个显示首先firstname,另一个首先显示lastName。
<!-- Here is the first view for the model 'client'. We don't specify a priority field, which means by default 16. --> <record model="ir.ui.view" id="client_form_view_1"> <field name="name">client.form.view1</field> <field name="model">client</field> <field name="type">form</fiel> <field name="arch" type="xml"> <field name="firstname"/> <field name="lastname"/> </field> </record> <!-- A second view, which show fields in an other order. We specify a priority of 15. --> <record model="ir.ui.view" id="client_form_view_2"> <field name="name">client.form.view2</field> <field name="model">client</field> <field name="priority" eval="15"/> <field name="type">form</fiel> <field name="arch" type="xml"> <field name="lastname"/> <field name="firstname"/> </field> </record>
闲杂,每次OpenERP得为独享client显示一个表单视图,在两个视图之间有一个选择。其将总是使用第二个视图,因为有高点的优先级。除非你告诉它使用第一个。
Specify per-action view
为说明这点,我们将创建两个表单项来显示client对象的表单视图
<!-- This action open the default view (in our case, the view with the highest priority, the second one) --> <record model="ir.actions.act_window" id="client_form_action"> <field name="name">client.form.action</field> <field name="res_model">client</field> <field name="view_type">form</field> <field name="view_mode">form</field> </record> <!-- This action open the view we specify. --> <record model="ir.actions.act_window" id="client_form_action1"> <field name="name">client.form.action1</field> <field name="res_model">client</field> <field name="view_type">form</field> <field name="view_mode">form</field> <field name="view_id" ref="client_form_view_1"/> </record> <menuitem id="menu_id" name="Client main menu"/> <menuitem id="menu_id_1" name="Here we don't specify the view" action="client_form_action" parent="menu_id"/> <menuitem id="menu_id_1" name="Here we specify the view" action="client_form_action1" parent="menu_id"/>
如你所见,我们可以指定一个视图。这意味着当我们打开第二个菜单时,OpenERP将使用表单视图client_form_view_1,而不仅仅取决于优先级。
注意
如果你要关联一个在其他模块定义的视图,记得使用ref属性的模块名(module.view_id)
指定关联字段的视图
使用上下文
虽然view_id在菜单/action中工作的很好,但是如何指定一个视图使用one2many字段?当你有一个one2many字段时,使用两个视图。一个树视图(蓝色),和当你点击红色按钮时显示的表单视图
当你在一个表单视图中添加一个one2many字段,你应该做这些:
<field name="order_line" colspan="4" nolabel="1"/>
如果你想指定要使用的视图,你可以添加一个上下文属性,并为每类支持的视图指定一个视图id,如同action中的view_id属性一样,除了提供的视图id必须是全限定模块名,甚至是必须属于同一个模块。
注意
你得将模块名放在view_id中,因为当视图显示的时候已经评估,并且当XML文件解析时没有评估,所以了模块名信息不可用。结果是将使用默认的视图(看下面的)
如果你没有指定视图,OpenERP将按照以下顺序选择一个:
将使用定义在字段中的<form>或者<tree>视图
或者,使用这个对象优先级最高的视图
最后,创建默认的空视图,含有所有字段
注意
上下文关键字命名为<视图类型>_view_ref
注意
默认地,OpenERP从不使用不是为你的对象定义的视图。如果你有两个模块,有相同的字段,但是了有不同的model名字,OpenERP将从不使用其中一个的视图,甚至是一个模型继承了另一个模型
你可以强制性手动控制一个视图,要不在action或者在上下文中。
使用子视图
在关联字段的情况下,你可以直接在一个字段里面直接创建一个视图。
<record model="ir.ui.view" id="some_view"> <field name="name">some.view</field> <field name="type">form</field> <field name="model">some.model.with.one2many</field> <field name="arch" type="xml"> <field name="..."/> <!-- <=== order_line is a one2many field --> <field name="order_line" colspan="4" nolabel="1"> <form> <field name="qty"/> ... </form> <tree> <field name="qty"/> ... </tree> </field> </field>
如果开发人员想在另一个模块中继承这个视图,你需要继承其父视图并且修改其子字段。在子视图中,你通常需要使用XPath Element来确切描述在哪里放置你的新字段。
<record model="ir.ui.view" id="some_inherited_view"> <field name="name">some.inherited.view</field> <field name="type">form</field> <field name="model">some.model.with.one2many</field> <field name="inherit_id" ref="core_module.some_view"/> <field name="arch" type="xml"> <data> <xpath expr="//field[@name='order_line']/form/field[@name='qty']" position="after"> <field name="size"/> </xpath> <xpath expr="//field[@name='order_line']/tree/field[@name='qty']" position="after"> <field name="size"/> </xpath> </data> </field>
像这样定义子视图不利的一面是其不能继承自身,其仅能被其父视图继承。你的视图将更灵活 如果分开定义子视图并之后指定哪个子视图定义 one2many 字段部分。
相关文章推荐
- OpenERP Server Developers Documentation (Openerp服务器开发文档)之 Module 之 Views and Events
- OpenERP Server Developers Documentation之Objects, Fields and Methods
- OpenERP Server Developers Documentation (Openerp服务器开发文档)之 Menus and Actions(菜单和动作)
- OpenERP Server Developers Documentation (Openerp服务器开发文档)之 Module 之 Example of module creation
- OpenERP Server Developers Documentation之Ir Actions
- OpenERP Server Developers Documentation之Architecture(1)
- OpenERP Server Developers Documentation¶之Module structure(模块结构)
- unigui : ServerModule and MainModule
- Java Server Faces Events And Listeners (JSF中的事件与监听器)
- 立即注册Oracle虚拟开发者日:Oracle WebLogic Server & Java EE (Virtual Developer Day: A New Breed of Events for Java developers )
- Django push: Using Server-Sent Events and WebSocket with Django
- An Introduction to Dynamic Management Views and Functions in SQL Server 2005
- Play Framework, Server Sent Events and Internet Explorer
- Django push: Using Server-Sent Events and WebSocket with Django
- SAP Module Pool Program Learning Documentation——Commit Work and Update dtab
- [Drupal] Simple tutorial of setting multi subdomain with Domain Access module and Views module
- Tutorial: JSF 2 and HTML5 Server Sent Events
- Java Server Faces Events And Listeners (JSF中的事件与监听器)
- Patent application title: Fa Assignment Method, Fa Assignment Module and Policy Server in the Wirele
- tomcat and server configuration for loadrunner test