odoo13 订单模板设置_Odoo12: 自定义配置面板

如题,Odoo开发过程中,有时遇到一些需求需要在页面中快速配置一些信息数据,此时就需要用到配置面板, 如下图所示:

配置面板

主要分三步:

一是定义配置面板的模板

二是定义路由渲染模板

三是给指定模型视图绑定模板路由

代码如下:

模板文件sale_onboarding_views.xml

Quotation Layout

Customize the look of your quotations.

Looks great!

Customize

Confirmation & Payment

Choose how to confirm quotations and get paid.

Set payments

Sample Quotation

Send a quotation to test the customer portal.

Send sample

sale.order.confirmation.onboarding.form

sale.payment.acquirer.onboarding.wizard

primary

1000

col col-4

How your customers can confirm an order

ir.actions.act_window

sale.payment.acquirer.onboarding.wizard

form

form

new

sale.onboarding.quotation.layout.form

res.company

primary

1000

Configure your document layout

ir.actions.act_window

res.company

form

form

new

mail.compose.message.sale.onboarding.sample.quotation.form

mail.compose.message

1000

primary

1

1

1

Send a sample quotation.

ir.actions.act_window

mail.compose.message

form

form

new

路由文件sale_onboarding_views.xml

# -*- coding: utf-8 -*-

# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import http

from odoo.http import request

class OnboardingController(http.Controller):

@http.route('/sales/sale_quotation_onboarding_panel', auth='user', type='json')

def sale_quotation_onboarding(self):

""" Returns the `banner` for the sale onboarding panel.

It can be empty if the user has closed it or if he doesn't have

the permission to see it. """

company = request.env.user.company_id

if not request.env.user._is_admin() or \

company.sale_quotation_onboarding_state == 'closed':

return {}

return {

'html': request.env.ref('sale.sale_quotation_onboarding_panel').render({

'company': company,

'state': company.get_and_update_sale_quotation_onboarding_state()

})

}

指定模型视图,添加banner_route属性,属性值为路由。

sale.order.tree

sale.order

primary

/sales/sale_quotation_onboarding_panel

以上, 为自定义配置面板大致过程。

============================================================================================================================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值