Skip to content

Commit 87ff700

Browse files
authored
Quickbooks Create Purchase Order Updates (#17090)
1 parent ac56587 commit 87ff700

File tree

48 files changed

+74
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+74
-97
lines changed

components/quickbooks/actions/create-ap-aging-report/create-ap-aging-report.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "quickbooks-create-ap-aging-report",
66
name: "Create AP Aging Detail Report",
77
description: "Creates an AP aging report in Quickbooks Online. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/apagingdetail#query-a-report)",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
type: "action",
1010
props: {
1111
quickbooks,

components/quickbooks/actions/create-bill/create-bill.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "quickbooks-create-bill",
77
name: "Create Bill",
88
description: "Creates a bill. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/bill#create-a-bill)",
9-
version: "0.1.9",
9+
version: "0.1.10",
1010
type: "action",
1111
props: {
1212
quickbooks,

components/quickbooks/actions/create-customer/create-customer.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "quickbooks-create-customer",
66
name: "Create Customer",
77
description: "Creates a customer. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#create-a-customer)",
8-
version: "0.1.9",
8+
version: "0.1.10",
99
type: "action",
1010
props: {
1111
quickbooks,

components/quickbooks/actions/create-estimate/create-estimate.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
key: "quickbooks-create-estimate",
1010
name: "Create Estimate",
1111
description: "Creates an estimate. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/estimate#create-an-estimate)",
12-
version: "0.0.1",
12+
version: "0.0.2",
1313
type: "action",
1414
props: {
1515
quickbooks,

components/quickbooks/actions/create-invoice/create-invoice.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "quickbooks-create-invoice",
77
name: "Create Invoice",
88
description: "Creates an invoice. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#create-an-invoice)",
9-
version: "0.2.3",
9+
version: "0.2.4",
1010
type: "action",
1111
props: {
1212
quickbooks,

components/quickbooks/actions/create-payment/create-payment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "quickbooks-create-payment",
55
name: "Create Payment",
66
description: "Creates a payment. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#create-a-payment)",
7-
version: "0.0.8",
7+
version: "0.0.9",
88
type: "action",
99
props: {
1010
quickbooks,

components/quickbooks/actions/create-pl-report/create-pl-report.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "quickbooks-create-pl-report",
88
name: "Create Profit and Loss Detail Report",
99
description: "Creates a profit and loss report in Quickbooks Online. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/profitandloss#query-a-report)",
10-
version: "0.0.4",
10+
version: "0.0.5",
1111
type: "action",
1212
props: {
1313
quickbooks,

components/quickbooks/actions/create-purchase-order/create-purchase-order.mjs

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,27 @@ export default {
99
key: "quickbooks-create-purchase-order",
1010
name: "Create Purchase Order",
1111
description: "Creates a purchase order. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchaseorder#create-a-purchaseorder)",
12-
version: "0.0.1",
12+
version: "0.0.2",
1313
type: "action",
1414
props: {
1515
quickbooks,
1616
accountId: {
17-
propDefinition: [
18-
quickbooks,
19-
"accountIds",
20-
],
2117
type: "string",
2218
label: "Account ID",
2319
description: "The ID of the account to use for the purchase order",
20+
async options() {
21+
const { QueryResponse: queryResponse } = await this.quickbooks.query({
22+
params: {
23+
query: "select * from Account where Classification = 'Liability' AND AccountSubType = 'AccountsPayable'",
24+
},
25+
});
26+
return queryResponse.Account.map(({
27+
Id, Name,
28+
}) => ({
29+
value: Id,
30+
label: Name,
31+
}));
32+
},
2433
},
2534
vendorRefValue: {
2635
propDefinition: [
@@ -102,7 +111,7 @@ export default {
102111
props.lineItems = {
103112
type: "string[]",
104113
label: "Line Items",
105-
description: "Line items of a purchase order. Set DetailType to `ItemBasedExpenseLineDetail` or `AccountBasedExpenseLineDetail`. Example: `{ \"DetailType\": \"ItemBasedExpenseLineDetail\", \"Amount\": 100.0, \"ItemBasedExpenseLineDetail\": { \"ItemRef\": { \"name\": \"Services\", \"value\": \"1\" } } }` [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchaseorder#create-a-purchaseorder) for more information.",
114+
description: "Line items of a purchase order. DetailType is `ItemBasedExpenseLineDetail`. Example: `{ \"DetailType\": \"ItemBasedExpenseLineDetail\", \"Amount\": 100.0, \"ItemBasedExpenseLineDetail\": { \"ItemRef\": { \"name\": \"Services\", \"value\": \"1\" } } }` [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchaseorder#create-a-purchaseorder) for more information.",
106115
};
107116
return props;
108117
}
@@ -116,35 +125,26 @@ export default {
116125
return props;
117126
}
118127
for (let i = 1; i <= this.numLineItems; i++) {
119-
props[`detailType_${i}`] = {
120-
type: "string",
121-
label: `Line ${i} - Detail Type`,
122-
options: [
123-
{
124-
label: "Item Based Expense",
125-
value: "ItemBasedExpenseLineDetail",
126-
},
127-
{
128-
label: "Account Based Expense",
129-
value: "AccountBasedExpenseLineDetail",
130-
},
131-
],
132-
default: "ItemBasedExpenseLineDetail",
133-
};
134128
props[`item_${i}`] = {
135129
type: "string",
136130
label: `Line ${i} - Item/Account ID`,
137131
options: async ({ page }) => {
138-
return this.quickbooks.getPropOptions({
132+
const options = await this.quickbooks.getPropOptions({
139133
page,
140134
resource: "Item",
141135
mapper: ({
142-
Id: value, Name: label,
143-
}) => ({
144-
value,
145-
label,
146-
}),
136+
Id: value, Name: label, ExpenseAccountRef,
137+
}) => {
138+
if (ExpenseAccountRef) {
139+
return {
140+
value,
141+
label,
142+
};
143+
}
144+
return null;
145+
},
147146
});
147+
return options.filter((option) => option !== null);
148148
},
149149
};
150150
props[`amount_${i}`] = {
@@ -180,12 +180,6 @@ export default {
180180
throw new ConfigurationError("No valid line items were provided.");
181181
}
182182

183-
lines.forEach((line, index) => {
184-
if (line.DetailType !== "ItemBasedExpenseLineDetail" && line.DetailType !== "AccountBasedExpenseLineDetail") {
185-
throw new ConfigurationError(`Line Item at index ${index + 1} has invalid DetailType '${line.DetailType}'. Must be 'ItemBasedExpenseLineDetail' or 'AccountBasedExpenseLineDetail'`);
186-
}
187-
});
188-
189183
const hasShippingAddress = this.shippingStreetAddress
190184
|| this.shippingCity
191185
|| this.shippingState

components/quickbooks/actions/create-purchase/create-purchase.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "quickbooks-create-purchase",
77
name: "Create Purchase",
88
description: "Creates a new purchase. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchase#create-a-purchase)",
9-
version: "0.0.7",
9+
version: "0.0.8",
1010
type: "action",
1111
props: {
1212
quickbooks,

components/quickbooks/actions/create-sales-receipt/create-sales-receipt.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "quickbooks-create-sales-receipt",
77
name: "Create Sales Receipt",
88
description: "Creates a sales receipt. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/salesreceipt#create-a-salesreceipt)",
9-
version: "0.0.8",
9+
version: "0.0.9",
1010
type: "action",
1111
props: {
1212
quickbooks,

0 commit comments

Comments
 (0)