diff options
| author | rsi-odoo <rsi@openerp.com> | 2014-10-17 15:03:31 +0530 |
|---|---|---|
| committer | Damien Bouvy <dbo@odoo.com> | 2015-02-04 15:28:50 +0100 |
| commit | 2fc3a5501ee55bcf92c826e20dc766f9bc49bae2 (patch) | |
| tree | 44e57a5e73c5f8bbf88d3ba24caea37e0dd32eae /addons | |
| parent | 1c3f7c5ad7b6e699fc44c1919010c6792c2d040f (diff) | |
[IMP] product: Convert product label xsl report in qweb report
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/product/__openerp__.py | 1 | ||||
| -rw-r--r-- | addons/product/product_report.xml | 8 | ||||
| -rw-r--r-- | addons/product/report/product_label.xml | 11 | ||||
| -rw-r--r-- | addons/product/report/product_label.xsl | 87 | ||||
| -rw-r--r-- | addons/product/views/report_productlabel.xml | 38 |
5 files changed, 46 insertions, 99 deletions
diff --git a/addons/product/__openerp__.py b/addons/product/__openerp__.py index 16124d1eff3..8735d1ab020 100644 --- a/addons/product/__openerp__.py +++ b/addons/product/__openerp__.py @@ -61,6 +61,7 @@ Print product labels with barcode. 'pricelist_view.xml', 'partner_view.xml', 'views/report_pricelist.xml', + 'views/report_productlabel.xml' ], 'test': [ 'product_pricelist_demo.yml', diff --git a/addons/product/product_report.xml b/addons/product/product_report.xml index 9c7ca7e390c..d14d9f471e9 100644 --- a/addons/product/product_report.xml +++ b/addons/product/product_report.xml @@ -1,7 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - <report id="report_product_label" model="product.product" name="product.product.label" string="Products Labels" xml="product/report/product_label.xml" xsl="product/report/product_label.xsl"/> + <report + id="report_product_label" + string="Products Labels" + model="product.product" + report_type="qweb-pdf" + name="product.report_productlabel" + file="product.report_productlabel"/> <report id="action_report_pricelist" diff --git a/addons/product/report/product_label.xml b/addons/product/report/product_label.xml deleted file mode 100644 index c8d1f0de113..00000000000 --- a/addons/product/report/product_label.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<lots> - <lot-line type="fields" name="id"> - <code type="field" name="code"/> - <product type="field" name="name"/> - <variant type="field" name="attribute_value_ids.name"/> - <price type="field" name="list_price"/> - <barcode type="field" name="barcode"/> - <currency type="field" name="company_id.currency_id.name"/> - </lot-line> -</lots> diff --git a/addons/product/report/product_label.xsl b/addons/product/report/product_label.xsl deleted file mode 100644 index 2edb6113901..00000000000 --- a/addons/product/report/product_label.xsl +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> - <xsl:variable name="initial_bottom_pos">24.5</xsl:variable> - <xsl:variable name="initial_left_pos">0.5</xsl:variable> - <xsl:variable name="height_increment">4.8</xsl:variable> - <xsl:variable name="width_increment">10</xsl:variable> - <xsl:variable name="frame_height">3cm</xsl:variable> - <xsl:variable name="frame_width">9.3cm</xsl:variable> - <xsl:variable name="number_columns">2</xsl:variable> - <xsl:variable name="max_frames">16</xsl:variable> - - <xsl:template match="/"> - <xsl:apply-templates select="lots"/> - </xsl:template> - - <xsl:template match="lots"> - <document> - <template leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Address list" author="Generated by Odoo"> - <pageTemplate id="all"> - <pageGraphics/> - <xsl:apply-templates select="lot-line" mode="frames"/> - </pageTemplate> - </template> - <stylesheet> - <paraStyle name="nospace" fontName="Courier" fontSize="10" spaceBefore="0" spaceAfter="0"/> - <blockTableStyle id="mytable"> - <blockBackground colorName="lightred" start="0,0" stop="0,0"/> - <blockBackground colorName="lightgrey" start="1,0" stop="-1,0"/> - <blockAlignment value="CENTER"/> - <blockValign value="MIDDLE"/> - <blockFont name="Helvetica-BoldOblique" size="14" start="0,0" stop="-1,0"/> - <blockFont name="Helvetica" size="8" start="0,1" stop="-1,1"/> - <lineStyle kind="GRID" colorName="black" tickness="1"/> - </blockTableStyle> - </stylesheet> - <story> - <xsl:apply-templates select="lot-line" mode="story"/> - </story> - </document> - </xsl:template> - - <xsl:template match="lot-line" mode="frames"> - <xsl:if test="position() < $max_frames + 1"> - <frame> - <xsl:attribute name="width"> - <xsl:value-of select="$frame_width"/> - </xsl:attribute> - <xsl:attribute name="height"> - <xsl:value-of select="$frame_height"/> - </xsl:attribute> - <xsl:attribute name="x1"> - <xsl:value-of select="$initial_left_pos + ((position()-1) mod $number_columns) * $width_increment"/> - <xsl:text>cm</xsl:text> - </xsl:attribute> - <xsl:attribute name="y1"> - <xsl:value-of select="$initial_bottom_pos - floor((position()-1) div $number_columns) * $height_increment"/> - <xsl:text>cm</xsl:text> - </xsl:attribute> - </frame> - </xsl:if> - </xsl:template> - - <xsl:param name="pmaxChars" as="xs:integer" select="80"/> - - <xsl:template match="lot-line" mode="story"> - <blockTable style="mytable" colWidths="2.8cm,5.4cm"> - <tr> - <td> - <para style="nospace"><xsl:value-of select="code"/></para> - </td> - <td> - <para style="nospace" t="1"><xsl:value-of select="price"/><xsl:text> </xsl:text><xsl:value-of select="currency"/></para> - </td> - </tr> - <tr> - <td> - <barCode><xsl:value-of select="barcode" /></barCode> - </td> - <td> - <para style="nospace"><xsl:value-of select="substring(product, 1, $pmaxChars)"/></para><xsl:text>, </xsl:text> - <para style="nospace"><xsl:value-of select="variant"/></para> - </td> - </tr> - </blockTable> - <nextFrame/> - </xsl:template> -</xsl:stylesheet> diff --git a/addons/product/views/report_productlabel.xml b/addons/product/views/report_productlabel.xml new file mode 100644 index 00000000000..0a4de330327 --- /dev/null +++ b/addons/product/views/report_productlabel.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_productlabel"> + <t t-call="report.html_container"> + <div class="page"> + <t t-foreach="docs" t-as="product"> + <div class="col-xs-6 mt8 mb64"> + <table class="table table-bordered"> + <thead> + <tr> + <th class="col-xs-4 danger"> + <strong t-field="product.default_code"/> + </th> + <th class="active"> + <strong t-field="product.list_price"/> + <strong t-field="product.company_id.currency_id.name"/> + </th> + </tr> + </thead> + <tbody> + <tr height="40"> + <td> + <img t-if="product.barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN13', product.barcode, 600, 100)" style="width:100%;height:20%;"/> + </td> + <td> + <strong t-esc="', '.join(map(lambda x: x.name, product.attribute_value_ids))"/> + </td> + </tr> + </tbody> + </table> + </div> + </t> + </div> + </t> +</template> +</data> +</openerp>
\ No newline at end of file |
