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号的纸,多的数据 ...
随机推荐
- Redis源码解析之跳跃表(一)
跳跃表(skiplist) 有序集合(sorted set)是Redis中较为重要的一种数据结构,从名字上来看,我们可以知道它相比一般的集合多了一个有序.Redis的有序集合会要求我们给定一个分值(s ...
- Java后端精选技术:SpringBoot配置读取
在早前的博客中曾经写过 Spring 程序通过 Bean 映射实现配置信息的读取. 在SpringBoot 框架中读取配置的方式变得非常多样,这导致读者在搜寻资料时反而容易迷糊. 到底,SpringB ...
- Java源码分析:Guava之不可变集合ImmutableMap的源码分析
一.案例场景 遇到过这样的场景,在定义一个static修饰的Map时,使用了大量的put()方法赋值,就类似这样-- public static final Map<String,String& ...
- Java基础-封装和继承
@ 目录 Java基础知识(封装和继承) 一. 封装 1.1 封装的目的 1.2 封装的好处 1.3 封装的步骤 1.4 封装的例子 1.5 小结 二. 继承 2.1 继承的介绍 2.2 生活中的继承 ...
- JavaScript 沙盒模式
微前端已经成为前端领域比较火爆的话题,在技术方面,微前端有一个始终绕不过去的话题就是前端沙箱 什么是沙箱 Sandboxie(又叫沙箱.沙盘)即是一个虚拟系统程序,允许你在沙盘环境中运行浏览器或其他程 ...
- .NetCore使用Docker安装ElasticSearch、Kibana 记录日志
前言 最近园子里看到一篇<.Net Core with 微服务 - Elastic APM> 的文章(主要用于对接口的调用链.性能进行监控),非常实用,这里讲解.NetCore将日志写入E ...
- 通过Cloudflare API进行CDN刷新
1.Cloudflare CDN刷新说明 1.Cloudfalre同Akamai一样,只有刷新,没有预热的概念. 2.通过Cloudflare API进行刷新,需要用到登录用户的[邮箱][api密钥] ...
- Samba常见漏洞利用
Samba简介 Samba是linux和unix系统上实现smb协议的一个免费软件,由服务器及客户端程序构成,Samba是面向Linux和Unix环境的Windows互操作性套件.它适用于在可能包括L ...
- SonarQube插件
关于插件我本身使用不多,如果看不惯英文界面,那么就先装个中文插件吧. 或者上微软的官方网站进行下载 将下载的插件上传到自己的sonarqube的服务的机器上,放置插件目录下,重启sonarqube即可 ...
- logback学习与配置使用
Logback介绍 Logback 分为三个模块:Core.Classic 和 Access.Core模块是其他两个模块的基础. Classic模块扩展了core模块. Classic模块相当于log ...
