1
votes

Im trying to extend the point of sale, template to modify the web ticket and the printed version also.... I want to put a codebar with the id numbe. But reading and testing my code doesn't work.... For testing purpuse I put a text in several parts of the template to watch if it is modify... but it's not.

<?xml version="1.0" encoding="UTF-8"?> 
<templates xml:space="preserve">
            <t t-extend="XmlReceipt">
                 <t t-jquery=".receipt-change" t-operation="inner">
                    <div><span>hello world</span></div>
                 </t>
            </t>
            <t t-extend="PosTicket">
                <t t-jquery=".receipt-orderlines .product_line" t-operation="inner">
                    <div><span>hello world</span></div>
                </t>
            </t>
            <t t-extend="PaymentScreenWidget">
                <t t-jquery="div.pos-payment-container" t-operation="inner">
                    <div>
                       Payment Screen Modified
                    </div>
                </t>
            </t>
 </templates>

This code is in a file name pos.xml and I append it from openerp.py like this:

'qweb': ['static/src/xml/pos.xml'],

Why the XmlReceipt or the PosTicket or the payment template are not extending???? Then when I sucessfully extend the template, Im gonna try to replace the hello world with

<barcode encoding="CODE128"><t t-esc="o.id"/></barcode>

Thanks!

[EDIT] Ok, now I'm extending the template, but I cant generate the barcode from the order.sequence_number

I'm trying like this:

<img class="img-responsive" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', order.sequence_number, 500, 100)" style="width:250px;height:50px;"/>

The barcode its not generate like this... but if I do it like this it is

<img t-att-src="'/report/barcode/Code128/*mycode*'" style="width:250px;height:50px;"/>

So I think the error is in the string rendering.....

1
You want to add barcode in XmlReceipt or in PosTicekt ? - Keval Mehta

1 Answers

0
votes

This is how I extends the mail chatter in odoo-10 and it's working fine for me. Take a look, may be its help if still needed.

<templates>

    <!--
        Chatter composer
    -->
    <t t-extend="mail.chatter.ChatComposer">
        <!-- Insert information before the composer -->
        <t t-jquery=".o_composer_suggested_partners" t-operation="replace">
            <!-- List of followers -->
            <div class="o_composer_suggested_partners">
                <t t-foreach='widget.suggested_partners' t-as='recipient'>
                    <div t-attf-title="Add as recipient and follower (reason: #{recipient.reason})">
                        <input type="checkbox" t-att-data-fullname="recipient.full_name"/>
                        <t t-esc="recipient.name"/>
                        <t t-if="recipient.email_address">(<t t-esc="recipient.email_address"/>)</t>
                    </div>
                </t>
            </div>
        </t>
    </t>
</templates>