Page 1 of 1
Stop the dialog makeSupplierTheDefaultDialog

Posted:
Thu Jun 04, 2026 3:13 pm
by DannyC
Purchase Orders when a line is added I want to stop the makeSupplierTheDefaultDialog from showing and default to No.
I've fiddled about with the attached plugin but the dialog still displays.
Can you give me a bit of assistance?
Cheers
v 7.2.1 SP20
Re: Stop the dialog makeSupplierTheDefaultDialog

Posted:
Thu Jun 04, 2026 3:42 pm
by Mike.Sheen
DannyC wrote:Purchase Orders when a line is added I want to stop the makeSupplierTheDefaultDialog from showing and default to No.
I've fiddled about with the attached plugin but the dialog still displays.
Can you give me a bit of assistance?
Cheers
v 7.2.1 SP20
Just remove your throwing of the ClientCancelledException inside your Cancel_makeSupplierTheDefaultDialog method handler. You're setting the byref cancel parameter to true in there, and that's all you need to do. I did that, and the dialog does not appear.
Re: Stop the dialog makeSupplierTheDefaultDialog

Posted:
Thu Jun 04, 2026 4:22 pm
by DannyC
Hmmm, not sure what I'm doing different but I still get the prompt but only the first time after a Jiwa restart.
remmed out the ClientCancelledException. Restarted Jiwa.
The behaviour is like this:
1. Restart Jiwa.
2. Create new purchase order
3. Add line
4. Get the prompt "This item has not been ordered from this supplier before". Click Yes to keep adding this line
5. Get the prompt "Do you want to set this supplier as the default supplier?"
Click No.
Cancel the purchase order. Jiwa reloads the old PO.
1. Create new purchase order
2. Add line
3. Get the prompt "This item has not been ordered from this supplier before". Click Yes to keep adding this line
4. Then the line is added without the "Do you want to set this supplier as the default supplier?"
Re: Stop the dialog makeSupplierTheDefaultDialog 

Posted:
Thu Jun 04, 2026 4:34 pm
by Mike.Sheen
That's on me - I wasn't paying close enough attention and when debugging I assumed the first part I added was already the default supplier - your plugin only starts working after one line has been added - from that point onwards it suppresses that dialog - but also I should have noticed this but you were adding a handler inside the Lines.Added handler and never removing it - so I'm pretty sure every time a line was added, another handler would be queued up so after adding 10 lines, the Cancel_makeSupplierTheDefaultDialog would be called 10 times repeatedly when a line is added, called 11 times when the 11 line is added and so on.
I've modified your plugin and changed it so it works all the time now - attached.
Re: Stop the dialog makeSupplierTheDefaultDialog

Posted:
Thu Jun 04, 2026 5:01 pm
by DannyC
Making a forum post is my last resort.
Man, I was so close
Seems so simple now I've got a working plugin
Thanks for the speedy fix Mike.