CLIENT,KERNEL: add timezone to display datetime
authorced <>
Mon, 30 Apr 2007 10:16:11 +0000 (10:16 +0000)
committerced <>
Mon, 30 Apr 2007 10:16:11 +0000 (10:16 +0000)
bzr revid: ced-56c288f5372ac542a407ad619940bcf4adfcac4d

bin/addons/base/base_update.xml
bin/addons/base/ir/ir_ui_view.py
bin/service/web_services.py
bin/tools/convert.py

index fda4c2a..4bb2296 100644 (file)
                <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>
 
index bcef65b..cfbc0ab 100644 (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)
index 940ad3a..49f0282 100644 (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):
index 638c801..d2d89d7 100644 (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):