From 4c0a1960ad10b3d050830798e20fb981a30910ee Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 20 Sep 2024 09:37:09 -0700 Subject: [PATCH] IO-2928 Remove Tax Code Ref if QBO US in Canada Signed-off-by: Allan Carr --- server/accounting/qbo/qbo-payables.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/server/accounting/qbo/qbo-payables.js b/server/accounting/qbo/qbo-payables.js index 1d16b0daf..30f5b1f62 100644 --- a/server/accounting/qbo/qbo-payables.js +++ b/server/accounting/qbo/qbo-payables.js @@ -194,7 +194,9 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop) bodyshop.md_responsibility_centers.sales_tax_codes, classes, taxCodes, - bodyshop.md_responsibility_centers.costs + bodyshop.md_responsibility_centers.costs, + bodyshop.accountingconfig, + bodyshop.region_config ) ); @@ -298,17 +300,29 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop) // }, // ], -const generateBillLine = (billLine, accounts, jobClass, ioSalesTaxCodes, classes, taxCodes, costCenters) => { +const generateBillLine = ( + billLine, + accounts, + jobClass, + ioSalesTaxCodes, + classes, + taxCodes, + costCenters, + accountingconfig, + region_config +) => { const account = costCenters.find((c) => c.name === billLine.cost_center); - return { DetailType: "AccountBasedExpenseLineDetail", AccountBasedExpenseLineDetail: { ...(jobClass ? { ClassRef: { value: classes[jobClass] } } : {}), - TaxCodeRef: { - value: taxCodes[findTaxCode(billLine.applicable_taxes, ioSalesTaxCodes)] - }, + TaxCodeRef: + accountingconfig.qbo && accountingconfig.qbo_usa && region_config.includes("CA_") + ? {} + : { + value: taxCodes[findTaxCode(billLine.applicable_taxes, ioSalesTaxCodes)] + }, AccountRef: { value: accounts[account.accountname] }