1

I am working on odoo version 15; trying to customize receipt in POS module ; but I have an internal server error (500) .. My code as following :

manifest.py

...
"license": "OPL-1",
"depends": [
        'base',
        'point_of_sale',
    ],
    'assets': {
            'web.assets_qweb': [
                'static/src/xml/OrderReceipt.xml',
                # 'views/OrderReceipt.xml',
            ],
    ...

OrderReceipt.xml

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-extend="OrderReceipt">
        <t t-jquery=".pos-receipt .pos-receipt-contact" t-operation='append'>
            <t t-if='receipt.client'>
                <div style="font-weight:bold;">Customer:<t t-esc='receipt.client'/></div>
            </t>
            <p>Success !</p>
        </t>
    </t>
</templates>

Error Log :

FileNotFoundError: File not found: static/src/xml/OrderReceipt.xml - - -
2022-07-28 05:41:09,068 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:09] "GET /favicon.ico HTTP/1.1" 404 - 127 0.074 0.189
2022-07-28 05:41:50,952 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:50] "POST /longpolling/poll HTTP/1.1" 200 - 13 0.025 50.159
2022-07-28 05:41:52,030 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:52] "POST /longpolling/poll HTTP/1.1" 200 - 9 0.017 50.024
2022-07-28 05:41:55,264 342410 INFO newestDB07021 odoo.addons.base.models.ir_cron: Starting job `payment: post-process transactions`. 
2022-07-28 05:41:55,270 342410 INFO newestDB07021 odoo.addons.base.models.ir_cron: Job `payment: post-process transactions` done.
user1261494
  • 139
  • 1
  • 10

1 Answers1

1

Solved by giving full path /model_name/static/src/xml/file_name.xml in the manifest.py file model_name was missing

In odoo 15, the path to the files is now relative to the root folder, not the module folder.

Try this,

    <t t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">

        <xpath expr="//div[hasclass('pos-receipt-contact')]" position="after">
            <t t-if='receipt.client'>
                <div style="font-weight:bold;">Customer:<t t-esc='receipt.client'/></div>
            </t>
            <p>Success !</p>
        </xpath>   </t>
        
Muhammad Yusuf
  • 563
  • 4
  • 20
  • I did have the same problem even when I added t-inherit="point_of_sale.OrderReceipt" ..etc. – user1261494 Jul 28 '22 at 05:12
  • 1
    static/src/xml/OrderReceipt.xml according to this, the problem is the file path make sure the file orderreceipt.xml is in the following path, also try using full path from the model name `/model_name/static/src/xml/file_name.xml` – Muhammad Yusuf Jul 28 '22 at 05:26
  • 1
    it works after adding custom module name to the path of the assets as : 'assets': { 'web.assets_qweb': [ 'custom/static/src/xml/custom_pos.xml', – user1261494 Jul 28 '22 at 05:55