What is the minimum sales quantity?

We got a fun ticket from one of our users the other day, asking how to set the minimum quantity a salesperson can sell. ERPAG has a built-in option for minimum PURCHASE quantity https://www.erpag.com/news/order-step-quantity-and-minimum-order-quantity-2. However, this applies to items being purchased, not sold. So, the question was how to set a minimum quantity of items for sales. The answer, of course, is by using custom fields and blockly scripts!

Custom fields: https://www.erpag.com/news/custom-fields-upgraded

More of our blockly script examples can be found here: https://www.erpag.com/customization-examples

Setting up custom fields

First, you will have to set a Minimum Sales Quantity custom field on the item level:

custom field on item level

Then, set a Minimum Sales Quantity custom field on the Sales Order – document items level. Set it that it’s copied from the field Item – Minimum Sales Quantity (that you previously created):

Custom fields are created in the Automatization & Customization module, for those new here and wondering where to find this setup. And setting up these custom fields is mandatory, as we will use them in our blockly script!

Setting minimum Sales Quantity (custom field) for each item

Now that you have created your custom fields, each item in your database will get a new field in which you have to input your minimum quantity for sales:

populate minimum sales quantity on each item

To speed things up, you can add these values in bulk through the bulk edit option. Just select the products from your products & services page > bulk action > bulk edit, and you will get to this window:

bulk edit custom fields value

Creating the Blockly script

Go to Automatization & Customization and create a Trigger script as shown:

Save the script & run it!

Creating a Sales Order

Create your Sales Order as usual, but if you put less quantity to be sold than is required, you will get an error upon saving the document. You won’t be able to save the document until you change the quantity.

error message blockly script

Start NOW

Read More

Related Posts

​ERPAG API – Dropbox OAuth 2.0 authorization

​ERPAG API – Dropbox OAuth 2.0 authorization

In this instruction blog, we will show you how to create OAuth 2.0 API keys on your Dropbox account. These are necessary to make API calls from ERPAG via Blockly scripts. The instructions show how the process itself currently looks. But in the meantime, the design of...

read more
Fixed Assets Management

Fixed Assets Management

Basic information about fixed assets This is a specific type of item. The basic characteristic is that it serves to perform activities/tasks, its life cycle is of a longer period (usually several years) during which it is gradually consumed (amortized/depreciated)....

read more
ERPAG Change Log 04-10-2024

ERPAG Change Log 04-10-2024

We prepared a new set of changes that are already up and running in your databases! Backdating documents - you can now change the document date: https://www.erpag.com/news/change-doc-date You can now undo document actions (such as pack, receive, invoice, record...

read more