frmAllocations not sticking  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

frmAllocations not sticking

Postby neil.interactit » Wed Sep 20, 2023 5:32 pm

Hey guys,

I mentioned in the "Finalise Shipment event" forum post that a client has me building a "Deposit Payments" sub system that allows creditor payments made ahead of a purchase order fullfillment or before shipment to be linked to the relevent POs/Shipments.

I now have the CreatesDialog<frmAllocations> appearing correctly after the Finalise Shipment step, pre-filled with the associated payments. It appears to operate correctly and normally, allowing allocation of payments, which I do then click OK and the form closes. However, when I check the creditor transactions, the allocations have not happenned.

I haven't included a sample plugin as this is a multiple plugin sub-system and it is a little hard to isolate this aspect.

I lifted the code from the JiwaFinancials.Jiwa.JiwaCreditorsUI.frmCreditor.DisplayAllocationsForm(CreditorTransaction Transaction) method as follows:
Code: Select all
_manager.DialogFactory.CreateDialog<frmAllocations>(new object[5] { transId, creditor, null, null, null }, _shipmentForm, "Creditors Maintenance").ShowDialog(_shipmentForm);

I have used _shipmentForm which is the current JiwaFinancials.Jiwa.JiwaLandedCostUI.Shipment.Shipment in place of "this" in frmCreditor.DisplayAllocationsForm (which is obviously the current frmCreditor) but I can't spot anything funky that frmAllocations is doing with the passed form.

I also tried a _manager.Database.Commit(); straight after the CreateDialog call, in case I was losing the allocations for lack of a commit, but this did not help.

Can you point out what I am missing?

Cheers,
Neil.
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: frmAllocations not sticking  Topic is solved

Postby Mike.Sheen » Wed Sep 20, 2023 6:37 pm

neil.interactit wrote:I also tried a _manager.Database.Commit(); straight after the CreateDialog call, in case I was losing the allocations for lack of a commit, but this did not help.

Can you point out what I am missing?


You're passing a creditor object to that dialog, and that dialog will be meddling with the transactions and allocations of that object - so to save those changes you need to invoke creditor.Save() if the dialog result was Ok.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: frmAllocations not sticking

Postby neil.interactit » Thu Sep 21, 2023 9:04 am

Perfect! Thanks Mike.
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 27 guests