Hi guys,
I'm creating credit note through code (X ). While the credit note is created, order type = "Returned order" and has specified RMA number based on Number sequence setup, then when trying to post invoice through code, this time I' always failed but with no error. I also checked that in my parameters, there is no need to specify Return Order Reason.
I'm using this code :
SalesFormLetter formLetterObj;
SalesTable salesTableInv = SalesTable::find(MyTableSales.SalesId);
formLetterObj = SalesFormLetter::construct(DocumentStatus::Invoice);
formLetterObj.update(salesTableInv);
May I ask, if in standard environment, means no customizations, is there any rule that might prevent me to invoice using this way ? Because I think I don't have customization in that SalesFormLetter Classes, and as far as I know, my created sales order already created correctly.
Mind to give me some clue of what might happened ? Sorry, but I tried to debug, but my knowledge on this is limited and can't find what is the problem, when it is goes too deep into SalesFormLetter then I get lost, and in then end I got nothing but the SalesTableInv which is supposed to give me the final result gave me Sales status still in "Open Order" which obviously there is not invoice information.
Thanks,