I wasn't able to read all the posts here, but you can use the 'Duplicate' to duplicate the header and references. You can use NO RULES statement and assign attributes using This and That. Or you can Duplicate with rules, using the Except xxxatribute. For example, I Duplicate an Invoice Header which is a Quote, assign InvoiceType to ThatInvoiceType='Invoice' and use with 'Except' Invoice #. I have an object with the last Invoice # used, and update the invoice # and last used #. Then I duplicate the line items. This works.
Also, I do not use auto-increment because I need the option for the user to be able to override an Invoice #. If the next is 105 but they previously manually entered 105, it bumps up through 105 to the next available. If 106 and 107 were used, then it would increment to 108. I use the exists statement and this executes until an available number is hit. This works and should not have any multi-user issues.
The problem I have is I also do recurring invoices. And It only bumps up to the next number. But if that # was used for some reason, it won't skip to the next available # like it would if I was entering a new invoice. Because I am using the Rules in the main object, after calling the duplicate process, it should execute the rules of the object and work. Not sure why the rules won't execute in the same way as a 'New'.
So basically I am keeping track of the last # used, or entered, increment from that point, but if the incremented # is an existing one, it jumps up to the next and so on.
FreshBooks does this. QuickBooks actually lets you create duplicate invoices numbers which is absurd and Xero is just weird. Any suggestions appreciated. Aware_Support suggested a stored procedure, but I not sure how this would work.
Mark F