Let $R$ be a ring, $M$ be a finitely generated $R$-module. Let us define $e(M)$ to be the minimal of number of generators of $M$. Clearly, for finitely generated $R$-modules $M,N$ we have
$\mathrm{max}(e(M),e(N)) \leq e(M \oplus N) \leq e(M) + e(N).$
Question A. Are there better bounds, or is every value in between possible for $e(M \oplus N)$?
For example there are rings $R \neq 0$ such that $R \oplus R \cong R$ as $R$-modules, so that $e(R \oplus R)=1$. But for a commutative ring $R \neq 0$, we have $e(R \oplus R)=2$. The following question is more interesting for me:
Question B. Let $R$ be commutative ring, having only trivial idempotents (see the comment by navigetor23). Does it follow that $e(M \oplus N) = e(M) + e(N)$?
If this turns out to be false, which additional conditions should be imposed on $R$? For example, it should suffice that $R$ is a PID, right? But this is quite strong.