I found this problem in an old book of math, here is my try:
$$P(a;a) \mapsto ff(a)=2f(a)$$ $$P(a;f(b)) \mapsto f(a+f(b))=f(a)+2f(b)$$ $$P(0;b) \mapsto f(0)=0$$ $$P(0;b) \mapsto f(f(b)-b)=f(b)...(1)$$ $$P(b-f(b);b)\mapsto f(b-f(b))=-f(b)..(2)$$ From (1) and (2), f is odd
I really would be thankful if someone could give me the full solution please, thanks in advance !
As you've seen, by setting $a=b$ we have
$$ f(f(a))=f(a-b+f(b))=f(a)+f(b)=2f(a) $$
And by setting $b=f(b')$ for some $b'\in\mathbb Z$ we get (by using the last result)
$$ f(a+f(b'))=f(a-b+f(b))=f(a)+f(b)=f(a)+f(f(b'))=f(a)+2f(b') $$
And by setting $a=0$ we get
$$ 2f(b')=f(f(b'))=f(0)+2f(b') $$
Thus $f(0)=0$.
Now let $a=f(1)$, we will show that $f(n)=na$ for all $n\in\mathbb Z$, first by induction to show it for all $n\geq 0$:
Finally, for all $0 > n\in\mathbb Z$ we have that $-n, -2n$ are positive so $$f(n)-4na=f(n)+2f(-2n)=f(n+f(-2n))=f((-n)-(-2n)+f(-2n))=f(-n)+f(-2n)=-na-2na=-3na$$ And we get $f(n)=na$.
Now to show $a\in\{0,2\}$, note that we have: $$ a^2=f(a)=f(f(1))=2f(1)=2a $$