tsolucio / corebos

core Business Operating System. An OPEN SOURCE business application that helps small and medium business handle all the day to day tasks.
https://corebos.com
151 stars 142 forks source link

Inventorylines get deleted again #980

Open Luke1982 opened 3 years ago

Luke1982 commented 3 years ago

This problem keeps occuring for various reasons. I again have some salesorders where all the lines are gone.

joebordes commented 3 years ago

what are the reasons? why is it happening?

Luke1982 commented 3 years ago

Don't know yet. As always I only notice this after the fact and need to find a common trait that binds them. If and when I do find them I'll report back.

joebordes commented 3 years ago

I just added a couple of changes that may be related

https://github.com/tsolucio/corebos/commit/146405b39c580abcbcacfaa0c7db51c1e0353897

https://github.com/tsolucio/corebos/commit/7b496d55c8e88452a5455707251f68c12be33ebe

while looking into the quote/SO/invoice status change history I found that inventory details are being saved a LOT and the global request gets changed during those saves. The two changes above reduce those context changes and it seems to work better, but you need to validate as I have not been informed of this behavior by anyone else.

Let me know how it goes

Luke1982 commented 3 years ago

I will. Yes, the global/request variable thing related to inventorylines is a VERY precarious thing which I think is a problem. The mechanism is so dependent on these that someone who writes a lot of code that manipulates salesorders (like I do) will likely run into scenario's where you accidentally wipe them. This is the same with product taxes and multicurrency: if you don't mimic the correct request you risk losing a lot of data. This is one of the reasons I'm working on a new inventory mechanism using inventorydetails.