自定义(宽度和高度)以在 Odoo 上打印产品标签 - QWEB

何塞·卡洛斯·拉莫斯·卡门提斯

现在系统正在打印产品标签,工作正常,但尺寸错误。

我需要在 QWEB 报告中将宽度设置为 7 厘米,将高度设置为 4 厘米。

在哪里可以更改尺寸以打印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&amp;value=%s&amp;width=%s&amp;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>
杰梅尔

这是使用 90 DPI 的表格宽度的解决方案;

<table style="border-spacing:0;margin-bottom:0;height: 187px; width: 319px; border: 2px solid black;" class="table">

这是具有您需要的尺寸的 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: 187px; width: 319px; border: 2px solid black;"
                           class="table">
                        <thead>
                            <tr style="width: 3in;">
                                <td style="width: 2.63in; font-size: 19px; text-align: left; background-color: #fff; margin-top: 10px;"
                                    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 width="50%"
                                    style="text-align: center; border-top: 0px solid #fff; padding: 5px; position: relative;">
                                    <div style="position:absolute; bottom: 20px; left: 0; padding-left: 5px; width: 100%">
                                        <h4 style="border: 4px solid #ff4040; border-radius: 9px; background-color: #ffff00; padding: 10px 6px; font-size: 21px; margin: 0px ">
                                            <strong t-field="product.list_price"/>
                                            <strong>
                                                <t t-esc="product.company_id.currency_id.symbol"/>
                                            </strong>
                                        </h4>
                                    </div>
                                </td>
                                <td width="50%"
                                    style="text-align: center;border-top: 0px solid #fff;padding: 5px; position: relative;">
                                    <div style="position:absolute; bottom: 20px; padding-right: 5px;">
                                        <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: 35px; margin-bottom: 5px;"/>
                                        <img class="img-responsive" t-if="product.barcode"
                                             t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.barcode, 650, 200)"
                                             style="height: 20px; width: 100%;"/>
                                        <span style="font-size: 14px">
                                            <t t-esc="product.barcode"/>
                                        </span>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>

            </t>
        </t>
    </div>
</t>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

自定义Odoo Qweb视图

来自分类Dev

如何在Odoo中的自定义QWeb报告中打印图像?

来自分类Dev

[Odoo] [Qweb]字典foreach,打印键和值

来自分类Dev

odoo:使用向导打印qweb报告

来自分类Dev

如何为odoo 10的现有记录自定义qweb报告?

来自分类Dev

Odoo 10 QWeb 报告

来自分类Dev

Odoo和Qweb:在报价报告中呈现HTML

来自分类Dev

生成qweb报告odoo 9

来自分类Dev

如何在Odoo的qweb报告中打印one2many字段值?

来自分类Dev

使用python动态创建和更新odoo qweb报表中的表行和列

来自分类Dev

如何逐步创建odoo 9.0 QWeb报告

来自分类Dev

QWeb报告odoo中的总字数

来自分类Dev

在odoo数据模板中调用qweb模板

来自分类Dev

QWeb报告odoo中的总字数

来自分类Dev

XML 中的odoo 11 日期比较(qweb)

来自分类Dev

Odoo8 Qweb生成了pdf文档。第二页上的桌卡纸被卡住了

来自分类Dev

自定义报告上的Odoo 12 NonType错误

来自分类Dev

Odoo report error: Qweb error maximum recursion depth exceeded

来自分类Dev

使用Odoo版本8中的qweb模板进行报告

来自分类Dev

odoo / OpenERP V8-QWeb报告教程

来自分类Dev

Odoo报告错误:超过Qweb错误最大递归深度

来自分类Dev

在Odoo Qweb Reports中将字体设置为整个页面

来自分类Dev

如何在QWEB报表中汇总行(Odoo 13)?

来自分类Dev

在odoo报告中评估时出现Qweb异常

来自分类Dev

在Odoo Qweb Reports中将字体设置为整页

来自分类Dev

Odoo 9 qweb浮点数除以零

来自分类Dev

继承 qweb 报告并替换字符串 odoo 9

来自分类Dev

带自定义标签的CSS宽度

来自分类Dev

如何在Odoo上为自定义值创建控制器?