TL;DR: "A client contracts us to build the engine for Warcraft I, does client have right to stop us using the same engine for let's say.... Skyrim?" (No contracts have been signed YET)
Our client is in the retail industry. They came to us and we made a beta program for them (free) to show that we can save them $.
We are now in the contract negotiation phase. We understand that the clients only wants to ensure that they will be able to continue their business if our business defaults, and they want our source code. Ok. Sure. Our coders won't be happy, maybe we can make sure to not give away the source code until the contract is OVER. And have a default/bankruptcy safe guard.
However, they also want us to promise that we won't sell the program to any of their competitors. Sure, but what if we wanted to repackage the code and sell to say... a medical company?
First, I plan to define competitors. Then, I plan to define exactly what the program scope is.
So the question is this, legally (in Ontario, Canada), how can we draft a contract that will make both parties happy? Do they really have any grounds to sue us if we take our program, make an essentially new program based on the platform of the old one, and sell to who ever?
I have this question quite a lot, the answer I usually come to is to have an escrow ... this means we place the source code with a third party (lawyer) every release or every 3 months.
If any of the "sunset" conditions are reached (like my company goes out of business, or the relationship breaks down) then the client gets the source code from the lawyer so that they can continue on "as they were" ... (they can't suddenly go into software development after bankrupting us in order to get it).
If they are your "only sales agent" then I would put in there a clause along the lines "we will grant you sole resale rights, in the Canadian/US markets, in X/Y/Z verticals (they name them) on the condition you make $X in sales per quarter and promote the product appropriately" this is your escape clause that if they don't fullfil their side of the bargin then your not stuck with a great technology that you can't do anything with.
If they actually want full ownership that is a different story and you raise the price accordingly. They usually rethink their opening position at this point and aim for something more realistic, sometimes they still want to own it all and pay for the privilege ... which can also work very well for you.
NOTE: the above is a guideline, the specifics are many more pages of legalese written by a lawyer. Use the answers here as the starting point to work out what you actually want to acheive with the client.
I typically take the approach of sitting in a room with the clients first, drafting your "in principal" document using a standard agreement of the web as your guideline for the discussion points ... then take it to a lawyer to finish off.
I have a good relationship with my Lawyer so I usually let him know I'm going in and make sure he is on standby if I have specific questions throughout the process. I also make sure there are 2-3 meetings with the client to cover it all off, knowing we can go back to qualify with our respective sides throughout so people are a little more relaxed and calm about it.
Good luck and find a good IP lawyer before you start.