xmlodooqwebodoo-15

Odoo 15 Inherit And Change String of Button in PoS


Hope everything is well for you :D

Currently i'm trying to inherit and edit a customer button from Point of Sale in Odoo 15 to change it's string from "Customer" to "Pelanggan".

enter image description here

From what i read, there are a huge changes between version 15 and previous version. In previous version, to inherit the button from the PoS XML file we can use t-extend, t-jquery and t-operation="replace" tags but it seems like its no longer work in latest because in official documentation it says deprecated.

The closest things i can get is by using this code below, following example from the Documentation :

<t t-inherit="point_of_sale.ActionpadWidget" t-inherit-mode="extension">
    <xpath expr="//div[@class='actionpad']" position="replace">
        <span>Pelanggan</span>
    </xpath>
</t>

But the result are removing entire actionpad instead :

enter image description here

How is it possible to inherit certain button and rewrite it with another string in version 15?


Solution

  • The expression you used targets the containing div.

    To replace the customer button string, you can target the last t inside the first button

    Example

    <xpath expr="//div[hasclass('actionpad')]/button[hasclass('set-customer')]/t[3]" position="replace">
        <t t-else="">Pelanggan</t>
    </xpath>