fix: remove decimal points from margin percentage — whole numbers only
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -236,7 +236,7 @@ export class ProductMapping extends Component {
|
|||||||
formatMargin(cost, price) {
|
formatMargin(cost, price) {
|
||||||
const m = this.calcMargin(cost, price);
|
const m = this.calcMargin(cost, price);
|
||||||
if (m === null) return "—";
|
if (m === null) return "—";
|
||||||
return m.toFixed(1) + "%";
|
return Math.round(m) + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -653,7 +653,7 @@ export class ProductMapping extends Component {
|
|||||||
args: [[product.odoo_product_id], { list_price: rounded }],
|
args: [[product.odoo_product_id], { list_price: rounded }],
|
||||||
kwargs: {},
|
kwargs: {},
|
||||||
});
|
});
|
||||||
this.notification.add("Sale price set to $" + rounded.toFixed(2) + " (" + value.toFixed(1) + "% margin).", { type: "success" });
|
this.notification.add("Sale price set to $" + rounded.toFixed(2) + " (" + Math.round(value) + "% margin).", { type: "success" });
|
||||||
await this._loadMapped();
|
await this._loadMapped();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="text-end woo-editable-cell woo-margin-cell" t-on-click.stop="() => this.startEdit(p.id, 'margin', this.calcMargin(p.odoo_cost, p.odoo_price))">
|
<td class="text-end woo-editable-cell woo-margin-cell" t-on-click.stop="() => this.startEdit(p.id, 'margin', this.calcMargin(p.odoo_cost, p.odoo_price))">
|
||||||
<t t-if="this.isEditing(p.id, 'margin')">
|
<t t-if="this.isEditing(p.id, 'margin')">
|
||||||
<input type="number" step="0.1" min="0" max="99.9" class="woo-edit-input"
|
<input type="number" step="1" min="0" max="99" class="woo-edit-input"
|
||||||
t-att-value="state.editValue"
|
t-att-value="state.editValue"
|
||||||
t-on-input="onEditInput"
|
t-on-input="onEditInput"
|
||||||
t-on-keydown="onEditKeydown"
|
t-on-keydown="onEditKeydown"
|
||||||
|
|||||||
Reference in New Issue
Block a user