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

一、纸张格式设置:

<record id="paperformat_frenchcheck" model="report.paperformat">
<field name="name">French Bank Check</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">80</field>
<field name="page_width">175</field>
<field name="orientation">Portrait</field>
<field name="margin_top">3</field>
<field name="margin_bottom">3</field>
<field name="margin_left">3</field>
<field name="margin_right">3</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">3</field>
<field name="dpi">80</field>
</record>


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


三、Barcodes

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

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="print_template_barcode">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<div class="page" style="margin-top:0px">
<style type="text/css">
.gxtr >th{
text-align:center;
border-top: 1px solid #000;
border-left: 1px solid #000;
border-bottom: 1px solid #000;
<!--background-color:#BEBEBE;-->
font-size:14px;
}
.gxtr >td{
border-bottom: 1px solid #000;
border-left: 1px solid #000;
border-right: 1px solid #000;
font-size:20px;
display: flex;
<!--text-align :center;-->
}
.gxtr >tr{
border-bottom: 1px solid #000;
border-left: 1px solid #000;
border-right: 1px solid #000;
font-size:20px;
display: flex;
text-align :center;
}
.herdtd{
word-wrap:break-word;width:22%;font-size:14px;
}
.gxdiv{border-left:1px solid #000;border-bottom:1px solid #000;border-right:1px solid
#000;font-size:14px;}
</style>
<t t-call="web.basic_layout">
<table width="279" border="1">
<thead>
<tr>
<td>名称</td>
<td>
<span t-field="o.name"/>
</td>
<td rowspan="3">
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s'%('QR', o.barcode, 100, 100)"/>
</td>
</tr>
<tr>
<td>价格</td>
<td>
<span t-field="o.list_price"/>
</td>
</tr>
<tr>
<td>代码</td>
<td >
<span t-field="o.barcode"/>
</td>
</tr>
<tr class="gxtr">
<th>测试1</th>
<th colspan="2">测试值</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.attribute_line_ids" t-as="att" class="gxtr">
<td height="32" style="text-align :center;">
<span t-field="att.attribute_id.name"/>
</td>
<td colspan="2" style="text-align :center;">
<t t-foreach="att.value_ids" t-as="val">
<span t-field="val.name"/>;
</t>
</td>
</tr>
</tbody>
</table>
</t>
</div>
</t>
</t>
</template>
</data>
</odoo>

 

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. 『居善地』接口测试 — 13、Moco框架的使用

    目录 1.Moco框架第一个练习 2.Get方法的Mock实现 3.Post方法的Mock实现 4.请求中加入Cookies 5.请求中加入Header 6.Moco模拟重定向 7.综合练习 8.总结 ...

  2. 【NX二次开发】Block UI 整形

    属性说明 常规         类型 描述     BlockID     String 控件ID     Enable     Logical 是否可操作     Group     Logical ...

  3. noConflict冲突处理机制

    最近接手了一个古早项目,用的backbone,于是正好学习一下早期MVC框架的源码. 这篇主要写冲突处理机制,源码其实就一个函数,代码也很短.原理也很好理解,总结起来就是:每执行一次noConflic ...

  4. Linux命令大全之帮助命令及压缩命令

    man(manual):帮助命令 help用于解释shell内部命令 格式:help shell内部命令 ls 命令  --help man 命令 info 命令 .zip    .gz    .bz ...

  5. 解析 Nebula Graph 子图设计及实践

    本文首发于 Nebula Graph 公众号 NebulaGraphCommunity,Follow 看大厂图数据库技术实践. 前言 在先前的 Query Engine 源码解析中,我们介绍了 2.0 ...

  6. OSPF 路由协议

    OSPF路由协议 目录 一.OSPF路由协议概述 1.1.内部网关和外部网关协议 1.2.OSPF的工作过程 1.3.OSPF的基本概念 二.OSPF 数据包类型 2.1.OSPF数包 2.2.OSP ...

  7. kubelet分析-pvc扩容源码分析

    kubernetes ceph-csi分析目录导航 存储的扩容分为controller端操作与node端操作两大步骤,controller端操作由external-resizer来调用ceph完成,而 ...

  8. 时光卷轴,Microsoft大事记

    Our mission is to empower every person and every organization on the planet to achieve more. 2021年6月 ...

  9. 聊一聊Unity协程背后的实现原理

    Unity开发不可避免的要用到协程(Coroutine),协程同步代码做异步任务的特性使程序员摆脱了曾经异步操作加回调的编码方式,使代码逻辑更加连贯易读.然而在惊讶于协程的好用与神奇的同时,因为不清楚 ...

  10. 26、linux下安装MongoDB

    26.1.MongoDB介绍: 1.什么是MongoDB: MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系统.在高负载的情况下,添加更多的节点,可以保证服务器性能. Mo ...