https://www.odoo.com/documentation/12.0/reference/reports.html     具体的看官方文档

一、纸张格式设置:

  1. <record id="paperformat_frenchcheck" model="report.paperformat">
  2. <field name="name">French Bank Check</field>
  3. <field name="default" eval="True"/>
  4. <field name="format">custom</field>
  5. <field name="page_height">80</field>
  6. <field name="page_width">175</field>
  7. <field name="orientation">Portrait</field>
  8. <field name="margin_top">3</field>
  9. <field name="margin_bottom">3</field>
  10. <field name="margin_left">3</field>
  11. <field name="margin_right">3</field>
  12. <field name="header_line" eval="False"/>
  13. <field name="header_spacing">3</field>
  14. <field name="dpi">80</field>
  15. </record>

    二、菜单按钮:
  1. <report
    attachment_use="False"
    model="product.product" #要打印模块
    report_type="qweb-pdf"
    id="print_product_menu_barcode"
    string="打印条码"
    name="product.print_template_barcode"
  1. file="product.print_template_barcode" #打印文件
  1. paperformat="product.paperformat_frenchcheck" #打印纸张格式
  1. />


三、Barcodes

  1. <img t-att-src="'/report/barcode/QR/%s' % 'My text in qr code'"/>
  1. <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s'%('QR', 'text', 200, 200)"/> 二维码

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <data>
  4. <template id="print_template_barcode">
  5. <t t-call="web.html_container">
  6. <t t-foreach="docs" t-as="o">
  7. <div class="page" style="margin-top:0px">
  8. <style type="text/css">
  9. .gxtr >th{
  10. text-align:center;
  11. border-top: 1px solid #000;
  12. border-left: 1px solid #000;
  13. border-bottom: 1px solid #000;
  14. <!--background-color:#BEBEBE;-->
  15. font-size:14px;
  16. }
  17. .gxtr >td{
  18. border-bottom: 1px solid #000;
  19. border-left: 1px solid #000;
  20. border-right: 1px solid #000;
  21. font-size:20px;
  22. display: flex;
  23. <!--text-align :center;-->
  24. }
  25. .gxtr >tr{
  26. border-bottom: 1px solid #000;
  27. border-left: 1px solid #000;
  28. border-right: 1px solid #000;
  29. font-size:20px;
  30. display: flex;
  31. text-align :center;
  32. }
  33. .herdtd{
  34. word-wrap:break-word;width:22%;font-size:14px;
  35. }
  36. .gxdiv{border-left:1px solid #000;border-bottom:1px solid #000;border-right:1px solid
  37. #000;font-size:14px;}
  38. </style>
  39. <t t-call="web.basic_layout">
  40. <table width="279" border="1">
  41. <thead>
  42. <tr>
  43. <td>名称</td>
  44. <td>
  45. <span t-field="o.name"/>
  46. </td>
  47. <td rowspan="3">
  48. <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s'%('QR', o.barcode, 100, 100)"/>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>价格</td>
  53. <td>
  54. <span t-field="o.list_price"/>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td>代码</td>
  59. <td >
  60. <span t-field="o.barcode"/>
  61. </td>
  62. </tr>
  63. <tr class="gxtr">
  64. <th>测试1</th>
  65. <th colspan="2">测试值</th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <tr t-foreach="o.attribute_line_ids" t-as="att" class="gxtr">
  70. <td height="32" style="text-align :center;">
  71. <span t-field="att.attribute_id.name"/>
  72. </td>
  73. <td colspan="2" style="text-align :center;">
  74. <t t-foreach="att.value_ids" t-as="val">
  75. <span t-field="val.name"/>;
  76. </t>
  77. </td>
  78. </tr>
  79. </tbody>
  80. </table>
  81. </t>
  82. </div>
  83. </t>
  84. </t>
  85. </template>
  86. </data>
  87. </odoo>

  1.  

odoo源生打印【web report】的更多相关文章

  1. js打印WEB页面内容代码大全

    第一种方法:指定不打印区域 使用CSS,定义一个.noprint的class,将不打印的内容放入这个class内. 详细如下: <style media=print type="tex ...

  2. 打印web页面指定区域的三种方法

    本文和大家分享一下web页面实现指定区域打印功能的三种方法,一起来看下吧. 第一种方法:使用CSS 定义一 个.noprint的class,将不打印的内容放入这个class内. 代码如下: <s ...

  3. js灵活打印web页面区域内容的通用方法

      我们做网站,经常需要打印页面指定区域的内容,而网上关于这块的说法很多,各种各样的打印控件也不少.但许多打印方案都不怎么好,至少我不喜欢,要么封装复杂,要么难以维护.正好现在的项目也需要用到 ...

  4. 多页面打印--web print

    背景:项目中要求做在一个页面中通过选择网址来打印多个页面的内容的功能 原理:通过iframe把各网址的页面内容加载进来,通过iframe.contentWindow拿到iframe的window对象, ...

  5. odoo 订单打印 会出现字体. ........... 虚线问题

    在表头加 红色部分 <?xml version="1.0" encoding="utf-8"?><openerp> <data&g ...

  6. 水晶报表自定义纸张大小打印 (Crystal Report Print with custom paper size)

    System.Drawing.Printing.PrintDocument doc = new PrintDocument(); doc.PrinterSettings.PrinterName = & ...

  7. Web系统页面打印技术实现与分析

    1 Web页面打印概述应用WEB化,不论对开发商,还是对用户来说,实在是一种很经济的选择,因为基于WEB的应用,客户端的规则很简单,容易学习,容易维护,容易发布.在WEB系统中,打印的确是个烦人的问题 ...

  8. WEB打印大全

    1.控制"纵打". 横打”和“页面的边距. (1)<script defer> function SetPrintSettings() {  // -- advance ...

  9. 关于WEB页面的强制分页打印问题

    最近项目中有个需求要求打印web页面数据,但是碰到打印预览显示数据时,多的数据就不翼而飞了(不分页),搞的很是焦灼~ 最先是以为纸张的问题,胡乱折腾了一番,把A4约硬是改成了LARGE号的纸,多的数据 ...

随机推荐

  1. 腾讯TencentOS 十年云原生的迭代演进之路

    导语 TencentOS Server (又名 Tencent Linux 简称 Tlinux) 是腾讯针对云的场景研发的 Linux 操作系统,提供了专门的功能特性和性能优化,为云服务器实例中的应用 ...

  2. Spring Boot WebFlux-07——WebFlux 中 Redis 实现缓存

    第07课:WebFlux 中 Redis 实现缓存 前言 首先,补充下上一篇的内容,RedisTemplate 实现操作 Redis,但操作是同步的,不是 Reactive 的.自然,支持 React ...

  3. 深入理解Spring事务的那点事

    Spring事务的基本原理 Spring事务的本质其实就是数据库对事务的支持,没有数据库的事务支持,spring是无法提供事务功能的.对于纯JDBC操作数据库,想要用到事务,可以按照以下步骤进行: 获 ...

  4. cURL命令使用指南

    cURL是什么 curl是Linux命令行工具,可以使用任何可支持的协议(如HTTP.FTP.IMAP.POP3.SCP.SFTP.SMTP.TFTP.TELNET.LDAP或FILE)在服务器之间传 ...

  5. Spring Boot 无侵入式 实现RESTful API接口统一JSON格式返回

    前言 现在我们做项目基本上中大型项目都是选择前后端分离,前后端分离已经成了一个趋势了,所以总这样·我们就要和前端约定统一的api 接口返回json 格式, 这样我们需要封装一个统一通用全局 模版api ...

  6. 基于uniapp自定义Navbar+Tabbar组件「兼容H5+小程序+App端Nvue」

    uni-app跨端自定义navbar+tabbar组件|沉浸式导航条|仿咸鱼凸起标签栏 在跨端项目开发中,uniapp是个不错的框架.采用vue.js和小程序语法结构,使得入门开发更容易.拥有非常丰富 ...

  7. CosId 1.1.8 发布,通用、灵活、高性能的分布式 ID 生成器

    CosId 通用.灵活.高性能的分布式 ID 生成器 介绍 CosId 旨在提供通用.灵活.高性能的分布式 ID 生成器. 目前提供了三类 ID 生成器: SnowflakeId : 单机 TPS 性 ...

  8. hdu 1754 I Hate It 线段树 单点更新 区间最值

    线段树功能:update:单点更新 query:区间最值 #include <bits/stdc++.h> #define lson l, m, rt<<1 #define r ...

  9. AOF重写导致的Redis进程被kill

    Redis环境描述 服务器: 阿里云16GB服务器 Redis版本: 5.0.5 持久化方式: AOF 问题描述 阿里云环境,使用docker安装的单节点redis5.x,频繁出现redis进程被操作 ...

  10. 大数据-Hadoop 伪分布模式

    1. 分析 (1)配置集群 (2)启动.测试集群增.删.查 (3)执行WordCount案例 2. 执行步骤 (1)配置集群 (a)配置:hadoop-env.sh Linux系统中获取JDK的安装路 ...