refactor: update xpath selectors to use hasclass and correct component targets in POS XML templates

This commit is contained in:
Suherdy Yacob 2026-05-07 16:57:09 +07:00
parent cc9aeb9103
commit dac89886cd
2 changed files with 3 additions and 3 deletions

View File

@ -2,10 +2,10 @@
<templates id="template" xml:space="preserve">
<!-- Hide payment button if role is waiter -->
<t t-name="pos_employee_role.ActionpadWidget" t-inherit="point_of_sale.ActionpadWidget" t-inherit-mode="extension">
<xpath expr="//button[contains(@class, 'pay-order-button')]" position="attributes">
<xpath expr="//button[hasclass('pay-order-button')]" position="attributes">
<attribute name="t-if">this.pos.cashier.pos_role != 'waiter'</attribute>
</xpath>
<xpath expr="//button[contains(@class, 'pay-order-button')]" position="after">
<xpath expr="//button[hasclass('pay-order-button')]" position="after">
<button t-if="this.pos.cashier.pos_role == 'waiter' and this.pos.config.basic_receipt"
class="button btn btn-secondary btn-lg py-3 d-flex align-items-center justify-content-center flex-fill"
t-att-class="{'col-3': showFastPaymentMethods}"

View File

@ -2,7 +2,7 @@
<templates id="template" xml:space="preserve">
<!-- Hide refund button in Ticket Screen from waiter and cashier -->
<t t-name="pos_employee_role.TicketScreen" t-inherit="point_of_sale.TicketScreen" t-inherit-mode="extension">
<xpath expr="//button[@actionToTrigger.bind='onDoRefund']" position="attributes">
<xpath expr="//ActionpadWidget[@actionToTrigger.bind='onDoRefund']" position="attributes">
<attribute name="t-if">getHasItemsToRefund() and (this.pos.cashier.pos_role == 'outlet_manager' or this.pos.cashier.pos_role == 'area_manager')</attribute>
</xpath>
</t>