odoo源生打印【web report】
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&value=%s&width=%s&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】的更多相关文章
- js打印WEB页面内容代码大全
第一种方法:指定不打印区域 使用CSS,定义一个.noprint的class,将不打印的内容放入这个class内. 详细如下: <style media=print type="tex ...
- 打印web页面指定区域的三种方法
本文和大家分享一下web页面实现指定区域打印功能的三种方法,一起来看下吧. 第一种方法:使用CSS 定义一 个.noprint的class,将不打印的内容放入这个class内. 代码如下: <s ...
- js灵活打印web页面区域内容的通用方法
我们做网站,经常需要打印页面指定区域的内容,而网上关于这块的说法很多,各种各样的打印控件也不少.但许多打印方案都不怎么好,至少我不喜欢,要么封装复杂,要么难以维护.正好现在的项目也需要用到 ...
- 多页面打印--web print
背景:项目中要求做在一个页面中通过选择网址来打印多个页面的内容的功能 原理:通过iframe把各网址的页面内容加载进来,通过iframe.contentWindow拿到iframe的window对象, ...
- odoo 订单打印 会出现字体. ........... 虚线问题
在表头加 红色部分 <?xml version="1.0" encoding="utf-8"?><openerp> <data&g ...
- 水晶报表自定义纸张大小打印 (Crystal Report Print with custom paper size)
System.Drawing.Printing.PrintDocument doc = new PrintDocument(); doc.PrinterSettings.PrinterName = & ...
- Web系统页面打印技术实现与分析
1 Web页面打印概述应用WEB化,不论对开发商,还是对用户来说,实在是一种很经济的选择,因为基于WEB的应用,客户端的规则很简单,容易学习,容易维护,容易发布.在WEB系统中,打印的确是个烦人的问题 ...
- WEB打印大全
1.控制"纵打". 横打”和“页面的边距. (1)<script defer> function SetPrintSettings() { // -- advance ...
- 关于WEB页面的强制分页打印问题
最近项目中有个需求要求打印web页面数据,但是碰到打印预览显示数据时,多的数据就不翼而飞了(不分页),搞的很是焦灼~ 最先是以为纸张的问题,胡乱折腾了一番,把A4约硬是改成了LARGE号的纸,多的数据 ...
随机推荐
- c语言经典算法---计算Fibonacci数列
算法是一个程序和软件的灵魂,作为一名优秀的程序员,只有对一些基础的算法有着全面的掌握,才会在设计程序和编写代码的过程中显得得心应手.下面我就分享一个C语言中比较基础却极为重要的一个算法----计算Fi ...
- 【NX二次开发】Block UI 指定矢量
属性说明 属性 类型 描述 常规 BlockID String 控件ID Enable Logical 是否可操作 Group ...
- 【NX二次开发】Block UI 指定平面
属性说明 属性 类型 描述 常规 BlockID String 控件ID Enable Logical 是否可操作 Group ...
- Binding(一):数据绑定
这节开始分几期来讲一下WPF中Binding的相关用法,本节主要讲使用Binding进行数据绑定. Binding的作用 在WinForm中,我们要想对控件赋值,需要在后台代码中拿到控件对象进行操作, ...
- 带你了解Java的序列化与反序列化
什么是序列化 序列化:将 Java 对象转换成字节流的过程. 什么是反序列化 反序列化:将字节流转换成 Java 对象的过程. 序列化的实现 当 Java 对象需要在网络上传输 或者 持久化存储到文件 ...
- Manacher(马拉车)————O(n)回文子串
Manacher 一.背景 1975年,Manacher发明了Manacher算法(中文名:马拉车算法),是一个可以在O(n)的复杂度中返回字符串s中最长回文子串长度的算法,十分巧妙. 让我们举个栗子 ...
- mybatis入“坑”第一步
一.导入坐标 要想通过maven创建一个简单的mybatis项目,首先需要的是要导入相关的坐标.需要导入的坐标如下: <dependencies> <!--mysql驱动坐标--&g ...
- 【NLP学习其二】什么是隐马尔可夫模型HMM?
概念 隐马尔可夫模型描述的是两个时序序列联合分布p(x,y)的概率模型,其中包含了两个序列: x序列外界可见(外界指的是观测者),称为观测序列(obsevation seuence) y序列外界不可见 ...
- WEB安全新玩法 [3] 防护交易数据篡改
在任何涉及交易的系统中,客户与商家之间的交易数据具有核心作用,如购买商品的价格.数量.型号和优惠券等.在客户挑选商品的过程中,这些交易数据逐渐形成:待客户提交订单时,交易数据被商家接收,形成双方认可的 ...
- Linux中mail的用法
简介:mail命令是命令行的电子邮件发送和接收工具.操作的界面不像elm或pine那么容易使用,但功能非常完整Red Hat上sendmail服务一般是自动启动的.可以通过下面的命令查看sendmai ...