Computing the theta series of an arbitrary lattice, and more specifically a related quantity known as the flatness factor, has been recently shown to be important for lattice code design in various wireless communication setups. However, the theta series is in general not known in closed form, excluding a small set of very special lattices. In this article, motivated by the practical applications as well as the mathematical problem itself, a simple approximation of the theta series of a lattice is derived. A rigorous analysis of its accuracy is provided. In relation to this, maximum-likelihood decoding in the context of compute-and-forward relaying is studied. Following previous work, it is shown that the related metric can exhibit a flat behavior, which can be characterized by the flatness factor of the decoding function. Contrary to common belief, we note that the decoding metric can be rewritten as a sum over a random lattice only when at most two sources are considered. Using a particular matrix decomposition, a link between the random lattice and the code lattice employed at the transmitter is established, which leads to an explicit criterion for code design, in contrast to implicit criteria derived previously. Finally, candidate lattices are examined with respect to the proposed criterion using the derived theta series approximation.