n8n/packages/nodes-base/nodes/Zoho/descriptions/PurchaseOrderDescription.ts

554 lines
11 KiB
TypeScript
Raw Normal View History

2021-04-29 02:56:19 -07:00
import {
INodeProperties,
} from 'n8n-workflow';
import {
billingAddress,
makeCustomFieldsFixedCollection,
2021-04-29 02:56:19 -07:00
makeGetAllFields,
2021-05-10 02:11:11 -07:00
makeProductDetails,
2021-04-29 02:56:19 -07:00
shippingAddress,
} from './SharedFields';
export const purchaseOrderOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
},
},
options: [
{
name: 'Create',
value: 'create',
},
2021-06-15 07:54:21 -07:00
{
name: 'Create or update',
value: 'upsert',
2021-06-15 07:55:53 -07:00
description: 'Create a new record, or update the current one if it already exists (upsert)',
2021-06-15 07:54:21 -07:00
},
2021-04-29 02:56:19 -07:00
{
name: 'Delete',
value: 'delete',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Update',
value: 'update',
},
],
default: 'create',
description: 'Operation to perform',
},
] as INodeProperties[];
export const purchaseOrderFields = [
// ----------------------------------------
// purchaseOrder: create
2021-04-29 02:56:19 -07:00
// ----------------------------------------
{
displayName: 'Subject',
name: 'subject',
description: 'Subject or title of the purchase order.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
operation: [
'create',
],
},
},
},
// ----------------------------------------
// purchaseOrder: upsert
// ----------------------------------------
{
displayName: 'Subject',
name: 'subject',
description: 'Subject or title of the purchase order. If a record with this subject exists it will be updated, otherwise a new one will be created.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
operation: [
2021-05-31 02:01:13 -07:00
'upsert',
2021-04-29 02:56:19 -07:00
],
},
},
},
// ----------------------------------------
// purchaseOrder: create + upsert
// ----------------------------------------
2021-04-29 02:56:19 -07:00
{
2021-05-09 14:25:55 -07:00
displayName: 'Vendor ID',
name: 'vendorId',
type: 'options',
default: [],
typeOptions: {
loadOptionsMethod: 'getVendors',
},
description: 'ID of the vendor associated with the purchase order.',
2021-04-29 02:56:19 -07:00
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
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('purchaseOrder'),
2021-04-29 02:56:19 -07:00
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
operation: [
'create',
2021-06-01 02:21:55 -07:00
'upsert',
2021-04-29 02:56:19 -07:00
],
},
},
options: [
{
displayName: 'Adjustment',
name: 'Adjustment',
type: 'number',
2021-05-09 14:25:55 -07:00
default: 0,
typeOptions: {
minValue: 0,
},
2021-04-29 02:56:19 -07:00
description: 'Adjustment in the grand total, if any.',
},
{
displayName: 'Billing Address',
name: 'Billing_Address',
type: 'fixedCollection',
default: {},
placeholder: 'Add Billing Address Field',
options: [
{
displayName: 'Billing Address Fields',
name: 'billing_address_fields',
values: [
{
displayName: 'Billing City',
name: 'Billing_City',
type: 'string',
default: '',
},
{
displayName: 'Billing Code',
name: 'Billing_Code',
type: 'string',
default: '',
},
{
displayName: 'Billing Country',
name: 'Billing_Country',
type: 'string',
default: '',
},
{
displayName: 'Billing State',
name: 'Billing_State',
type: 'string',
default: '',
},
{
displayName: 'Billing Street',
name: 'Billing_Street',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Carrier',
name: 'Carrier',
type: 'string',
default: '',
description: 'Name of the carrier.',
},
{
displayName: 'Currency',
name: 'Currency',
type: 'string',
default: '',
description: 'Symbol of the currency in which revenue is generated.',
},
makeCustomFieldsFixedCollection('purchaseOrder'),
2021-04-29 02:56:19 -07:00
{
displayName: 'Description',
name: 'Description',
type: 'string',
default: '',
},
{
displayName: 'Discount',
name: 'Discount',
type: 'number',
2021-05-09 14:25:55 -07:00
default: 0,
typeOptions: {
minValue: 0,
},
2021-04-29 02:56:19 -07:00
},
{
displayName: 'Due Date',
name: 'Due_Date',
2021-05-09 14:25:55 -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-09 14:25:55 -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-09 14:25:55 -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.',
},
{
displayName: 'PO Date',
name: 'PO_Date',
2021-05-09 14:25:55 -07:00
type: 'dateTime',
2021-04-29 02:56:19 -07:00
default: '',
description: 'Date on which the purchase order was issued.',
},
{
displayName: 'PO Number',
name: 'PO_Number',
type: 'string',
default: '',
description: 'ID of the purchase order after creating a case.',
},
{
displayName: 'Sales Commission',
name: 'Sales_Commission',
2021-05-09 14:25:55 -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 purchase order.',
},
{
displayName: 'Sub Total',
name: 'Sub_Total',
type: 'number',
2021-05-09 14:25:55 -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-09 14:25:55 -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.',
},
{
displayName: 'Tracking Number',
name: 'Tracking_Number',
type: 'string',
default: '',
},
],
},
// ----------------------------------------
// purchaseOrder: delete
// ----------------------------------------
{
displayName: 'Purchase Order ID',
name: 'purchaseOrderId',
description: 'ID of the purchase order to delete.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// purchaseOrder: get
// ----------------------------------------
{
displayName: 'Purchase Order ID',
name: 'purchaseOrderId',
description: 'ID of the purchase order to retrieve.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
operation: [
'get',
],
},
},
},
// ----------------------------------------
// purchaseOrder: getAll
// ----------------------------------------
...makeGetAllFields('purchaseOrder'),
// ----------------------------------------
// purchaseOrder: update
// ----------------------------------------
{
displayName: 'Purchase Order ID',
name: 'purchaseOrderId',
description: 'ID of the purchase order to update.',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'purchaseOrder',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Adjustment',
name: 'Adjustment',
type: 'number',
2021-05-09 14:25:55 -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.',
},
{
displayName: 'Currency',
name: 'Currency',
type: 'string',
default: '',
description: 'Symbol of the currency in which revenue is generated.',
},
makeCustomFieldsFixedCollection('purchaseOrder'),
2021-04-29 02:56:19 -07:00
{
displayName: 'Description',
name: 'Description',
type: 'string',
default: '',
},
{
displayName: 'Discount',
name: 'Discount',
type: 'number',
2021-05-09 14:25:55 -07:00
default: 0,
typeOptions: {
minValue: 0,
},
2021-04-29 02:56:19 -07:00
},
{
displayName: 'Due Date',
name: 'Due_Date',
2021-05-09 14:25:55 -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-09 14:25:55 -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-09 14:25:55 -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.',
},
{
displayName: 'PO Date',
name: 'PO_Date',
2021-05-09 14:25:55 -07:00
type: 'dateTime',
2021-04-29 02:56:19 -07:00
default: '',
description: 'Date on which the purchase order was issued.',
},
{
displayName: 'PO Number',
name: 'PO_Number',
type: 'string',
default: '',
description: 'ID of the purchase order after creating a case.',
},
2021-05-09 14:25:55 -07:00
// productDetails('purchaseOrder', 'update'),
2021-04-29 02:56:19 -07:00
{
displayName: 'Sales Commission',
name: 'Sales_Commission',
2021-05-09 14:25:55 -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 purchase order.',
},
{
displayName: 'Sub Total',
name: 'Sub_Total',
type: 'number',
2021-05-09 14:25:55 -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 purchase order.',
},
{
displayName: 'Tax',
name: 'Tax',
type: 'number',
2021-05-09 14:25:55 -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.',
},
{
displayName: 'Tracking Number',
name: 'Tracking_Number',
type: 'string',
default: '',
},
],
},
] as INodeProperties[];