Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using the standard 'create invoice from salesorder' in workflows
#21
Again, it is good to have you around. Would have never known this otherwise. Will test and let you know.
Reply
#22
Well, I seem to have it working. But I still do not understand why the first method did not work, since we had basically the same approach. We only seem to be taking a longer way around now (I must be missing something).

Please take a look at this commit. You won't need all of it, and I'm going to rename it to something else for my own purposes (with a 'cbx' prefix, the reason being that I really need the exact payment conditions and the no. of days to be set per workflow). What I do not understand (and would like to):
  • Why the previous version (that was smaller and didn't have as many work-arounds) did not worl while it was basically doing the same.
  • What the $meta object is, and why you need it to sanitize the input.

Some things that may be weird I will explain:
  • 'Assigned user ID' was not created by the 'getConvertSoToInvoice' function. Although it was there in the salesorder instance (so_focus), it was empty after calling the function 'getConvertSoToInvoice'.
  • I set the invoice status to 'AutoCreated', since it is being created automatically in this case.

And now, it is not working again.... I have no idea why. Again no product lines.

Hmm, it only works when you do a full save.. Not an edit... I guess the system's 'pdoInformation' retrieval cannot be trusted.
Reply
#23
I've been fighting with this all day now and just can't get it to work. I've tried everything I could think of, my last approach was to create an invoice without any productlines and then re-retrieve the productlines from the sales order through a different class method of the workflow class. This class method would then revise the invoice with the product lines from the sales order. So basically split the invoice creation from the inventorylines creation. Nothing works on quick-edit. I can only get it to work on full-save. I'm kind of running out of ideas...

I did however, find this... Which maybe part of the problem?
Reply
#24
In the end.. It was one line that was needed.. And a couple of hours diggind around, but that taught me a lot about the system..

I created a PR, but I don't think it's quite OK yet. Still needs some sanitizing..
Reply
#25
just for reference and completeness in case anybody lands here, we now have this functionality for all four inventory modules in the application:

https://github.com/tsolucio/corebos/pull/87
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)