The question is to show that given a finite product of (commutative) domains $A_i$, any finitely generated module $M$ over $A=\prod_{i = 1}^{n} A_{i}$ naturally decomposes as $\bigoplus_{i=1}^{n} M_i$, where each $M_i$ is an $A_i$ module, and the action on each $M_i$ is induced by the projection $A\rightarrow A_i$.
The thought is to decompose $M$ as a sum of $1_j M$ submodules, where $1_j$ is the primitive idempotent corresponding to the identity in each $A_i$ factor of $A$. Since we have: $$m=\sum_{i=1}^n 1_i m$$ These submodules sum to $M$, and by applying $1_j$ to both sides of this equation, using that $1_i 1_j=0$ if $i\neq j$, we get that the sum is direct as $A$ modules. It seems like neither the domain condition on the $A_i$, nor the finite generation of $M$ was needed for this, which makes me think there is an error somewhere.
Is this proof valid?