Plugin help. Move BO lines to new order when processed  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Plugin help. Move BO lines to new order when processed

Postby DannyC » Fri Jul 01, 2022 10:50 am

I've knocked up a plugin which moves any backordered lines to a new sales order (as a Reserve Order) when the current snapshot is processed, i.e snap 1 as it will process to closed.

I basically ripped the guts out of the standard plugin Move Outstanding Amounts to New Order which is fired by a button. Mine is fired by processing.

It works a treat aside from an error I get at the very end "Object reference not set to an instance of an object". Normally I can work out what causes the error & the resolution.
But in this case I've stepped through the code with the VS debugger & still can't locate the cause. I have also disabled all other plugins, no luck there either.
I thought I'd chuck the plugin over to the Jiwa brains trust to see what can be done to stop the error.
Attachments
Plugin Attkey Move Backorders to new orders when processed.xml
(41.63 KiB) Downloaded 51 times
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Plugin help. Move BO lines to new order when processed

Postby Mike.Sheen » Fri Jul 01, 2022 11:47 am

I got no such error in SR12.

This is what I did in demo data:

1. Created a new sales order for debtor 1002 - Arthur Creams
2. Added the items 1171 and 1172 to the order. 1171 had backorder quantity of 1, 1172 had no backorders
3. Saved the sales order
4. Processed the sales order - no error reported and 1171 on the order now shows as quantity ordered 0.
5. Navigated next to the next order which was created - has part 1171 on it, quantity ordered 1, quantity backordered 1.

If you can get the error reliably in demo data, please provide exact steps to reproduce similar to the above.

EDIT: Now I am getting the error when processing - it may be occurring only after the 2nd time processing?
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: Plugin help. Move BO lines to new order when processed  Topic is solved

Postby Mike.Sheen » Fri Jul 01, 2022 12:09 pm

Fixed plugin attached.

I just had to remove where you were performing a .Commit and also your .Rollback.

Because you are not starting the SQL transaction, our sales order business logic is, you should not be committing or rolling back transactions. Only if you create the transaction should your plugin be handling that.

The plugin you based this off, Move Outstanding Amounts to New Order, DOES create a new transaction - so it commit's and rolls back - but you commented out in your plugin the creating of the transaction but not the commit and rollback.
Attachments
Plugin Attkey Move Backorders to new orders when processed 7.2.1.1.xml
(42.44 KiB) Downloaded 44 times
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: Plugin help. Move BO lines to new order when processed

Postby DannyC » Mon Jul 04, 2022 11:13 am

Thanks Mike.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 24 guests

cron