odoo 按钮打印pdf报表

odoo打印一般是在动作里面进行的

所以此方法可用自定义按钮进行打印

xml 复制代码
<template id="report_sale_line_packing_template">
xxx
</template>
    <template id="report_sale_line_packing">
        <t t-call="web.basic_layout">
            <t t-foreach="docs" t-as="o">
                <div class="page">
                    <t t-call="sale_reports.report_sale_line_packing_template"/>
                </div>
            </t>
        </t>
    </template>
<record id="action_report_sale_line_list" model="ir.actions.report">
        <field name="name">销售明细</field>
        <field name="model">sale.order.line</field>
        <field name="report_type">qweb-pdf</field>
        <field name="report_name">sale_reports.report_sale_line_packing</field>
        <field name="report_file">sale_reports.report_sale_line_packing</field>
        <field name="print_report_name">'销售明细%s' %(object.name or '')</field>
        <field name="binding_model_id" ref="model_sale_order_line"/>
        <field name="binding_type">report</field>
    </record>
python 复制代码
    def action_report_data(self):
        url = '%s/report/pdf/sale_reports.report_sale_line_packing/%s' % (self.get_base_url(), self.id)
        return {
            'type': 'ir.actions.act_url',
            'name': "销售明细报表",
            'target': 'new',
            'url': url,
            'res_id': self.id,
        }
相关推荐
清风~徐~来2 小时前
【Linux】环境变量
linux·运维·chrome
在无清风2 小时前
Java实现Redis
前端·windows·bootstrap
_一条咸鱼_3 小时前
Vue 配置模块深度剖析(十一)
前端·javascript·面试
yechaoa4 小时前
Widget开发实践指南
android·前端
Willliam_william4 小时前
QEMU学习之路(8)— ARM32通过u-boot 启动Linux
linux·学习·elasticsearch
前端切图仔0014 小时前
WebSocket 技术详解
前端·网络·websocket·网络协议
JarvanMo5 小时前
关于Flutter架构的小小探讨
前端·flutter
前端开发张小七5 小时前
每日一练:4.有效的括号
前端·python
顾林海5 小时前
Flutter 图标和按钮组件
android·开发语言·前端·flutter·面试
橘猫0.o6 小时前
【Linux 并发与竞争实验】
linux·运维·服务器·驱动开发