Clean old lot numbers

This commit is contained in:
Laurent Destailleur 2017-06-25 02:26:30 +02:00
parent 778e581aca
commit 6298436a1b
2 changed files with 6 additions and 0 deletions

View File

@ -497,3 +497,6 @@ CREATE TABLE llx_blockedlog_authority
) ENGINE=innodb;
ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature);
-- VMYSQL4.1 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid

View File

@ -92,6 +92,9 @@ delete from llx_product_extrafields where fk_object not in (select rowid from ll
update llx_product_batch set batch = '' where batch = 'Non défini';
update llx_product_batch set batch = '' where batch = 'Non défini';
update llx_stock_mouvement set batch = null where batch = 'Non défini';
update llx_stock_mouvement set batch = null where batch = 'Non défini';
DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product);
DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product);
DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb);