summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDBR (OpenERP) <dbr@tinyerp.com>2011-06-30 14:11:24 +0530
committerDBR (OpenERP) <dbr@tinyerp.com>2011-06-30 14:11:24 +0530
commitffe4df20d4f4097a52b49c5aa310dc707cd7cee8 (patch)
treedf80d6928620d091fb908e2f566791e069a76e7a
parentf9c9c79bbfdd3b65b0edd3416c1c12c0fcb994bb (diff)
[IMP]Improve code : save the host name value to avoid writing each time.
bzr revid: dbr@tinyerp.com-20110630084124-gd84vzblzarth5lg
-rw-r--r--addons/caldav/wizard/caldav_browse.py10
-rw-r--r--addons/caldav/wizard/caldav_browse_view.xml5
2 files changed, 13 insertions, 2 deletions
diff --git a/addons/caldav/wizard/caldav_browse.py b/addons/caldav/wizard/caldav_browse.py
index d1f58592de7..a345c9a95bf 100644
--- a/addons/caldav/wizard/caldav_browse.py
+++ b/addons/caldav/wizard/caldav_browse.py
@@ -237,12 +237,22 @@ class user_preference(osv.osv_memory):
collection_obj = self.pool.get('document.directory')
ids = collection_obj.search(cr, uid, [('name', '=', 'c')])
return ids[0]
+
+ def _get_default_host(self, cr, uid, context):
+ ids=self.search(cr,uid,[])
+ host_name = ''
+ if ids:
+ ids = len(ids)> 1 and len(ids)-1 or ids[0] # Use len(ids)-1 for taking the value of last id
+ host_obj = self.browse(cr, uid,[ids],context=context)[0]
+ host_name = host_obj.host_name
+ return host_name
_defaults={
'service': 'webdav',
'collection' : _get_default_collection,
'calendar' : _get_default_calendar,
'device' : 'other',
+ 'host_name':_get_default_host
}
diff --git a/addons/caldav/wizard/caldav_browse_view.xml b/addons/caldav/wizard/caldav_browse_view.xml
index 18a0a61baec..565e3a44407 100644
--- a/addons/caldav/wizard/caldav_browse_view.xml
+++ b/addons/caldav/wizard/caldav_browse_view.xml
@@ -28,11 +28,12 @@
<field name="model">user.preference</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Host name configuration for caldev synchronization">
- <separator string="Hostname example : " colspan="4"/>
+ <form string="Caldav's host name configuration">
+ <label string="Configure your openerp hostname. For example : " colspan="4"></label>
<newline/>
<label string="database.my.openerp.com or companyserver.com" colspan="4"/>
<newline/>
+ <separator colspan="4"/>
<field name="host_name" colspan="4" width="250" />
<separator colspan="4"/>
<group col="4" colspan="4">