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:
gsinghpal
2026-04-01 11:41:50 -04:00
parent b3fb2ef40c
commit 4941df8131
2 changed files with 3 additions and 3 deletions

View File

@@ -236,7 +236,7 @@ export class ProductMapping extends Component {
formatMargin(cost, price) {
const m = this.calcMargin(cost, price);
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 }],
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();
return;
}

View File

@@ -231,7 +231,7 @@
</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))">
<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-on-input="onEditInput"
t-on-keydown="onEditKeydown"