Hi - latest project needs to be able to deal with stock items, maintaining stock records and invoicing.
The problem I have is that when invoicing the stock items are entered via a M2M field with the stock record - therefore I can only have one M2M field on the invoice which is linked to the stock records. Is there any way round this so that I can have more than one M2M linked to the same stock record.
Both questions kind of fall under the same answer.
You go to your Stock Items folder, and you select the item the custom wants to order. You press the “Add to Cart” button and the following script will run...
A “User Input” window pops up asking how many do you want to order.
You enter a value.
This value you enter is then populated into a variable called “amount”.
Another variable called “trace” is populated with the current record ID.
The record is cloned and the field amount is populated by the variable amount.
The record is moved to the Shopping Cart folder.
The Select Folder action brings you back to the Stock Items folder.
The Select Record action uses the variable “trace” to find and select the original stock item.
The variable amount is taken away from the current stock amount.
So you would select other items the customer might want, each time the script above runs.
When the customer is finished order, you go to your invoice folder, create an invoice and populate it's many to many with the contents the customer ordered which are in the shopping cart.
That's how I wrote the program originally for the company and they used that system for years. As they got bigger they wanted to save some time and have the shopping cart auto populated into the invoice.
I can explain how to do that, but it's not easy as you have to write a trace system that tracks all orders placed between the time you created the last invoice vs the current system time.