v 11.0 v 12.0 Third Party 196
Download for v 11.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 39
Technical Name web_tree_view_cp_buttons
LicenseLGPL-3
Websitehttps://github.com/cognichain/odoo-basic-extension
Versions 12.0 11.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)

# Add custom buttons in tree views

该模块可以为列表视图添加额外的操作按钮,而非 server actions 的按钮一样显示在 Action 下拉按钮列表中。

## Usage

  • 在定义窗口动作(ir.actions.act_window)时,在 context 中添加 {'tree': {'buttons': [{'name': 'My Action', 'classes': 'oe_link', 'action': 'act_name'}]}}

```xml <!-- 在该例中,会在打开的列表视图的导入按钮旁新增一个名为 My Action 的按钮,点击按钮将会执行 my.model 模型中定义的方法 act_name --> ... <record id="action_open_view" model="ir.actions.act_window">

... <field name="res_model">my.model</field> <field name="view_mode">tree,form</field> <field name="context">{'tree': {'buttons': [{'name': 'My Action', 'classes': 'oe_link', 'action': 'act_name'}]}}<field/> ...

</record> ... ```

其中 classes 是要为按钮添加的类,多个类以空格分隔;action 是该按钮点击时所要执行的动作,其值为当前所打开的列表视图记录所属模型下的方法的名称。

buttons 列表中可以定义多个按钮的数据,为列表视图同时添加多个操作按钮。

## 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.