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,
        }
相关推荐
令狐少侠20119 分钟前
centos7安装MySQL8.4手册
linux·mysql
拉不动的猪31 分钟前
前端小白之 CSS弹性布局基础使用规范案例讲解
前端·javascript·css
伍哥的传说36 分钟前
React强大且灵活hooks库——ahooks入门实践之开发调试类hook(dev)详解
前端·javascript·react.js·ecmascript·hooks·react-hooks·ahooks
界面开发小八哥1 小时前
界面控件Kendo UI for Angular 2025 Q2新版亮点 - 增强跨设备的无缝体验
前端·ui·界面控件·kendo ui·angular.js
程序员JerrySUN1 小时前
深度理解 KVM:Linux 内核系统学习的重要角度
java·linux·学习
大母猴啃编程2 小时前
Linux权限
linux·运维·服务器
weixin_457665392 小时前
基于可变参模板的线程池
linux·c++
麟城Lincoln2 小时前
【Linux-云原生-笔记】LVS(Linux virual server)相关
linux·笔记·云原生·lvs·nat·dr·ipvsadm
枷锁—sha2 小时前
从零掌握XML与DTD实体:原理、XXE漏洞攻防
xml·前端·网络·chrome·web安全·网络安全
F2E_Zhangmo2 小时前
基于cornerstone3D的dicom影像浏览器 第二章,初始化页面结构
前端·javascript·vue·cornerstone3d·cornerstonejs