Creating a relate button

I made a relate button which was able to relate from invoice back to party but notice the active_id is from the id created making it to pick up it the id under account how can I set the active_id to a collom I want

You can not set the active_id. The active_id is set by the tryton clients to the ids of the selected records.
You should adapt your domain to return the right cause depending on the model from which you call the relate.

Can you give me an example on how to do that

There are a lot of examples on the tryton source code. For example on the account_invoice module, there is a relate from a party to it’s invoices.

Can’t you just use the right click on the party field?