2021-04-29 02:56:19 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
import {
|
|
|
|
billingAddress,
|
|
|
|
makeGetAllFields,
|
2021-05-10 02:11:11 -07:00
|
|
|
makeProductDetails,
|
2021-04-29 02:56:19 -07:00
|
|
|
shippingAddress,
|
|
|
|
} from './SharedFields';
|
|
|
|
|
|
|
|
export const salesOrderOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
},
|
2021-05-31 02:01:13 -07:00
|
|
|
{
|
|
|
|
name: 'Upsert',
|
|
|
|
value: 'upsert',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
description: 'Operation to perform',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const salesOrderFields = [
|
|
|
|
// ----------------------------------------
|
2021-05-31 02:01:13 -07:00
|
|
|
// salesOrder: create + upsert
|
2021-04-29 02:56:19 -07:00
|
|
|
// ----------------------------------------
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Account ID',
|
|
|
|
name: 'accountId',
|
2021-04-29 02:56:19 -07:00
|
|
|
required: true,
|
2021-05-10 02:11:11 -07:00
|
|
|
type: 'options',
|
|
|
|
default: [],
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getAccounts',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
2021-05-31 02:01:13 -07:00
|
|
|
'upsert',
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Subject',
|
|
|
|
name: 'subject',
|
|
|
|
description: 'Subject or title of the sales order.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
2021-05-31 02:01:13 -07:00
|
|
|
'upsert',
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-06-01 02:21:55 -07:00
|
|
|
makeProductDetails('salesOrder'),
|
2021-04-29 02:56:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
2021-05-31 02:01:13 -07:00
|
|
|
'upsert',
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Adjustment',
|
|
|
|
name: 'Adjustment',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Adjustment in the grand total, if any.',
|
|
|
|
},
|
|
|
|
billingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Carrier',
|
|
|
|
name: 'Carrier',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Name of the carrier.',
|
|
|
|
},
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Contact ID',
|
|
|
|
name: 'contactId',
|
|
|
|
type: 'options',
|
|
|
|
default: [],
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getContacts',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Currency',
|
|
|
|
name: 'Currency',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Symbol of the currency in which revenue is generated.',
|
|
|
|
},
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'options',
|
|
|
|
default: [],
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getDeals',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Description',
|
|
|
|
name: 'Description',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Discount',
|
|
|
|
name: 'Discount',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Due Date',
|
|
|
|
name: 'Due_Date',
|
2021-05-10 02:11:11 -07:00
|
|
|
type: 'dateTime',
|
2021-04-29 02:56:19 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Exchange Rate',
|
|
|
|
name: 'Exchange_Rate',
|
2021-05-07 04:19:01 -07:00
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Exchange rate of the default currency to the home currency.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Grand Total',
|
|
|
|
name: 'Grand_Total',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product after deducting tax and discounts.',
|
|
|
|
},
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Sales Order Number',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'SO_Number',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'ID of the sales order after creating a case.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sales Commission',
|
|
|
|
name: 'Sales_Commission',
|
2021-05-10 02:11:11 -07:00
|
|
|
type: 'number',
|
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Commission of sales person on deal closure.',
|
|
|
|
},
|
|
|
|
shippingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Status',
|
|
|
|
name: 'Status',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Status of the sales order.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sub Total',
|
|
|
|
name: 'Sub_Total',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product excluding tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Tax',
|
|
|
|
name: 'Tax',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Tax amount as the sum of sales tax and value-added tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Terms and Conditions',
|
|
|
|
name: 'Terms_and_Conditions',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Terms and conditions associated with the purchase order.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// salesOrder: delete
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Sales Order ID',
|
|
|
|
name: 'salesOrderId',
|
|
|
|
description: 'ID of the sales order to delete.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// salesOrder: get
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Sales Order ID',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'salesOrderId',
|
|
|
|
description: 'ID of the sales order to retrieve.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// salesOrder: getAll
|
|
|
|
// ----------------------------------------
|
|
|
|
...makeGetAllFields('salesOrder'),
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// salesOrder: update
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Sales Order ID',
|
|
|
|
name: 'salesOrderId',
|
|
|
|
description: 'ID of the sales order to update.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'salesOrder',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Account ID',
|
|
|
|
name: 'accountId',
|
|
|
|
type: 'options',
|
|
|
|
default: [],
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getAccounts',
|
|
|
|
},
|
|
|
|
description: 'ID of the account associated with this invoice.',
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Adjustment',
|
|
|
|
name: 'Adjustment',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Adjustment in the grand total, if any.',
|
|
|
|
},
|
|
|
|
billingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Carrier',
|
|
|
|
name: 'Carrier',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Name of the carrier.',
|
|
|
|
},
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Contact ID',
|
|
|
|
name: 'contactId',
|
|
|
|
type: 'options',
|
|
|
|
default: [],
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getContacts',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Currency',
|
|
|
|
name: 'Currency',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Symbol of the currency in which revenue is generated.',
|
|
|
|
},
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'options',
|
|
|
|
default: [],
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getDeals',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Description',
|
|
|
|
name: 'Description',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Discount',
|
|
|
|
name: 'Discount',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Due Date',
|
|
|
|
name: 'Due_Date',
|
2021-05-10 02:11:11 -07:00
|
|
|
type: 'dateTime',
|
2021-04-29 02:56:19 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Exchange Rate',
|
|
|
|
name: 'Exchange_Rate',
|
2021-05-07 04:19:01 -07:00
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Exchange rate of the default currency to the home currency.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Grand Total',
|
|
|
|
name: 'Grand_Total',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product after deducting tax and discounts.',
|
|
|
|
},
|
|
|
|
{
|
2021-05-10 02:11:11 -07:00
|
|
|
displayName: 'Sales Order Number',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'SO_Number',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'ID of the sales order after creating a case.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sales Commission',
|
|
|
|
name: 'Sales_Commission',
|
2021-05-10 02:11:11 -07:00
|
|
|
type: 'number',
|
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Commission of sales person on deal closure.',
|
|
|
|
},
|
|
|
|
shippingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Status',
|
|
|
|
name: 'Status',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Status of the sales order.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sub Total',
|
|
|
|
name: 'Sub_Total',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product excluding tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Subject',
|
|
|
|
name: 'Subject',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Subject or title of the sales order.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Tax',
|
|
|
|
name: 'Tax',
|
|
|
|
type: 'number',
|
2021-05-10 02:11:11 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Tax amount as the sum of sales tax and value-added tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Terms and Conditions',
|
|
|
|
name: 'Terms_and_Conditions',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Terms and conditions associated with the purchase order.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|