I am in the process of creating a creditor purchase based on a purchase order. Going well creating (and displaying) the actual creditor purchase, however I am stuck creating line items. I have tried emulating the various approaches that I can find in examples (purchase order line items, sales order line items, etc) but I can't crack it!
- Code: Select all
Dim purchasesUi = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.FormFactory.CreateForm(Of JiwaCRBatchTXUI.CreditorPurchases)()
purchasesUi.InitialReadMode = JiwaApplication.IJiwaNavigable.ReadModes.None
purchasesUi.Start()
purchasesUi.CRBatchTransObject.CreateNew()
purchasesUi.CRBatchTransObject.Description = String.Format("PO {0} {1} Created by {2}", purchaseOrder.OrderNo, purchaseOrder.Reference, purchaseOrder.Staff.DisplayName)
purchasesUi.CRBatchTransObject.BatchType = CreditorBatchTrans.CreditorBatchTypes.Creditor_Purchase
For Each poLine As JiwaPurchaseOrders.Line In purchaseOrder.Lines
Dim item = New CRBatchTranLine()
item.Creditor = purchaseOrder.Creditor
purchasesUi.CRBatchTransObject.TransLines.Add(item)
Next
purchasesUi.CRBatchTransObject.Save()
This produces an error "item.Creditor is read only" ... is this anywhere close to the correct approach for creating creditor purchase line items?
Thanks in advance,
Neil.


