隐藏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))])

最新文章

  1. 基于Caffe的DeepID2实现(中)
  2. Maven+Spring+Spring MVC+MyBatis+MySQL,搭建SSM框架环境【转】
  3. CGGeometry.h 文件详解
  4. thinkphp修改及编写标签库,编辑器的使用
  5. div的一些易出错地方
  6. linux设备驱动归纳总结(八):1.总线、设备和驱动【转】
  7. 树-伸展树(Splay Tree)
  8. 用Android++在Visual Studio中用C/C++开发Android应用
  9. gooflow0.6的流程设计
  10. doT.js实例详解
  11. DelayQueue的原理和使用浅谈
  12. EntityFramework Core进行读写分离最佳实践方式,了解一下(一)?
  13. stringstream
  14. stm8 iar开发
  15. STM32应用实例五:与SHT1X温湿度传感器通讯
  16. virt-install vs qemu-kvm创建guest主机
  17. Django model转字典的几种方法
  18. tomcat catalina.out日志切割(logrotate)
  19. Python2.7-shutil
  20. C# 验证过滤代理IP是否有效

热门文章

  1. 成熟企业级开源监控解决方案Zabbix6.2关键功能实战-上
  2. 检测轮廓 获取其最值的坐标 opencv-python
  3. Sprint产品待办列表的优先级要怎么排?
  4. 关于C#Section配置未初始化的问题
  5. RabbitMQ 常见问题
  6. adb版本不同导致一个服务杀死另一个服务
  7. label studio 结合 MMDetection 实现数据集自动标记、模型迭代训练的闭环
  8. 《浅谈亚 log 数据结构在 OI 中的应用》阅读随笔
  9. day29-JQuery02
  10. Golang反射获得变量类型和值