[IMP] get_hostname tools function based on ir.config_parameter on the key network.hostname

bzr revid: tfr@openerp.com-20110712140703-gvfnjs1y3r51kagn
This commit is contained in:
tfr@openerp.com
2011-07-12 16:07:03 +02:00
parent 63ebd1cdb3
commit 4937b6bdd6
+9
View File
@@ -248,6 +248,15 @@ def flatten(list):
r.append(e)
return r
def get_hostname(obj, cr, uid):
parameter_pool = obj.pool.get('ir.config_parameter')
ids = parameter_pool.search(cr, uid, [('key', '=', 'network.hostname')])
if ids:
return parameter_pool.browse(cr, uid, ids)[0].value
else:
return 'localhost'
def reverse_enumerate(l):
"""Like enumerate but in the other sens