« Logiciel Pastèque/API/Fix dupes in stocks » : différence entre les versions

Contenu supprimé Contenu ajouté
Elfi (discussion | contributions)
Récupéré du wiki historique
(Aucune différence)

Version du 9 octobre 2018 à 11:05

Fix for pasteque server issue #15

Issue 15: Doublons appears in inventory

Found on 6.0

Caused by: adding movements with 0 quantities duplicates stockcurrent line with null attributesetinstance_id.

Fix for 7.0: don't save movements with 0 as quantity in StockService

Rebuild a broken STOCKCURRENT table

Use the following script to rebuild the broken table from STOCKDIARY

MySQL:

-- Kill the crappy STOCKCURRENT
TRUNCATE STOCKCURRENT;
 
-- Rebuild from STOCKDIARY
INSERT INTO STOCKCURRENT (LOCATION, PRODUCT, ATTRIBUTESETINSTANCE_ID, UNITS)
SELECT LOCATION, PRODUCT, ATTRIBUTESETINSTANCE_ID, SUM(UNITS) AS UNITS FROM STOCKDIARY GROUP BY LOCATION, PRODUCT, ATTRIBUTESETINSTANCE_ID;