mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
feat(QuickBooks Node): Add optional Tax item field (#3404)
* Added tax refs * Nodelinter fixes
This commit is contained in:
parent
f02421b5f3
commit
c341b45396
|
@ -138,7 +138,7 @@ export async function quickBooksApiRequestAllItems(
|
|||
responseData = await quickBooksApiRequest.call(this, method, endpoint, qs, body);
|
||||
try {
|
||||
const nonResource = originalQuery.split(' ')?.pop();
|
||||
if (nonResource === 'CreditMemo' || nonResource === 'Term') {
|
||||
if (nonResource === 'CreditMemo' || nonResource === 'Term' || nonResource === 'TaxCode') {
|
||||
returnData.push(...responseData.QueryResponse[nonResource]);
|
||||
} else {
|
||||
returnData.push(...responseData.QueryResponse[capitalCase(resource)]);
|
||||
|
@ -334,18 +334,27 @@ export function processLines(
|
|||
ItemRef: {
|
||||
value: line.itemId,
|
||||
},
|
||||
TaxCodeRef : {
|
||||
value: line.TaxCodeRef,
|
||||
},
|
||||
};
|
||||
delete line.itemId;
|
||||
delete line.TaxCodeRef;
|
||||
}
|
||||
|
||||
|
||||
} else if (resource === 'invoice') {
|
||||
if (line.DetailType === 'SalesItemLineDetail') {
|
||||
line.SalesItemLineDetail = {
|
||||
ItemRef: {
|
||||
value: line.itemId,
|
||||
},
|
||||
TaxCodeRef : {
|
||||
value: line.TaxCodeRef,
|
||||
},
|
||||
};
|
||||
delete line.itemId;
|
||||
delete line.TaxCodeRef;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,6 +180,10 @@ export class QuickBooks implements INodeType {
|
|||
return await loadResource.call(this, 'purchase');
|
||||
},
|
||||
|
||||
async getTaxCodeRefs(this: ILoadOptionsFunctions) {
|
||||
return await loadResource.call(this, 'TaxCode');
|
||||
},
|
||||
|
||||
async getTerms(this: ILoadOptionsFunctions) {
|
||||
return await loadResource.call(this, 'Term');
|
||||
},
|
||||
|
@ -503,7 +507,6 @@ export class QuickBooks implements INodeType {
|
|||
} as IDataObject;
|
||||
|
||||
body.Line = processLines.call(this, body, lines, resource);
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
body = populateFields.call(this, body, additionalFields, resource);
|
||||
|
|
|
@ -91,6 +91,29 @@ export const billFields: INodeProperties[] = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
description: 'Monetary amount of the line item',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
description: 'Textual description of the line item',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Detail Type',
|
||||
name: 'DetailType',
|
||||
|
@ -116,29 +139,6 @@ export const billFields: INodeProperties[] = [
|
|||
loadOptionsMethod: 'getItems',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
description: 'Monetary amount of the line item',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
description: 'Textual description of the line item',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Position',
|
||||
name: 'LineNum',
|
||||
|
@ -235,7 +235,7 @@ export const billFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -128,7 +128,7 @@ export const customerFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -142,7 +142,7 @@ export const employeeFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -95,6 +95,23 @@ export const estimateFields: INodeProperties[] = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
description: 'Monetary amount of the line item',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
description: 'Textual description of the line item',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Detail Type',
|
||||
name: 'DetailType',
|
||||
|
@ -116,23 +133,6 @@ export const estimateFields: INodeProperties[] = [
|
|||
loadOptionsMethod: 'getItems',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
description: 'Monetary amount of the line item',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
description: 'Textual description of the line item',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Position',
|
||||
name: 'LineNum',
|
||||
|
@ -140,6 +140,15 @@ export const estimateFields: INodeProperties[] = [
|
|||
type: 'number',
|
||||
default: 1,
|
||||
},
|
||||
{
|
||||
displayName: 'Tax Code Ref',
|
||||
name: 'TaxCodeRef',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTaxCodeRefs',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -210,7 +219,7 @@ export const estimateFields: INodeProperties[] = [
|
|||
type: 'boolean',
|
||||
required: true,
|
||||
default: false,
|
||||
description: 'Download the estimate as a PDF file',
|
||||
description: 'Whether to download the estimate as a PDF file',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -290,7 +299,7 @@ export const estimateFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -99,6 +99,23 @@ export const invoiceFields: INodeProperties[] = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
description: 'Monetary amount of the line item',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
description: 'Textual description of the line item',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Detail Type',
|
||||
name: 'DetailType',
|
||||
|
@ -120,23 +137,6 @@ export const invoiceFields: INodeProperties[] = [
|
|||
loadOptionsMethod: 'getItems',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
description: 'Monetary amount of the line item',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
description: 'Textual description of the line item',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Position',
|
||||
name: 'LineNum',
|
||||
|
@ -144,6 +144,15 @@ export const invoiceFields: INodeProperties[] = [
|
|||
type: 'number',
|
||||
default: 1,
|
||||
},
|
||||
{
|
||||
displayName: 'Tax Code Ref',
|
||||
name: 'TaxCodeRef',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTaxCodeRefs',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -214,7 +223,7 @@ export const invoiceFields: INodeProperties[] = [
|
|||
type: 'boolean',
|
||||
required: true,
|
||||
default: false,
|
||||
description: 'Download the invoice as a PDF file',
|
||||
description: 'Whether to download the invoice as a PDF file',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -294,7 +303,7 @@ export const invoiceFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -76,7 +76,7 @@ export const itemFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -163,7 +163,7 @@ export const paymentFields: INodeProperties[] = [
|
|||
type: 'boolean',
|
||||
required: true,
|
||||
default: false,
|
||||
description: 'Download estimate as PDF file',
|
||||
description: 'Whether to download estimate as PDF file',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -243,7 +243,7 @@ export const paymentFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -76,7 +76,7 @@ export const purchaseFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
|
@ -44,7 +44,7 @@ export const transactionFields: INodeProperties[] = [
|
|||
// transaction: getReport
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
displayName: 'Simplify Response',
|
||||
name: 'simple',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
|
@ -264,13 +264,6 @@ export const transactionFields: INodeProperties[] = [
|
|||
description: 'Predefined account modifiction date range to filter results by',
|
||||
options: PREDEFINED_DATE_RANGES.map(toOptions),
|
||||
},
|
||||
{
|
||||
displayName: 'Document Number',
|
||||
name: 'docnum',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Transaction document number to filter results by',
|
||||
},
|
||||
{
|
||||
displayName: 'Department',
|
||||
name: 'department',
|
||||
|
@ -281,6 +274,13 @@ export const transactionFields: INodeProperties[] = [
|
|||
loadOptionsMethod: 'getDepartments',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Document Number',
|
||||
name: 'docnum',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Transaction document number to filter results by',
|
||||
},
|
||||
{
|
||||
displayName: 'Group By',
|
||||
name: 'group_by',
|
||||
|
@ -346,6 +346,14 @@ export const transactionFields: INodeProperties[] = [
|
|||
default: 'Ascend',
|
||||
options: ['Ascend', 'Descend'].map(toOptions),
|
||||
},
|
||||
{
|
||||
displayName: 'Source Account Type',
|
||||
name: 'source_account_type',
|
||||
default: 'Bank',
|
||||
type: 'options',
|
||||
description: 'Account type to filter results by',
|
||||
options: SOURCE_ACCOUNT_TYPES.map(toOptions).map(toDisplayName),
|
||||
},
|
||||
{
|
||||
displayName: 'Term',
|
||||
name: 'term',
|
||||
|
@ -374,15 +382,6 @@ export const transactionFields: INodeProperties[] = [
|
|||
description: 'Transaction type to filter results by',
|
||||
options: TRANSACTION_TYPES.map(toOptions).map(toDisplayName),
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Source Account Type',
|
||||
name: 'source_account_type',
|
||||
default: 'Bank',
|
||||
type: 'options',
|
||||
description: 'Account type to filter results by',
|
||||
options: SOURCE_ACCOUNT_TYPES.map(toOptions).map(toDisplayName),
|
||||
},
|
||||
{
|
||||
displayName: 'Vendor',
|
||||
name: 'vendor',
|
||||
|
|
|
@ -128,7 +128,7 @@ export const vendorFields: INodeProperties[] = [
|
|||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
|
|
Loading…
Reference in a new issue