IO-1489 Resolve payables memo for QBO.

This commit is contained in:
Patrick Fic
2021-10-25 17:25:29 -07:00
parent b718f49071
commit 9c3e4b7b83
2 changed files with 7 additions and 4 deletions

1
.gitignore vendored
View File

@@ -112,3 +112,4 @@ firebase/.env
.elasticbeanstalk/* .elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml !.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml !.elasticbeanstalk/*.global.yml
logs/oAuthClient-log.log

View File

@@ -180,9 +180,9 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
DocNumber: bill.invoice_number, DocNumber: bill.invoice_number,
...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}), ...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}),
Memo: `RO ${bill.job.ro_number || ""} OWNER ${bill.job.ownr_fn || ""} ${ PrivateNote: `RO ${bill.job.ro_number || ""} OWNER ${
bill.job.ownr_ln || "" bill.job.ownr_fn || ""
} ${bill.job.ownr_co_nm || ""}`, } ${bill.job.ownr_ln || ""} ${bill.job.ownr_co_nm || ""}`,
Line: bill.billlines.map((il) => Line: bill.billlines.map((il) =>
generateBillLine( generateBillLine(
il, il,
@@ -211,7 +211,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
body: JSON.stringify(billQbo), body: JSON.stringify(billQbo),
}); });
setNewRefreshToken(req.user.email, result); setNewRefreshToken(req.user.email, result);
return result && result.Bill; return result && result.json && result.json.Bill;
} catch (error) { } catch (error) {
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, { logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
error: error:
@@ -245,6 +245,8 @@ const generateBillLine = (
costCenters costCenters
) => { ) => {
const account = costCenters.find((c) => c.name === billLine.cost_center); const account = costCenters.find((c) => c.name === billLine.cost_center);
console.log(account.accountname, accounts[account.accountname]);
return { return {
DetailType: "AccountBasedExpenseLineDetail", DetailType: "AccountBasedExpenseLineDetail",