Skip to Content
Menu
v 11.0 v 12.0 Third Party 304
Download for v 12.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 56
Technical Name web_form_dynamic_button
LicenseLGPL-3
Websitehttps://github.com/cognichain/odoo-basic-extension
Versions 11.0 12.0
You bought this module and need support? Click here!

[![License](https://img.shields.io/badge/license-LGPL--3.0-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0-standalone.html)

# Hide buttons in form views

该模块可根据表达式对表单视图上的控制按钮进行动态显示或隐藏,目前支持对如下按钮进行处理:

  • 编辑按钮 Edit
  • 创建按钮 Create
  • 删除按钮 Delete
  • 复制按钮 Duplicate

## Features

  • 添加属性 edit_expr 到表单 form 标签中以在表达式成立时才显示编辑按钮
  • 添加属性 create_expr 到表单 form 标签中以在表达式成立时才显示创建按钮
  • 添加属性 delete_expr 到表单 form 标签中以在表达式成立时才显示删除按钮
  • 添加属性 duplicate_expr 到表单 form 标签中以在表达式成立时才显示复制按钮

## Usage

  • 在定义表单视图时,添加属性 edit_expr="state == 'draft'"form 标签内:

```xml <!-- 在该例中,当 state 不为 draft 时,编辑按钮将会被隐藏,反之则会显示 --> ... <field name="arch" type="xml">

<form string="View name" edit_expr="state == 'draft'">
<header>
<field name="state" widget="statusbar" statusbar_visible="draft,done" nolabel="1" readonly="1"/>

</header> ... <field name="name"/> ...

</form>

</field> ... ```

Features 中列出的属性可以同时使用,如上例所示,直接添加相应的属性到 form 标签中即可。

## Bug Tracker

如果遇到任何问题,欢迎在 [GitHub Issues](https://github.com/cognichain/odoo-basic-extension/issues) 进行反馈。

## Credits

### Contributors

### Maintainer

<img src="./static/description/icon.png" width="20%" alt="深圳市知链科技有限公司" />

该模块由深圳市知链科技有限公司开发及维护。

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.