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 ...
随机推荐
- Android之Android apk动态加载机制的研究(二):资源加载和activity生命周期管理
转载请注明出处:http://blog.csdn.net/singwhatiwanna/article/details/23387079 (来自singwhatiwanna的csdn博客) 前言 为了 ...
- 监听Listview的滚动状态,是否滚动到了顶部或底部
/** * @author:Jack Tony * @description : 监听listview的滑动状态,如果到了顶部就刷新数据 * @date :2015年2月9日 */ private c ...
- [Web前端] 给li设置float浮动属性之后,无法撑开外层ul的问题。
cp from : https://www.cnblogs.com/cielzhao/p/5781462.html 最近在项目中有好几次遇到这个问题,感觉是浮动引起的,虽然用<div style ...
- Java的四个基本特性和对多态的理解
Java面向对象的四大基本特性:抽象.封装.继承.多态. 多态的实现方式:重载.继承.接口 Java中多态性的实现 什么是多态 面向对象的三大特性:封装.继承.多态.从一定角度来看,封装和继承几乎都是 ...
- MSDN离线版 发现不少人都在找这个
MSDN离线版 发现不少人都在找这个,无意中找到 VS2012旗舰版 选好语言,建议选那个ISO的下载
- Go语言之高级篇beego框架安装与使用
一.beego框架 1.beego框架简介 beego 是一个快速开发 Go 应用的 HTTP 框架,他可以用来快速开发 API.Web 及后端服务等各种应用,是一个 RESTful 的框架,主要设计 ...
- 使用C#反射机制访问类的私有成员【转】
首先我必须承认访问一个类的私有成员不是什么好做法.大家也都知道私有成员在外部是不能被访问的.而一个类中会存在很多私有成员:如私有字段.私有属性.私有方法.对于私有成员访问,可以套用下面这种非常好的方式 ...
- C# 同一应用程序域不同线程之间的参数传递方式
很久没有写博客了,最近的项目不用写代码.今天没事就看看thread之间的参数传递方式,这里主要适用于运行在不同线程的两个方法之间参数传递.直接看代码 1.方法之间直接传递参数 void DemoPar ...
- Android -- ConditionVariable
线程操作经常用到wait和notify,用起来稍显繁琐,而Android给我们封装好了一个ConditionVariable类,用于线程同步.提供了三个方法block().open().close() ...
- 【Spark】SparkStreaming-提交到集群运行
SparkStreaming-提交到集群运行 spark streaming 提交_百度搜索 SparkStreaming示例在集群中运行 - CSDN博客