Jump to content

Advanced stock problem? or bad use of the BO from my client?


Recommended Posts

Hi! I don't know 100% if this it's a bug or a bad use of our Prestashop, I explain. We've a shop running with the advanced stock manager enabled. We've a product (ID 25), if we go to Stock we've this:





Ok, we've supposedly 25 units in stock (it's a simple sum of the physical_quantity column from ps_stock), but If we try to remove 1...




We  cannot remove it! looking in our database (we're developers, we've tried to do reverse engineering to see what can happen without luck!).


In the ps_stock table we've 3 rows of the id_product 25:




Executing this query (extracted from StockManager, line 310 aprox..):

SELECT sm.`id_stock_mvt`, sm.`date_add`, sm.`physical_quantity`,
IF ((sm2.`physical_quantity` is null), sm.`physical_quantity`,
 (sm.`physical_quantity` - SUM(sm2.`physical_quantity`))) as qty
 FROM `ps_stock_mvt` sm LEFT JOIN `ps_stock_mvt` sm2 ON sm2.`referer` = sm.`id_stock_mvt`
 WHERE sm.`sign` = 1 AND sm.`id_stock` IN (48,130,79) GROUP BY sm.`id_stock_mvt` ORDER BY sm.`date_add` DESC

The qty column is ALWAYS 0, so.. the error "You don't have enough usable quantity..." comes from here!  we don't know how to solve that without destroy nothing :)



Can someone shed lite on that!? thanks!







Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...