CLIENT,KERNEL: add timezone to display datetime

bzr revid: ced-56c288f5372ac542a407ad619940bcf4adfcac4d
This commit is contained in:
ced 2007-04-30 10:16:11 +00:00
parent b18bc7bf21
commit 0d096bfd56
4 changed files with 26 additions and 2 deletions

View File

@ -33,7 +33,17 @@
<field name="models" eval="['res.users']"/>
<field name="name">lang</field>
<field name="value" eval="False"/>
<field name="meta" eval="{'type':'selection', 'string':'Language', 'selection':[(False,'en')]}"/>
<field name="meta" eval="{'type':'selection', 'string':'Language', 'selection':[('en_EN', 'English')]}"/>
<field name="replace" eval="True"/>
</ir_set>
<ir_set>
<field name="key" eval="'meta'"/>
<field name="key2" eval="'tz'"/>
<field name="models" eval="['res.users']"/>
<field name="name">tz</field>
<field name="value" eval="False"/>
<field name="meta" eval="{'type':'selection', 'string':'Timezone', 'selection': [(x, x) for x in pytz.all_timezones] }"/>
<field name="replace" eval="True"/>
</ir_set>

View File

@ -44,7 +44,7 @@ class view(osv.osv):
'name': fields.char('View Name',size=64, required=True),
'model': fields.char('Model', size=64, required=True),
'priority': fields.integer('Priority', required=True),
'type': fields.selection((('tree','Tree'),('form','Form')), 'View Type', required=True),
'type': fields.selection((('tree','Tree'),('form','Form'),('graph', 'Graph')), 'View Type', required=True),
'arch': fields.text('View Architecture', required=True),
'inherit_id': fields.many2one('ir.ui.view', 'Inherited View'),
'field_parent': fields.char('Childs Field',size=64)

View File

@ -263,6 +263,7 @@ class common(netsvc.Service):
self.exportMethod(self.ir_del)
self.exportMethod(self.about)
self.exportMethod(self.login)
self.exportMethod(self.timezone_get)
def ir_set(self, db, uid, password, keys, args, name, value, replace=True, isobject=False):
security.check(db, uid, password)
@ -304,6 +305,9 @@ The whole source code is distributed under the terms of the
GNU Public Licence.
(c) 2003-TODAY, Fabien Pinckaers - Tiny sprl''')
def timezone_get(self, db, login, password):
return time.tzname[0]
common()
class objects_proxy(netsvc.Service):

View File

@ -54,6 +54,16 @@ def _eval_xml(self,node, pool, cr, uid, idref):
import time
idref['time'] = time
idref['ref'] = lambda x: self.id_get(cr, False, x)
try:
import pytz
except:
import netsvc
logger = netsvc.Logger()
logger.notifyChannel("init", netsvc.LOG_INFO, 'could not find pytz library')
class pytzclass(object):
all_timezones=[]
pytz=pytzclass()
idref['pytz'] = pytz
return eval(a_eval, idref)
if t == 'xml':
def _process(s, idref):