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:
gsinghpal
2026-03-31 22:39:50 -04:00
parent cec499e9e9
commit 80b7d3d620
2 changed files with 13 additions and 8 deletions

View File

@@ -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
// -------------------------------------------------------------------------

View File

@@ -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"