Search code examples
javascriptpythonodoobarcodepos

add product barcode to the POS odoo module


i have a small request, i have worked with Odoo before but i never had to deal with .JS files, i only used Python and XML for basic dev needs, but right now i want to make a small change in the POS module and all of it is javascript,i want to display the Product barcode in the cart under its name, im sure the product barcode is loaded from the db because i use a barcode scanner to add products to the cart, so the only problem is to display it in the cart, here is a picture to explain my problem, thanks for the great community. Check screen shot


Solution

  • Add the File in Manifest like this,

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

    Add the File pos.xml in this path static/src/xml/

    You can Extend the Q-web Template and added Barcode like this,

    <?xml version="1.0" encoding="UTF-8" ?>
    <templates id="template" xml:space="preserve">
        <t t-extend="Orderline">
            <t t-jquery="t[t-esc='line.get_product().display_name']" t-operation="after">
                <br/><t t-esc="line.get_product().barcode"/>
            </t>
        </t>
    </template>