Any legal stuff to watch out for here?
IANAL, and, even if I were, I don't know what country you're in. That said, I would suspect that there are legal things to concern yourself with. For starters, if you sell your code to the client, you no longer have ownership of it to continue using it in your other product (without licensing it back from the client). I'm talking about an ethical ownership here - which may or may not line up with legal ownership in your jurisdiction.
Your best (legal/ethical) bet is to offer that module as "licensed" (whether it's open source or not is up to you) so that you retain ownership while your client gains the ability to do whatever they want with it (as agreed to by both parties ahead of time).
If the client is not amenable to such licensing, then instead charge the correct rates for you to redevelop your module from the ground up again, with consummerate increases in schedule as well. Most people will be ok with licensing as it reduces their cost as well as reducing the schedule, but you need to know what your fallback position is if the client is obstinate.