I'm trying to highlight two fields inside the POS Partner Details popup: Name and Phone.
Highlighting the Name input works correctly using XPath.
But the Phone input is generated inside a t-foreach loop, and its t-attf-name attribute is dynamic, so my XPath never reaches this element, like..
<t t-foreach="['Street','City','Zip','Email','Phone','Mobile','Barcode']" t-as="item">...</t>
my xpath :
<t t-inherit="point_of_sale.PartnerDetailsEdit" t-inherit-mode="extension">
<xpath expr="//input[@name='name']" position="attributes">
<attribute name="style">border: 2px solid #1e90ff !important;</attribute> </xpath>
<xpath expr="//input[@name='phone']" position="attributes">
<attribute name="style">border:2px solid #1e90ff !important;</attribute> </xpath>
</t>
Since the input for Phone is created dynamically inside the loop, I can’t select it with a static XPath like:
//input[@t-attf-name="Phone"]
I tested multiple XPath approaches, but none of them can match the Phone input inside the t-foreach. The rendered DOM is correct in the browser, but XPath inheritance in QWeb can’t target the loop items individually.
Goal: I only want to style the Phone input inside the POS Partner Details, without affecting the other fields.
Problem: XPath inheritance cannot target this specific input because it's created from a loop, so it matches all fields or none.
If anyone has a clean workaround (either correct QWeb targeting or a recommended JS-only POS patch), please advise.
Hello,
<t t-name="l10n_pe_pos.PartnerDetailsEdit" t-inherit="point_of_sale.PartnerDetailsEdit" t-inherit-mode="extension">
<xpath expr="//div[input[@t-attf-name='{{item}}']]" position="attributes">
</xpath>
Have you tried like this? Taken from odoo base.