← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/atp-dev-addons1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons1

 

atp(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/atp-dev-addons1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons1.

Requested reviews:
  Harry (Open ERP) (hmo-tinyerp)
Related bugs:
  #669868 project_planning : Failed to search user, KeyError: 'parent_id'
  https://bugs.launchpad.net/bugs/669868
  #673899 caldav : Calendar Collections : Fields in 'groupby' must appear in the list of fields to read
  https://bugs.launchpad.net/bugs/673899
  #676858 [6.0RC1]  binary attachment of Partner1 can not be opened
  https://bugs.launchpad.net/bugs/676858


1) PUT 'Datetime In UTC' in Function field of Calendar Form for Caldav module to Export ics datetime In UTC.

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/atp-dev-addons1/+merge/42348
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/atp-dev-addons1.
=== modified file 'caldav/calendar.py'
--- caldav/calendar.py	2010-11-18 16:21:31 +0000
+++ caldav/calendar.py	2010-12-01 11:41:26 +0000
@@ -165,6 +165,8 @@
         res[attr] = {}
         res[attr]['field'] = field.field_id.name
         res[attr]['type'] = field.field_id.ttype
+        if field.fn == 'datetime_utc':
+            res[attr]['type'] = 'utc'
         if field.fn == 'hours':
             res[attr]['type'] = "timedelta"
         if res[attr]['type'] in ('one2many', 'many2many', 'many2one'):
@@ -228,6 +230,7 @@
                     id = modobj.create(cr, uid, map_val, context=context)
                 vals[field] = id
                 continue
+            
             if field_type == 'timedelta':
                 if map_val:
                     vals[field] = (map_val.seconds/float(86400) + map_val.days)
@@ -255,7 +258,6 @@
          @param name: Get Attribute Name
          @param type: Get Attribute Type
         """
-
         if self.__attribute__.get(name):
             val = self.__attribute__.get(name).get(type, None)
             valtype =  self.__attribute__.get(name).get('type', None)
@@ -338,6 +340,8 @@
                     date_local = cal_data.value.astimezone(_server_tzinfo)
                     self.ical_set(cal_data.name.lower(), date_local, 'value')
                     continue
+#                date_local = cal_data.value.astimezone(pytz.utc)
+                
                 self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
         vals = map_data(cr, uid, self, context=context)
         return vals
@@ -447,6 +451,21 @@
                                 dtfield.value = self.format_date_tz(parser.parse(data[map_field]), tzval.title())
                             else:
                                 dtfield.value = parser.parse(data[map_field])
+                                
+                        elif map_type == 'utc'and data[map_field]:
+                            if tzval:
+                                local = pytz.timezone (tzval.title())
+                                naive = datetime.strptime (data[map_field], "%Y-%m-%d %H:%M:%S")
+                                local_dt = naive.replace (tzinfo = local)
+                                utc_dt = local_dt.astimezone (pytz.utc)
+                                vevent.add(field).value = utc_dt
+                            else:
+                               utc_timezone = pytz.timezone ('UTC')
+                               naive = datetime.strptime (data[map_field], "%Y-%m-%d %H:%M:%S")
+                               local_dt = naive.replace (tzinfo = utc_timezone)
+                               utc_dt = local_dt.astimezone (pytz.utc)
+                               vevent.add(field).value = utc_dt
+
                         elif map_type == "timedelta":
                             vevent.add(field).value = timedelta(hours=data[map_field])
                         elif map_type == "many2one":
@@ -829,6 +848,7 @@
         'fn': fields.selection([('field', 'Use the field'),
                         ('const', 'Expression as constant'),
                         ('hours', 'Interval in hours'),
+                        ('datetime_utc', 'Datetime In UTC'),
                         ], 'Function'),
         'mapping': fields.text('Mapping'),
     }

=== modified file 'document/nodes.py'
--- document/nodes.py	2010-11-12 11:49:46 +0000
+++ document/nodes.py	2010-12-01 11:41:26 +0000
@@ -525,6 +525,9 @@
         # TODO: the write date should be MAX(file.write)..
         self.write_date = dirr and (dirr.write_date or dirr.create_date) or False
         self.content_length = 0
+
+        self.unixperms = 040750
+
         try:
             self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
         except Exception:
@@ -764,6 +767,7 @@
         # TODO: the write date should be MAX(file.write)..
         self.write_date = dirr.write_date or dirr.create_date
         self.content_length = 0
+        self.unixperms = 040750
         try:
             self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
         except Exception:
@@ -1526,4 +1530,4 @@
             cr.close()
         StringIO.close(self)
 
-#eof
\ No newline at end of file
+#eof

=== modified file 'document_ftp/wizard/ftp_configuration.py'
--- document_ftp/wizard/ftp_configuration.py	2010-10-12 06:26:08 +0000
+++ document_ftp/wizard/ftp_configuration.py	2010-12-01 11:41:26 +0000
@@ -44,6 +44,7 @@
         # Update the action for FTP browse.
         aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
         aid = data_pool.browse(cr, uid, aid, context=context).res_id
-        self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/'})
+        self.pool.get('ir.actions.url').write(cr, uid, [aid], 
+                {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/' + cr.dbname+'/'})
 
 document_ftp_configuration()

=== modified file 'document_webdav/webdav_server.py'
--- document_webdav/webdav_server.py	2010-11-12 11:49:46 +0000
+++ document_webdav/webdav_server.py	2010-12-01 11:41:26 +0000
@@ -84,14 +84,13 @@
     def setup(self):
         self.davpath = '/'+config.get_misc('webdav','vdir','webdav')
         addr, port = self.server.server_name, self.server.server_port
-        server_proto = getattr(self.server,'proto', 'http').lower()
         try:
-            if hasattr(self.request, 'getsockname'):
-                addr, port = self.request.getsockname()
+            addr, port = self.request.getsockname()
         except Exception, e:
-            self.log_error("Cannot calculate own address: %s" , e)
-        # Too early here to use self.headers
-        self.baseuri = "%s://%s:%d/"% (server_proto, addr, port)
+
+            self.log_error("Cannot calculate own address:" , e)
+        self.baseuri = "http://%s:%d/"% (addr, port)
+
         self.IFACE_CLASS  = openerp_dav_handler(self, self.verbose)
 
     def copymove(self, CLASS):


Follow ups