I am trying to rewrite an assembly into a function where we basically take multiple Shipment Invoices from the same order and consolidate the lines into one AR Invoice. I have almost everything working except I am not able to add a new InvcDtl to the existing Invoice. I get this error “Cannot add line items to this type of invoice.”
To generate the new row, I just create a new InvcDtl row and buffer copy all except InvoiceNum, InvoiceLine, SysRowID and SysRevID. Then give it the existing InvoiceNum and next LineNum, row mod = A, add it to the tableset and call Update.
In the assembly code it inserts the row directly to the Db, which is not best practice and I’m not sure I could do that in a Function.
It looks like we have this setting already turned on. It does look like it consolidates them into a new invoice. Our customization will consolidate it into an existing open invoice for that Order.
There are shipments they want to invoice before the Order is fully closed. This is a preexisting process that I’m just converting to a function. I’m attempting to keep it the same with no process changes, just different code to support it.