openerp学习笔记 视图继承(tree、form、search)
支持的视图类型:form、tree、search ...
支持的定位方法:
<notebook position="inside">
<xpath expr="//page[@name='page_history']" position="inside">
<field name="mobile" position="after">
<filter name="consumable" position="after">
<group name="bank" position="after">
<xpath expr="//field[@name='standard_price']" position="replace">
<xpath expr="//button[@name='open_ui']" position="replace">
<xpath expr="//div[@class='oe_employee_details']/h4/a"
position="after">
<xpath
expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='analytic_account_id']"
position="replace">
<xpath
expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='analytic_account_id']"
position="replace">
支持的规则:before、after、replace、inside、attributes
插入:
position='before'
position="after"
<field name="mobile" position="after">
<field name="sale_order_count"/>
</field>
<filter name="consumable"
position="after">
<separator/>
<filter name="filter_to_qty_available" string="在手数量>0"
icon="terp-accessories-archiver+" domain="[('qty_available', '>',
0)]"/>
<filter name="filter_to_virtual_available" string="预测数量>0"
icon="terp-accessories-archiver+" domain="[('virtual_available', '>',
0)]"/>
</filter>
替换:
position="replace"
<xpath expr="//field[@name='standard_price']"
position="replace">
<group name='cost_prices' colspan="2"
col="4">
<field name="standard_price" nolabel="1"
attrs="{'readonly':[('cost_method','=','average')]}"/>
<field name="cost_price_extra"
groups="product.group_product_variant"/>
</group>
</xpath>
<xpath expr="//button[@name='open_ui']"
position="replace">
<button name="open_ui" type="object" string="Start Selling"
attrs="{'invisible' : [('pos_state', 'not in', ('opened',))]}"
class="oe_highlight"
invisible="True"/>
</xpath>
内部创建:?
position="inside"
<xpath expr="//page[@name='page_history']" position="inside">
<group name="grp_task" string="Tasks">
<field name="task_ids" colspan="4" nolabel="1">
<tree string="Tasks" editable="bottom">
<field name="name"/>
<field name="user_id"/>
<field name="date_deadline"/>
<field name="state" invisible="1"/>
<button name="do_open" states="pending,draft,done,cancelled"
string="Start Task" type="object" icon="gtk-media-play" help="For
changing to open state"
invisible="context.get('set_visible',False)"/>
<button name="action_close" states="draft,pending,open"
string="Done" type="object" icon="terp-dialog-close" help="For changing
to done state"/>
</tree>
</field>
</group>
</xpath>
修改属性:修改属性能够实现的功能,不要使用 replace
position="attributes"
<xpath expr="//field[@name='name']"
position="attributes">
<attribute
name="required">1</attribute>
</xpath>
示例代码:
<record
id="product_normal_variant_form_view"
model="ir.ui.view">
<field
name="name">product.normal.variant.form</field>
<field
name="model">product.product</field>
<field
name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"
/>
<field name="arch"
type="xml">
<data>
<xpath expr="//field[@name='name']"
position="attributes">
<attribute
name="required">1</attribute>
</xpath>
<xpath expr="//field[@name='standard_price']"
position="replace">
<group name='cost_prices' colspan="2"
col="4">
<field name="standard_price" nolabel="1"
attrs="{'readonly':[('cost_method','=','average')]}"/>
<field name="cost_price_extra"
groups="product.group_product_variant"/>
</group>
</xpath>
<sheet>
<group col="2" colspan="2" groups="base.group_extended"
position="replace">
<group colspan="2" col="6" name="weight"
groups="base.group_extended">
<field name="is_multi_variants"
invisible="1"/>
<group colspan="2"
col="2">
<separator string="Template Weights"
colspan="2"/>
<field digits="(14, 3)" name="volume"
attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" name="weight"
attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" name="weight_net"
attrs="{'readonly':[('type','=','service')]}"/>
</group>
<group colspan="2" col="2"
attrs="{'invisible':[('is_multi_variants','=',False)]}">
<separator string="Variant Weights"
colspan="2"/>
<field digits="(14, 3)" name="additional_volume"
attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" name="additional_weight"
attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" name="additional_weight_net"
attrs="{'readonly':[('type','=','service')]}"/>
</group>
<group colspan="2" col="2"
attrs="{'invisible':[('is_multi_variants','=',False)]}">
<separator string="Total Weights"
colspan="2"/>
<field digits="(14, 3)"
name="total_volume"/>
<field digits="(14, 3)"
name="total_weight"/>
<field digits="(14, 3)"
name="total_weight_net"/>
</group>
</group>
</group>
</sheet>
</data>
</field>
</record>
<!-- 隐藏 open_ui 按钮
-->
<record
model="ir.ui.view"
id="pos_session_opening_form_view_openui">
<field
name="name">pos.session.opening.form.view.openui</field>
<field
name="model">pos.session.opening</field>
<field name="inherit_id"
ref="point_of_sale.pos_session_opening_form_view"/>
<field name="arch"
type="xml">
<xpath expr="//button[@name='open_ui']"
position="replace">
<button name="open_ui" type="object" string="Start Selling"
attrs="{'invisible' : [('pos_state', 'not in', ('opened',))]}"
class="oe_highlight"
invisible="True"/>
</xpath>
</field>
</record>
<record
id="product_search_form_view_filter"
model="ir.ui.view">
<field
name="name">product.search.form.filter</field>
<field
name="model">product.product</field>
<field name="inherit_id"
ref="product.product_search_form_view"/>
<field name="arch"
type="xml">
<filter name="consumable"
position="after">
<separator/>
<filter name="filter_to_qty_available" string="在手数量>0"
icon="terp-accessories-archiver+" domain="[('qty_available', '>',
0)]"/>
<filter name="filter_to_virtual_available" string="预测数量>0"
icon="terp-accessories-archiver+" domain="[('virtual_available', '>',
0)]"/>
</filter>
</field>
</record>
<!-- Partner kanban view inherte -->
<record
model="ir.ui.view"
id="crm_lead_partner_kanban_view">
<field
name="name">res.partner.kanban.saleorder.inherit</field>
<field
name="model">res.partner</field>
<field name="inherit_id"
ref="base.res_partner_kanban_view"/>
<field name="priority"
eval="20"/>
<field name="arch"
type="xml">
<field name="mobile"
position="after">
<field
name="sale_order_count"/>
</field>
<xpath expr="//div[@class='oe_kanban_partner_links']"
position="inside">
<a name="%(sale.act_res_partner_2_sale_order)d" type="action"
t-if="record.sale_order_count.value>0">
<t t-esc="record.sale_order_count.value"/>
Sales
</a>
</xpath>
</field>
</record>
<!-- Partners inherited form -->
<record
id="view_task_partner_info_form"
model="ir.ui.view">
<field
name="name">res.partner.task.info.inherit</field>
<field
name="model">res.partner</field>
<field name="inherit_id"
ref="base.view_partner_form"/>
<field name="arch"
type="xml">
<xpath expr="//page[@name='page_history']"
position="attributes">
<attribute
name="invisible">False</attribute>
</xpath>
<xpath expr="//page[@name='page_history']"
position="inside">
<group name="grp_task"
string="Tasks">
<field name="task_ids" colspan="4"
nolabel="1">
<tree string="Tasks"
editable="bottom">
<field
name="name"/>
<field
name="user_id"/>
<field
name="date_deadline"/>
<field name="state"
invisible="1"/>
<button name="do_open" states="pending,draft,done,cancelled" string="Start
Task" type="object" icon="gtk-media-play" help="For changing to open state"
invisible="context.get('set_visible',False)"/>
<button name="action_close" states="draft,pending,open" string="Done"
type="object" icon="terp-dialog-close" help="For changing to done
state"/>
</tree>
</field>
</group>
</xpath>
</field>
</record>
openerp学习笔记 视图继承(tree、form、search)的更多相关文章
- openerp学习笔记 视图(tree\form)中隐藏按钮( 创建、编辑、删除 ),tree视图中启用编辑
视图(tree\form)中隐藏按钮( 创建.编辑.删除 )create="false" edit="false" delete="false&quo ...
- openerp学习笔记 视图样式(表格行颜色、按钮,字段只读、隐藏,按钮状态、类型、图标、权限,group边距,聚合[合计、平均],样式)
表格行颜色: <tree string="请假单列表" colors="red:state == 'refuse';blue:state = ...
- openerp学习笔记 对象继承,对象初始化数据
1.对象继承 _inherit = "product.product" 继承产品对象,给产品对象添加字段或方法,不需要设置 _name._table 等属性 注意: ...
- openerp学习笔记 视图中字段只变化(on_change)联动其他字段值、选择和过滤
1.修改产品数量时,自动计算产品销售金额.销售成本和销售利润<field name="num" on_change="on_change_product(produ ...
- openerp学习笔记 视图更新时删除已存在的菜单或其他对象
删除菜单示例: <delete id="base.menu_module_updates" model="ir.ui.menu"/><dele ...
- c++学习笔记之继承篇
title: c++学习笔记之继承篇 date: 2017-03-26 16:36:33 tags: [c++,继承,public,virtual,private,protected] categor ...
- openerp学习笔记 统计、分析、报表(过滤条件向导、分组报表、图形分析、比率计算、追加视图排序)
待解决:图形中当改变分组时,图例不正确 存储比率计算时,分组合计不正确 wizard:过滤条件向导,用于输入过滤条件 wizard/sale_chart.py # -*- cod ...
- openerp学习笔记 搜索视图(自己创建的、自己的、本部门的、本部门及下属部门的、今日的、日期从,日期至、多条件模糊搜索、or、and)
自己创建的: domain="[('create_uid','=',uid)]" 自己的: domain="[('employee_id','=','#kl_user_e ...
- openerp学习笔记 context 的应用
1.在Action中定义,context用于传递搜索条件和分组条件,在搜索视图中默认显示: 示例代码: <record model="ir.actions.act_window&quo ...
随机推荐
- Java枚举的七种常见用法
用法一:常量 在JDK1.5之前,我们定义常量都是:publicstaticfianl.....现在好了,有了枚举,可以把相关的常量分组到一个枚举类型里,而且枚举提供了比常量更多的方法. Java代码 ...
- Material Designer的低版本兼容实现(十)—— CheckBox & RadioButton
ChekBox的用途我们就不必多说了,算是一个很古老的控件了,何其类似的还有RadioButton,这个东西因为我目前还没写出来,所以用了别人的一个lib,这下面会说到.顺便说一句,如果你的app是在 ...
- Hype cycle(Gartner 成熟度曲线)
Hype cycle The hype cycle is a branded graphical presentation developed and used by the American ...
- Kafka深度解析(如何在producer中指定partition)(转)
原文链接:Kafka深度解析 背景介绍 Kafka简介 Kafka是一种分布式的,基于发布/订阅的消息系统.主要设计目标如下: 以时间复杂度为O(1)的方式提供消息持久化能力,即使对TB级以上数据也能 ...
- ExtJS梦想之旅(八)--GridPanel和EditorGridPanel的使用
表格在web开发中会经常被使用到,是一种非常重要的组件,因此ExtJS在这方面做得也很出色,在这里也作为一个重点的组件来和大家分享,共同探讨一下. Ext.grid.GridPanel此类系基于Gri ...
- go语言之进阶篇通过range遍历channel内容
1.通过range遍历channel内容 package main import ( "fmt" ) func main() { ch := make(chan int) //创建 ...
- 使用 CSS 接收用户的点击事情并对相关节点进行操作
问题背景:使用纯 CSS 方案,实现导航栏tab切换 实现 Tab 切换的难点在于如何使用 CSS 接收到用户的点击事情并对相关的节点进行操作.即是: 如何接收点击事件 如何操作相关DOM 下面看看如 ...
- (转)Unity3D研究院之Assetbundle的实战(六十三)
上一篇文章中我们相惜讨论了Assetbundle的原理,如果对原理还不太了解的朋友可以看这一篇文章:Unity3D研究院之Assetbundle的原理(六十一) 本篇文章我们将说说assetbundl ...
- A Complete ActiveX Web Control Tutorial
A Complete ActiveX Web Control Tutorial From: https://www.codeproject.com/Articles/14533/A-Complete- ...
- ZOJ 3456 Traveler Nobita 最小生成树
Traveler Nobita Time Limit: 2 Seconds Memory Limit: 65536 KB One day, Nobita used a time machin ...