Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to inherit posticket template?

By
Pascal Tremblay
on 2/16/15, 2:29 PM 3,262 views

Still me...

I know that the receipt in the POS is defined in the file /home/odoo/addons/point_of_sale/static/src/xml/pos.xml :

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">

..............................

.................................

    <t t-name="PosTicket">
        <div class="pos-sale-ticket">
            
            <div class="pos-center-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
                Date.CultureInfo.formatPatterns.longTime)"/> <t t-esc="order.get('name')"/></div>
            <br />
            <t t-esc="widget.pos.company.name"/><br />
            PhoneSSSSSSSSS: <t t-esc="widget.pos.company.phone || ''"/><br />
            User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/><br />
            Shop: <t t-esc="widget.pos.shop.name"/><br />
            <br />
            <t t-if="widget.pos.config.receipt_header">
                <div style='text-align:center'>
                    <t t-esc="widget.pos.config.receipt_header" />
                </div>
                <br

 

But it is the first time I see the templates (with the s at the end) xml tag.

How can I override or inherit only PosTicket from this last file in my own module?

Thanks

2

Pascal Tremblay

--Pascal Tremblay--
1312
| 5 2 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 2/17/15, 6:05 AM



I'm now able to override the original point of sale ticket/receipt.

In my custom file /Volumes/odoo/addons/report_lapagept/__openerp__.py
    'depends' : ['point_of_sale'],
 
    "qweb" : [
        'static/src/xml/pos.xml',
    ],

In my custom file /Volumes/odoo/addons/report_lapagept/static/src/xml/pos.xml, I had just declare PosTicket again and it override the original.

<?xml version="1.0" encoding="UTF-8"?>

<templates id="template" xml:space="preserve">

    <t t-name="PosTicket">
        <div class="pos-sale-ticket">

....................
            

UPDATE #1

Now to override model.js, we have this in the file /home/odoo-test/odoo-test/addons_pt/pos_lapagept/lapagept_templates.xml  :

        <?xml version="1.0" encoding="utf-8"?>

            <openerp>

                <data>

                    <template id="assets_backend" name="point_of_sale assets" inherit_id="point_of_sale.assets_backend">

                        <xpath expr="//script[contains(@src,'widget_base.js')]" position="replace">

                            <script type="text/javascript" src="/pos_lapagept/static/src/js/widget_base_pt.js"></script>

                        </xpath>

                        <xpath expr="." position="inside">

                            <script type="text/javascript" src="/pos_lapagept/static/src/js/widgets_as.js"></script>

                        </xpath>

                        <xpath expr="//script[contains(@src,'models.js')]" position="replace">

                               <script type="text/javascript" src="/pos_lapagept/static/src/js/models_pt.js"></script>

                        </xpath>

                    </template>

                </data>

        </openerp>



Let me know if you need something else.

Hello Pascal , have you gone about inheriting / overriding the point of sale js files (models.js ) as i want to inherit this file?

Erhuvwu Akpobaro
on 4/22/15, 10:27 AM

Please wait until tomorrow. I could may be help you.

Pascal Tremblay
on 4/22/15, 10:31 AM

I'm updating my answer with what we have here.

Pascal Tremblay
on 4/22/15, 12:53 PM

Nice work Pascal! Thanks!

FEDERICO LEONI
on 4/22/15, 2:27 PM
0
isio-odoo
On 9/10/15, 2:23 AM

Hello,

I just need to add some field to the   ClientDetails div

<t t-name="ClientDetails">

<section class='client-details'>

<div class='client-picture'>

<img t-att-src='widget.partner_icon_url(partner.id)' />

 ........
........

</t>

how i can do it by inheritance

thnak you

0
FEDERICO LEONI
On 4/22/15, 4:17 PM

Pascal, did you tried to link directly an Odoo qweb report instead of edit/inherit the stock one? Would be interesting for those who don't have a proxy printer but just a system printer. Have a look here

https://www.odoo.com/forum/help-1/question/print-order-instead-of-coupon-on-pos-what-qweb-view-82635

to understand what I mean.

F.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/16/15, 2:29 PM
Seen: 3262 times
Last updated: 9/10/15, 2:23 AM