[IMP] point_of_sale: Add a report for the printing of the EAN13

bzr revid: stw@openerp.com-20120529133642-td13jd3sxwi0cbj0
This commit is contained in:
Stephane Wirtel 2012-05-29 15:36:42 +02:00
parent a6f263b323
commit cd458e7932
5 changed files with 130 additions and 23 deletions

View File

@ -76,5 +76,11 @@
rml="point_of_sale/report/pos_payment_report_user.rml"
/>
<report id="report_user_label"
model="res.users"
name="point_of_sale.user.label"
string="User Labels"
xml="point_of_sale/report/user_label.xml"
xsl="point_of_sale/report/user_label.xsl"/>
</data>
</openerp>

View File

@ -626,13 +626,13 @@
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<group name="misc" position="after">
<group name="pos" colspan="2" col="2">
<separator string="Point of Sale" colspan="2"/>
<field name="income_pdt"/>
<field name="expense_pdt"/>
</group>
</group>
<group name="misc" position="after">
<group name="pos" colspan="2" col="2">
<separator string="Point of Sale" colspan="2"/>
<field name="income_pdt"/>
<field name="expense_pdt"/>
</group>
</group>
</field>
</record>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<lots>
<lot-line type="fields" name="id">
<username type="field" name="name"/>
<ean13 type="field" name="ean13"/>
</lot-line>
</lots>

View File

@ -0,0 +1,91 @@
<?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 Open ERP">
<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() &lt; $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:template match="lot-line" mode="story">
<blockTable style="mytable" colWidths="2.8cm,5.4cm">
<tr>
<td>
<para style="nospace"></para>
</td>
<td>
<para style="nospace" t="1">
<!--
<xsl:value-of select="price"/> <xsl:value-of select="currency"/>
-->
</para>
</td>
</tr>
<tr>
<td>
<barCode><xsl:value-of select="ean13" /></barCode>
</td>
<td>
<para style="nospace"><xsl:value-of select="username"/></para>
</td>
</tr>
</blockTable>
<nextFrame/>
</xsl:template>
</xsl:stylesheet>

View File

@ -61,22 +61,25 @@
</xsl:template>
<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:value-of select="currency"/></para>
</td>
</tr><tr>
<td>
<barCode><xsl:value-of select="code"/></barCode>
</td><td>
<para style="nospace"><xsl:value-of select="product"/></para><xsl:text>, </xsl:text>
<para style="nospace"><xsl:value-of select="variant"/></para>
</td>
</tr>
</blockTable>
<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:value-of select="currency"/></para>
</td>
</tr>
<tr>
<td>
<barCode><xsl:value-of select="ean13" /></barCode>
</td>
<td>
<para style="nospace"><xsl:value-of select="product"/></para><xsl:text>, </xsl:text>
<para style="nospace"><xsl:value-of select="variant"/></para>
</td>
</tr>
</blockTable>
<nextFrame/>
</xsl:template>
</xsl:stylesheet>