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,
        }
相关推荐
Irene19911 小时前
ElementPlus 与成熟后台框架对比:vue-element-plus-admin、vue-pure-admin等
前端·ui·框架·vue3
尘中客5 小时前
放弃 Echarts?前端直接渲染后端高精度 SVG 矢量图流的踩坑记录
前端·javascript·echarts·前端开发·svg矢量图·echarts避坑
FreeBuf_5 小时前
Chrome 0Day漏洞遭野外利用
前端·chrome
小彭努力中6 小时前
199.Vue3 + OpenLayers 实现:点击 / 拖动地图播放音频
前端·vue.js·音视频·openlayers·animate
有毒的教程6 小时前
Ubuntu 虚拟机磁盘空间不足完整解决教程
linux·运维·ubuntu
2501_916007476 小时前
网站爬虫原理,基于浏览器点击行为还原可接口请求
前端·javascript·爬虫·ios·小程序·uni-app·iphone
前端大波6 小时前
Sentry 每日错误巡检自动化:设计思路与上手实战
前端·自动化·sentry
Highcharts.js7 小时前
适合报表系统的可视化图表|Highcharts支持直接导出PNG和PDF
javascript·数据库·react.js·pdf
ZC跨境爬虫7 小时前
使用Claude Code开发校园交友平台前端UI全记录(含架构、坑点、登录逻辑及算法)
前端·ui·架构
慧一居士7 小时前
Vue项目中,何时使用布局、子组件嵌套、插槽 对应的使用场景,和完整的使用示例
前端·vue.js