fix: OWL template error — Number() not available in template context
Use a formatPrice() method on the component instead of calling Number() directly in the OWL template. Fixes TypeError: ctx.Number is not a function. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -187,6 +187,17 @@ export class ProductMapping extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Helpers
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
formatPrice(val) {
|
||||
if (val === null || val === undefined || val === false) return "—";
|
||||
const n = parseFloat(val);
|
||||
if (isNaN(n)) return "—";
|
||||
return "$" + n.toFixed(2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Tab handlers
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -152,14 +152,8 @@
|
||||
<td><t t-esc="p.woo_product_name"/></td>
|
||||
<td><span class="woo-code"><t t-esc="p.woo_sku"/></span></td>
|
||||
<td><t t-esc="p.odoo_product_name"/></td>
|
||||
<td class="text-end">
|
||||
<t t-if="p.woo_price !== null and p.woo_price !== undefined and p.woo_price !== false">$<t t-esc="Number(p.woo_price).toFixed(2)"/></t>
|
||||
<t t-else=""><span class="woo-text-muted">—</span></t>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<t t-if="p.odoo_price !== null and p.odoo_price !== undefined and p.odoo_price !== false">$<t t-esc="Number(p.odoo_price).toFixed(2)"/></t>
|
||||
<t t-else=""><span class="woo-text-muted">—</span></t>
|
||||
</td>
|
||||
<td class="text-end" t-esc="this.formatPrice(p.woo_price)"/>
|
||||
<td class="text-end" t-esc="this.formatPrice(p.odoo_price)"/>
|
||||
<td><t t-esc="p.instance_name"/></td>
|
||||
<td>
|
||||
<input type="checkbox"
|
||||
|
||||
Reference in New Issue
Block a user