


insert into llx_stock_mouvement_extrafields (tms, fk_object, type, dae)
select llx_stock_mouvement.tms,
       llx_stock_mouvement.rowid,
       'Expedition',
       ''
from llx_stock_mouvement
         left join llx_stock_mouvement_extrafields lsme
                   on llx_stock_mouvement.rowid = lsme.fk_object
where type is null
  and llx_stock_mouvement.origintype = 'facture'
and llx_stock_mouvement.value < 0;


insert into llx_stock_mouvement_extrafields (tms, fk_object, type, dae)
select llx_stock_mouvement.tms,
       llx_stock_mouvement.rowid,
       'Annulation Expedition',
       ''
from llx_stock_mouvement
         left join llx_stock_mouvement_extrafields lsme
                   on llx_stock_mouvement.rowid = lsme.fk_object
where type is null
  and llx_stock_mouvement.origintype = 'facture'
and llx_stock_mouvement.value > 0;
