请问tree视图上面的工具条如何增加一个button并调用函数执行,请给个完整例子把
-
@battle 在 请问tree视图上面的工具条如何增加一个button并调用函数执行,请给个完整例子把 中说:
扩展list_view/form_view,buttons或sidebar
不用那么复杂的,定义一个server action然后然后绑定到一个action就可以了。@Joshua 举得例子在这里:
odoo/odoo/odoo/addons/base/module/wizard/base_modue_immediate_install.xml
<?xml version="1.0" encoding="UTF-8"?> <odoo> <data> <record id="action_server_module_immediate_install" model="ir.actions.server"> <field name="name">Module Immediate Install</field> <field name="condition">True</field> <field name="type">ir.actions.server</field> <field name="model_id" ref="model_ir_module_module" /> <field name="state">code</field> <field name="code">records.button_immediate_install()</field> </record> <record model="ir.values" id="action_module_immediate_install"> <field name="name">action_module_immediate_install</field> <field name="action_id" ref="action_server_module_immediate_install" /> <field name="value" eval="'ir.actions.server,' + str(ref('action_server_module_immediate_install'))" /> <field name="key">action</field> <field name="model_id" ref="model_ir_module_module" /> <field name="model">ir.module.module</field> <field name="key2">client_action_multi</field> </record> </data> </odoo>
当然你还需要在
ir.module.module
对象中定义server action调用的方法button_immediate_install
-
多谢各位,我研究一下,再给看一下这几个问题把
http://shine-it.net/topic/4492/新手求助大神2个问题/21.如图,安装后登录没菜单,已经重新下载了exe,装了几遍,数据库能打开,日志看起来也没看出什么,用源码运行依然如此,通过google浏览器和360(极速模式) f12中显示脚本加载是,不知道是不是这个原因,找了半天修改源码也没解决
web:1 Refused to execute script from 'http://localhost:8069/web/content/251-5bab1d0/web.assets_common.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
web:1 Refused to execute script from 'http://localhost:8069/web/content/252-d3605a5/web.assets_backend.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
web:1 Refused to execute script from 'http://localhost:8069/web/content/253-707a4ea/web_editor.summernote.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
web:1 Refused to execute script from 'http://localhost:8069/web/content/254-d3baaf7/web_editor.assets_editor.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
web:49 Uncaught TypeError: odoo.define is not a function2.怎样把1 one2many 2 两张表 ,在tree里 把2表的记录 横过来 和1表一起显示为一条记录,如工资详细项,详细不定,也就是列不定。
3.异常页面的错误提示中文显示不正常,为unicode编码问题 -
@digitalsatori
例子简答易懂,谢谢了。
想问一下,就是这里是根据某条或数条记录来调用函数的吧?也就是不点记录就没有这个菜单吧?
如果要像
这种和记录无关的函数的按钮应该怎么写?