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,
        }
相关推荐
海棠蚀omo8 分钟前
Linux操作系统-命令行参数及环境变量
linux·操作系统
普通码农9 分钟前
uni.setClipboardData在 iOS 剪贴板复制失败解决方案
前端
_孤傲_11 分钟前
webpack实现常用plugin
前端·webpack·node.js
小白不想白a21 分钟前
【shell】每日shell练习(系统用户安全审计/系统日志错误分析)
linux·运维·云原生
golang学习记22 分钟前
从0死磕全栈之Next.js 字体优化实战:零布局偏移、高性能、隐私友好的字体加载方案
前端
zachhere27 分钟前
深入了解 OpenAI Apps SDK 的内部机制
前端
张可爱30 分钟前
20251015-Vue3八股文整理
前端
ruanCat31 分钟前
记一次因 vue-router 升级而导致的 uniapp 故障
前端·vue.js
Damon小智31 分钟前
基于 Rokid JSAR 打造精致的 3D 白色飞机模型
前端·虚拟现实