Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
7 Trả lời
14106 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất



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.

Ảnh đại diện
Huỷ bỏ

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

Tác giả

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

Tác giả

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

Nice work Pascal! Thanks!

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 24
2169
0
thg 8 24
1764
1
thg 8 24
2795
0
thg 7 24
1404
0
thg 5 23
2294