odoo12新特性: 配置面板

odoo12 配置面板, 效果如下

   

搜索框与视图区域之间的区块 为 配置面板

点击 配置项目,弹出配置窗口, 例如 点击 配置会计难度, 弹出会计年度设置窗口

   

配置面板的内容 通过视图 的属性 banner_route 获取。 例如

<kanban create="false" class="oe_background_grey o_kanban_dashboard o_account_kanban" banner_route="/account/account_dashboard_onboarding">

   

这表明, 日记账看板视图的配置面板内容来自于 控制器 /account/account_dashboard_onboarding

   

控制器返回的内容结构如下

   

相关文档:

banner_route

a route address to be fetched and prepended to the view.

If this attribute is set, the controller route url will be fetched and displayed above the view. The json response from the controller should contain an "html" key.

If the html contains a stylesheet <link> tag, it will be removed and appended to <head>.

To interact with the backend you can use <a type="action"> tags. Please take a look at the documentation of the _onActionClicked method of AbstractController (addons/web/static/src/js/views/abstract_controller.js) for more details.

Only views extending AbstractView and AbstractController can use this attribute, like FormsKanbanLists, …

Example:

<tree banner_route="/module_name/hello" />

   

class MyController(odoo.http.Controller):
@http.route('/module_name/hello', auth='user', type='json')
def hello(self):
return {
'html': """
<div>
<link href="/module_name/static/src/css/banner.css"
rel="stylesheet">
<h1>hello, world</h1>
</div> """
}