One can show that there are no (nonzero) goup homomorphisms $f:\mathbb R\to \mathbb Z$. Now let $K$ be a number field such that $O_K$ is its ring of integers. Consider the field $K_v$ which is completion of $K$ with respect to any valuation.
Can we find a nonzero group homomorphism $f:K_v\to O_K$?
The idea behind the argument in the link you gave for the real case still works: in a field $F$ of characteristic $0$ each element is "infinitely divisible" (more precisely, for each positive integer $n$ every element of the field has the form $nx$ for some $x$ in the field), but the only infinitely divisible element of $\mathcal O_K$ is $0$. So that tells you the possible values of a group homomorphism $F \to \mathcal O_K$.
It's worth thinking about these things in special cases first: once I read the top answer in your link about the case of $\mathbf R \to \mathbf Z$, I saw how it works for $\mathbf Q_p \to \mathbf Z$ and then a mechanism for the general case was clear (along with not needing the domain to be a completion). Then I noticed another answer there already pointed out that all you need about $\mathbf R$ is that it's a divisible group.