Jump to content

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


jviure

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:

 

stock_ADV.png

 

 

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...

 

image.png

 

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:

 

Captura_de_pantalla_230516_18_08_04.png

 

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!

 

Cheers,

Jordi

 

 

 

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...