Hi,I have a maintenance form that allow user to enter Purchase Invoice data. In same screen, I also allow user to do "immediate" stock transfer.
So, I have tables as below
PurchaseInvoice ---------<- PInvoiceTransfer ->------------- Transfers ---------<- TransferDetails
1:1 (n:n link table) 1:1 1:n
Currently, I save them using transaction with following sequence
Form.Save() ------------> PurchaseInvoice
Form.AfterSave() ------------> Transfer.Save()
------------> TransferDetails.Save()
------------> PinvoiceTransfer.Save()
The problem is, when I call TransferDetails.Save(), it also call Transfer.Save() since Transfer is ParentBO of TransferDetails and it is still dirty. Therefore, Transfer record will be inserted to tabel twice and cause uniqueness record error.
I tried not to call Transfer.Save(), only call TransferDetails.Save(). It works fine. This time, PInvoiceTransfer cause same problem. PInvoiceTransfer.Save() try to call Transfer.Save() also.
How could I solve this problem?
Thank you