Odoo View 常用技巧
隐藏Field
<field name="currency_id" invisible="True"/>
<field name="currency_id" invisible="1"/>
在某种条件下隐藏
<field name="expense_description" attrs="{'invisible':[('expense_audit','!=','1')]}" />
隐藏label
<field name="description" widget="html" nolabel="True"/>
<field name="description" widget="html" nolabel="1"/>
只读 readonly
<field name="budget_id" readonly="True"/>
条件 domain
<field name="product_id" domain="[('pro_type','=','rests')]"/>
设定值 eval
<field name="fill_date" eval="datetime.now()" readonly="True"/>
表单传值 context (以 default_ 开始代表直接赋值过去)
<button class="oe_stat_button" name="%(budget_review_action)d" type="action" icon="fa-calendar-check-o" attrs="{'invisible':[('state','!=','check')]}" context="{'default_budget_id': id, 'default_contract_area': square, 'default_contract_price': total_price, 'default_start_date': start_date, 'default_end_date': end_date}" string="创建审核单"/>a
Widget
many2one widget (default)
- no_quick_create - remove the Create and edit... option.
- no_create_edit - remove the Create "search_value" option.
- no_create - no_quick_create and no_create_edit combined.
- no_open - in read mode: do not render as a link.
<field name="field_name" options="{'no_quick_create': True, 'no_create_edit' : True}"/>
many2many widget (default)
- no_create - remove the Create button.
<field name="field_name" options="{'no_create': True}"/>
many2many_tags widget
- no_quick_create - remove the Create and edit... option.
- no_create_edit - remove the Create "search_value" option.
- no_create - no_quick_create and no_create_edit together.
<field name="field_name" widget="many2many_tags" options="{'no_create_edit': True}"/>
one2many tree
- create - remove the Create button.
- edit - remove the Edit button.
- delete - remove the Delete button.
<field name="basic_incidentals" mode="tree" nolabel="1">
<tree create="false" edit="false" delete="false">
<field name="name"/>
<field name="model"/>
<field name="specifications"/>
<field name="price" invisible="True"/>
<field name="number" invisible="True"/>
<field name="unit" invisible="True"/>
<field name="total_price" invisible="True"/>
<field name="remarks" invisible="True"/>
</tree>
</field>
Fields
生成一个动态的Selection,比如当前时间的前后5年!
import datetime
year = fields.Selection(string=u'年度', selection=[(num, str(num)) for num in range((datetime.datetime.now().year - 5), (datetime.datetime.now().year + 5))])
Odoo View 常用技巧的更多相关文章
- Android ListView 常用技巧
Android ListView 常用技巧 Android TextView 常用技巧 1.使用ViewHolder提高效率 ViewHolder模式充分利用了ListView的视图缓存机制,避免了每 ...
- AS技巧合集「常用技巧篇」
转载:http://www.apkbus.com/forum.php?mod=viewthread&tid=254723&extra=page%3D2%26filter%3Dautho ...
- Android之ListView常用技巧
ListView是一个非常常用的列表控件,虽然在5.x时代ListView的风头正在逐渐的被RecyclerView抢去,但是ListView的使用范围依然十分广泛. 接下来的ListView的常用技 ...
- 3D游戏常用技巧Normal Mapping (法线贴图)原理解析——高级篇
1.概述 上一篇博客,3D游戏常用技巧Normal Mapping (法线贴图)原理解析——基础篇,讲了法线贴图的基本概念和使用方法.而法线贴图和一般的纹理贴图一样,都需要进行压缩,也需要生成mipm ...
- Idea工具常用技巧总结
转自:https://www.jianshu.com/p/131c2deb3ecf Idea常用技巧总结 1.无处不在的跳转 注:这里的快捷键是自己定义的,并非大家的都一样,可以通过findActio ...
- django入门7之django template和xadmin常用技巧
django入门7之django template和xadmin常用技巧 <li {% ' == '/course' %}class="active"{% endif %}& ...
- Android ListView 常用技巧总结
本文对 ListView 中的一些常用技巧做一个总结.附:虽然现在 RecyclerView 已逐渐取代 ListView,但实际情况是大部分项目中还在使用 ListView.当然,后续我会在我的博客 ...
- 【Java】Debug断点调试常用技巧
Debug操作技巧 Show Execution Point 将光标回到当前断点停顿的地方 Step Over 执行当前行代码,并将运行进度跳转到下一行. Step Into 进入到当前代码行的方法内 ...
- 【shell 大系】Linux Shell常用技巧
在最近的日常工作中由于经常会和Linux服务器打交道,如Oracle性能优化.我们数据采集服务器的资源利用率监控,以及Debug服务器代码并解决其效率和稳定性等问题.因此这段时间总结的有关Linux ...
- oracle存储过程常用技巧
我们在进行pl/sql编程时打交道最多的就是存储过程了.存储过程的结构是非常的简单的,我们在这里除了学习存储过程的基本结构外,还会学习编写存储过程时相关的一些实用的知识.如:游标的处理,异常的处理,集 ...
随机推荐
- 手把手教你从安装CentOS7.4镜像开始,搭建IoT视频监控系统
摘要:在CentOS7.4服务器版本的环境下安装nginx服务器.配置文件服务器.流媒体服务器. 本文分享自华为云社区<华为云ECS服务器安装CentOS7.4镜像,部署GINX服务器.搭建物联 ...
- 驱动开发:内核LDE64引擎计算汇编长度
本章开始LyShark将介绍如何在内核中实现InlineHook挂钩这门技术,内核挂钩的第一步需要实现一个动态计算汇编指令长度的功能,该功能可以使用LDE64这个反汇编引擎,该引擎小巧简单可以直接在驱 ...
- ubuntu+Django + nginx + uwsgi 部署
ubuntu+Django + nginx + uwsgi 部署 0.前期准备 注意:以下几件事都必须在激活虚拟环境下完成 运行以下命令生成项目所需的依赖列表,会在项目根目录生成一个requireme ...
- Python基础部分:10、数据类型的内置方法和字符编码
目录 一.数据类型内置方法 1.字典dict内置方法 1.1.类型转换 2.字典必须要掌握的方法 2.1.取值方式 2.2.修改内部数据值 2.3.删除数据 2.4.统计字典中键值对个数 2.5.字典 ...
- SpringBoot启动流程源码分析
前言 SpringBoot项目的启动流程是很多面试官面试中高级Java程序员喜欢问的问题.这个问题的答案涉及到了SpringBoot工程中的源码,也许我们之前看过别的大牛写过的有关SpringBoot ...
- 状态机的技术选型,yyds!
前言 今天跟大家分享一个关于"状态机"的话题.状态属性在我们的现实生活中无处不在.比如电商场景会有一系列的订单状态(待支付.待发货.已发货.超时.关闭):员工提交请假申请会有申请状 ...
- Go语言核心36讲13
我们已经讨论过了通道的基本操作以及背后的规则.今天,我再来讲讲通道的高级玩法. 首先来说说单向通道.我们在说"通道"的时候指的都是双向通道,即:既可以发也可以收的通道. 所谓单向通 ...
- 在服务器上搭建Jenkins自动化部署工具
在公司发现很多时候都需要手动部署,然后有天听到自动部署这个词想着有没有什么工具能够自动部署项目,最好能自动化部署前后端生成 docker images 运行方便管理.最后经过我各种筛查,发现用 jen ...
- QMetaObject::connectSlotsByName: No matching signal for xxx
问题描述 这个问题是没有与 xxx 这个槽函数匹配的信号,但是我做了 QMetaObject::connectSlotsByName(this);, 自动连接.并且确保了函数名和信号名是没有错误的,还 ...
- 关于windows7打不开hlp文件的解决方法
前言 其实也不是打不开,而是打开后是这样的. 也就是相当于打不开. 解决方案 安装对应架构版本补丁,重启电脑即可. 下载地址 包含64位和32位. 有能力的还望下载这个 下载地址 给我留点积分,感谢!