How to link to sao?

In sao it is possible to have a link that brings the user directly to a form or list of records. We’re using it to add links to e-mails or warnings. For example, we send an e-mail to several collegues when somebody modifies a task.

Is there a standard variable or configuration parameter in trytond that we can use to build the complete URL?

For example, say we want to link to:

http://demo5.2.tryton.org/#demo5.2/model/party.party/2

How can we know the “http://demo5.2.tryton.org” part of the URL?

Currently we’re using a configuration parameter, but each module we develop that needs that information would have its own configuration parameter and it would be nice to have this unified.

How are you doing it?

There is the __url__ from the URLMixin but it gives only for tryton:// protocol. I think it would be good to allow it to returns also for http(s)://. Maybe it should be a configuration flag.
But it is difficult to know if we should use ssl or not, maybe we should consider by default always ssl like we do on some module.
Also it may be useful to use as fallback the hostname from the request if available instead of the socket fqdn.