Hi Herve,
You will want to store the function object in some global variable so you use the same reference when adding and removing. What your test portlet is doing is redeclaring the function every time the page fragment is rendered, so it is using different function references on each render.
For example, do something like this:
//remove the previous reference
CAF.model("#{activePageBean.clientIds['button']}").removeActionCompleteListener(window.doSomethingFn);
//re-declare the function and store it on the window object
window.doSomethingFn = function(){
alert("hereeeeeeeee");
}
//add a reference
CAF.model("#{activePageBean.clientIds['button']}").addActionCompleteListener(window.doSomethingFn);
#webMethods#MWS-CAF-Task-Engine#webMethods-BPMS