I need to look into this further, but the short answer to solve your issue is to remove the Sales
Quote form from the Forms tab of your plugin.
Longer answer:
It took me a bit to reproduce your error - it didn't occur for me when loading the Sales
Order form -
at first.
Then I looked at your plugin, and noticed in the Setup and SetupBeforeHandlers methods you're casting the passed in Jiwa form to the inventory maintenance form... I noticed then on the Forms tab you've got both the Inventory Maintenance Form and the Sales Quote Form there.
So, having seen that I tried to load the Sales
Quote form and did get your error. Then I got the error whenever I tried to load ANY form - including the Sales
Order form.
What's happening here is you've instructed the plugin framework to run your Setup and SetupBeforeHandlers methods whenever the Inventory Maintenance form OR the Sales
Quote form is loaded by adding them to the Forms tab of your plugin.
In the Setup/SetupBeforeHandlers method you're not selectively casting the JiwaForm parameter - i.e.:
- Code: Select all
Dim INVUI As JiwaInventoryUI.InventoryMaintenanceForm = DirectCast(JiwaForm, JiwaInventoryUI.InventoryMaintenanceForm)
If you DO want the same plugin to do stuff for multiple different forms, you'll need to check the type before trying to cast - e.g.:
- Code: Select all
If TypeOf JiwaForm Is JiwaInventoryUI.InventoryMaintenanceForm Then
Dim INVUI As JiwaInventoryUI.InventoryMaintenanceForm = DirectCast(JiwaForm, JiwaInventoryUI.InventoryMaintenanceForm)
ElseIf TypeOf JiwaForm Is JiwaSalesUI.SalesQuote.SalesQuoteEntryForm Then
Dim QUOTEUI As JiwaSalesUI.SalesQuote.SalesQuoteEntryForm = DirectCast(JiwaForm, JiwaSalesUI.SalesQuote.SalesQuoteEntryForm )
End If
BUT - you don't seem to do anything related to the quote form, so it is probably a simple case of that being added to the Form tab accidentally - so just removing it resolves the issue.
However - I want to look into this deeper, as you may have uncovered a bug - I don't understand why it works for the sales order form UNTIL you open the quote form (and get the error as I would expect) - and subsequent attempts to load anything other than inventory maintenance causes the same error - something screwy is going on.
Mike