refactor(manifestLines): standardize on tax and remove taxrate alias
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user