[英]Missing Barcode at Generate PDF Report on Odoo v10
I'm trying generate Product Labels to PDF and it is generated but missing the product barcode. 我正在尝试将产品标签生成为PDF,并且已生成,但缺少产品条形码。
But The same Qweb I generate the Product Labels to HTML and it work fine. 但是我将相同的Qweb生成的产品标签转换为HTML,并且效果很好。
Go to Products and select two: 转到产品,然后选择两个:
Generated the Product Labels as HTML (Work Fine): 将产品标签生成为HTML(效果很好):
Generated the Product Labels as PDF (Missing Barcode): 生成的产品标签为PDF(缺少条形码):
This is my QWEB: 这是我的QWEB:
<?xml version="1.0"?>
<t t-name="product.report_productlabel">
<t t-call="report.html_container">
<div class="page">
<style>
</style>
<t t-foreach="docs" t-as="template">
<t t-foreach="template.product_variant_ids" t-as="product">
<div class="col-xs-6" style="padding:0;">
<table style="border-spacing:0;margin-bottom:0;height: 110px;border: 2px solid black;" class="table">
<thead>
<tr style="width: 3in;">
<td style="width: 2.63in;text-align: center;background-color: #fff;" colspan="2" class="col-xs-8 danger">
<strong style="text-transform: uppercase;">
<t t-esc="product.name"/>
</strong>
</td>
</tr>
</thead>
<tbody>
<tr style="width: 1in;">
<td style="text-align: center; border-top: 0px solid #fff; padding: 0px 5px 0px 5px;" class="col-xs-5">
<h4 style="border: 4px solid #ff4040;border-radius: 9px;background-color: #ffff00;padding: 10px 12px 10px 12px;font-size: 26px;margin-top: 0px;margin-bottom: 0px;">
<strong t-field="product.list_price" />
<strong>
<t t-esc="product.company_id.currency_id.symbol"/>
</strong>
</h4>
</td>
<td style="text-align: center;border-top: 0px solid #fff;padding: 0px 5px 0px 5px;" class="col-xs-7">
<img class="img-responsive"
t-att-src="'data:image/png;base64,%s' % res_company.logo"
style="background-color: #fff;margin-left: auto;margin-right: auto;width: auto;height: 16px;margin-bottom: 8px;"/>
<img class="img-responsive" t-if="product.barcode"
t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN13', product.barcode, 650, 200)"
style="height: 20px;width: 100%;"/>
<span style="">
<t t-esc="product.barcode"/>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</div>
It was a problem when you are behind a proxy, in your case NGNIX. 当您使用代理服务器(在您的情况下为NGNIX)时,这是一个问题。 But I can fix it following steps:
但是我可以按照以下步骤修复它:
First Solution: 第一个解决方案:
1- Add the following line inside odoo/addons/report/models/report.py file line number 205: 1-在odoo / addons / report / models / report.py文件行号205内添加以下行:
#base_url = irconfig_obj.get_param('report.url') or irconfig_obj.get_param('web.base.url')
base_url = irconfig_obj.get_param('web.base.url.report')
2- Add the server parameter web.base.url.report with value " http://127.0.0.1:8069 " (Running Port). 2-将服务器参数web.base.url.report添加为值“ http://127.0.0.1:8069 ”(运行端口)。
(With the Debug Actived) Go to Settings -> Parameters -> System Parameters -> Create
(使用Debug Actived)转到设置->参数->系统参数->创建
3- Restart the Odoo Server and It will work. 3-重新启动Odoo服务器,它将起作用。
/etc/init.d/odoo restart
UPDATE thanks to @CZoellner: 更新感谢@CZoellner:
The @CZoellner
recommendation work too and don't change anything in code: @CZoellner
建议也可以使用,不要更改代码中的任何内容:
Second Solution (RECOMMENDED): 第二个解决方案(推荐):
1- Add or UPDATE the server parameter url.report with value " http://127.0.0.1:8069 " (Running Port). 1-添加或更新值为“ http://127.0.0.1:8069 ”(运行端口)的服务器参数url.report。
(With the Debug Actived) Go to Settings -> Parameters -> System Parameters -> Create
(使用Debug Actived)转到设置->参数->系统参数->创建
2- Restart the Odoo Server and It will work. 2-重新启动Odoo服务器,它将工作。
/etc/init.d/odoo restart
Reference: https://github.com/odoo/odoo/issues/1105 参考: https : //github.com/odoo/odoo/issues/1105
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.