KERNEL,CLIENT: add right-click for translate label
bzr revid: ced-394d547d53fe085331431661ae7568dc792665e6
This commit is contained in:
parent
93cab3ffdd
commit
e2e065ce5b
|
@ -359,10 +359,12 @@ class TinySocketServerThread(threading.Thread):
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.running=False
|
self.running=False
|
||||||
for t in self.threads:
|
for t in self.threads:
|
||||||
print "thread"
|
|
||||||
t.stop()
|
t.stop()
|
||||||
self.socket.shutdown(socket.SHUT_RDWR)
|
try:
|
||||||
self.socket.close()
|
self.socket.shutdown(socket.SHUT_RDWR)
|
||||||
|
self.socket.close()
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
# vim:noexpandtab:
|
# vim:noexpandtab:
|
||||||
|
|
||||||
|
|
|
@ -1528,4 +1528,42 @@ class orm(object):
|
||||||
del data[self._inherits[v]]
|
del data[self._inherits[v]]
|
||||||
return self.create(cr, uid, data)
|
return self.create(cr, uid, data)
|
||||||
|
|
||||||
|
def read_string(self, cr, uid, id, langs, fields=None, context={}):
|
||||||
|
res = {}
|
||||||
|
res2 = {}
|
||||||
|
self.pool.get('ir.model.access').check(cr, uid, self._name, 'read')
|
||||||
|
if not fields:
|
||||||
|
fields = self._columns.keys() + self._inherit_fields.keys()
|
||||||
|
for lang in langs:
|
||||||
|
res[lang] = {'code': lang}
|
||||||
|
for f in fields:
|
||||||
|
if f in self._columns:
|
||||||
|
res_trans = self.pool.get('ir.translation')._get_source(cr, uid, self._name+','+f, 'field', lang)
|
||||||
|
if res_trans:
|
||||||
|
res[lang][f]=res_trans
|
||||||
|
else:
|
||||||
|
print "columns:", self._columns[f].string
|
||||||
|
res[lang][f]=self._columns[f].string
|
||||||
|
for table in self._inherits:
|
||||||
|
cols = intersect(self._inherit_fields.keys(), fields)
|
||||||
|
res2 = self.pool.get(table).read_string(cr, uid, id, langs, cols, context)
|
||||||
|
for lang in res2:
|
||||||
|
if lang in res:
|
||||||
|
res[lang]={'code': lang}
|
||||||
|
for f in res2[lang]:
|
||||||
|
res[lang][f]=res2[lang][f]
|
||||||
|
return res
|
||||||
|
|
||||||
|
def write_string(self, cr, uid, id, langs, vals, context={}):
|
||||||
|
self.pool.get('ir.model.access').check(cr, uid, self._name, 'write')
|
||||||
|
for lang in langs:
|
||||||
|
for field in vals:
|
||||||
|
if field in self._columns:
|
||||||
|
self.pool.get('ir.translation')._set_ids(cr, uid, self._name+','+field, 'field', lang, [0], vals[field])
|
||||||
|
for table in self._inherits:
|
||||||
|
cols = intersect(self._inherit_fields.keys(), vals)
|
||||||
|
if cols:
|
||||||
|
self.pool.get(table).write_string(cr, uid, id, langs, vals, context)
|
||||||
|
return True
|
||||||
|
|
||||||
# vim:noexpandtab:ts=4
|
# vim:noexpandtab:ts=4
|
||||||
|
|
|
@ -241,8 +241,10 @@ if tools.config['netrpc']:
|
||||||
|
|
||||||
def handler(signum, frame):
|
def handler(signum, frame):
|
||||||
from tools import config
|
from tools import config
|
||||||
tinySocket.stop()
|
if tools.config['netrpc']:
|
||||||
httpd.stop()
|
tinySocket.stop()
|
||||||
|
if tools.config['xmlrpc']:
|
||||||
|
httpd.stop()
|
||||||
netsvc.Agent.quit()
|
netsvc.Agent.quit()
|
||||||
if config['pidfile']:
|
if config['pidfile']:
|
||||||
os.unlink(config['pidfile'])
|
os.unlink(config['pidfile'])
|
||||||
|
|
Loading…
Reference in New Issue