refactor(manifestLines): standardize on tax and remove taxrate alias

This commit is contained in:
seb
2026-09-16 17:04:08 +02:00
parent 8f23dd8c75
commit 9b1b7615e2
2 changed files with 3 additions and 8 deletions

View File

@@ -333,8 +333,7 @@ type DeliveryLine = {
amount: number,
net: number,
rebate: number,
tax: number, // manifestarticle.taxrate (also exposed as taxrate)
taxrate: number,
tax: number, // manifestarticle.taxrate
comment: string | null,
}

View File

@@ -28,10 +28,7 @@ export function normalizeLines(lines) {
const net = entry?.net;
const rebate =
entry?.rebate === undefined || entry?.rebate === null ? 0 : entry.rebate;
const tax =
entry?.taxrate !== undefined && entry?.taxrate !== null
? entry.taxrate
: entry?.tax;
const tax = entry?.tax;
const comment =
entry?.comment === undefined || entry?.comment === null
? null
@@ -77,7 +74,7 @@ export function parseDate(value) {
* @returns {object} The shaped line.
*/
export function shapeLine(row) {
const tax = row.taxrate !== undefined ? Number(row.taxrate) : Number(row.tax);
const tax = Number(row.tax);
return {
id: row.id,
sku: row.sku ?? null,
@@ -87,7 +84,6 @@ export function shapeLine(row) {
net: row.net,
rebate: row.rebate,
tax,
taxrate: tax,
comment: row.comment ?? null,
};
}