Hi friends,
-
I want to create multiple Product receipt from single Purchase order Line.
-
I have totally 10 Purchase Qty. Now i am receiving 5 Purchase qty only.
PurchFormLetter_PackingSlip purchProductReceipt;
// let’s say, product receipt is for PO: ‘PO-0030’
purchTbl = PurchTable::find(SRVTable.PurchId);
// initiate PurchFormLetter_PackingSlip class
purchProductReceipt = PurchFormLetter::construct(DocumentStatus::PackingSlip);
purchProductReceipt.showQueryForm(false);
ttsBegin;
select forUpdate purchLine
where purchLine.PurchId == purchTbl.PurchId
&& purchLine.IsDeleted == NoYes::No;
if(purchLine)
{
purchLine.PurchReceivedNow = 5;
purchLine.InventReceivedNow = 5;
purchLine.update();
}
ttsCommit;
}
// invoke product receipt
// input parameters are POtable, Receipt num, date of receiving, qty, account order
purchProductReceipt.update(purchTbl, today(), today(), PurchUpdate::ReceiveNow, AccountOrder::None, false, false);
This Code is Working fine for multiple Product Receipt.
3.When I activate the Purchase order Workflow . The Above Code is Not working .
it throw error at the time of updating the Purchase order Line.
Error(“Changes to the document are only allowed in state Draft, because change management is activated.”)
-
So, Not possible to update Purchline Table. Because of change management(Workflow) is activated . PurchLine table is updated only when PO document status is draft.
-
Please Suggest the Solution