تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
7 الردود
14103 أدوات العرض

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

الصورة الرمزية
إهمال
الكاتب أفضل إجابة



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?

الكاتب

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

الكاتب

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

Nice work Pascal! Thanks!

أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 24
2167
0
أغسطس 24
1764
1
أغسطس 24
2794
0
يوليو 24
1404
0
مايو 23
2293