When I try to create multiple purchase orders from newly created form, it is throwing error “Order Account cannot be changed” but if I create single purchase order, I can be able to create it. What can be done to resolve this?
Are there any customization around this area? Also can you post your code?
This is the code I ve done for creating purch order from my form.
while select table where table .fieldid == _table .fieldid
numberSeq = NumberSeq::newGetNumFromCode(PurchParameters::numRefPurchId().NumberSequence,true);
purchtable.PurchId = numberSeq.num();
purchtable.PurchaseType = PurchaseType::Purch;
purchtable.OrderAccount = table .Vendor;
purchLine.PurchId = purchtable.PurchId;
purchLine.ItemId = table.ItemID;
where invent.InventSiteId == table.inventsiteid;
purchLine.InventDimId = InventDim::findOrCreate(invent).inventDimId;
PurchLine.createLine(true, true, true, true, true, true);
Actually I am facing the same problem. How did you resolve it ?
Thank you in advance.
As per the error message, i think that when you are creating multiple PO, the first record is getting created without any problem but when the second PO is getting created, it is changing the vendor account of the first record only. order account is nothing but vendor code in purch table.
Check that, may be that is creating problem.
Hi, Try clearing PurchTable everytime. PurchTable.clear() initially and start doing all other process. This may work. Go for a try. Regards, Kuppusamy S
I had already purchtable.clear() but it didn’t resolve the problem, so I put Purchtable = null; before the clear and it works perfectly now !
It seems that purchTable_Orig.RecId was not empty in the validateWrite method…
Thank you very much !
I’ve just got the same error when I try the creating Sales Order through xpp code, I put Salestable = null; SalesTable.clear() and the code running as well.
Thanks M.A.B very much.