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, amount: number,
net: number, net: number,
rebate: number, rebate: number,
tax: number, // manifestarticle.taxrate (also exposed as taxrate) tax: number, // manifestarticle.taxrate
taxrate: number,
comment: string | null, comment: string | null,
} }

View File

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