openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #01509
[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:
xrg (xrg)
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
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/atp-dev-addons1/+merge/44557
1) PUT 'Datetime In UTC' in Function field of Calendar Form for Caldav module to Export ics datetime In UTC.
2) Add "write_date" for DTSTAMP in calendar based on standard RFC 5545, par 3.8.7.2.
3) Add Menutips in calendar View.
4)Fixed Problem of "After install document module, documents are lost which are added
before installed document module"
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/atp-dev-addons1/+merge/44557
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/atp-dev-addons1.
=== modified file 'caldav/caldav_view.xml'
--- caldav/caldav_view.xml 2010-11-18 05:21:19 +0000
+++ caldav/caldav_view.xml 2010-12-23 09:57:05 +0000
@@ -168,6 +168,7 @@
<field name="res_model">basic.calendar</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
+ <field name="help">"Calendars" allow you to Customize calendar event and todo attribute with any of OpenERP model.Caledars provide iCal Import/Export functionality.Webdav server that provides remote access to calendar.Help You to synchronize Meeting with Calendars client.You can access Calendars using CalDAV clients, like sunbird, Calendar Evaluation, Mobile.</field>
</record>
<record id="action_caldav_view1" model="ir.actions.act_window.view">
=== modified file 'caldav/calendar.py'
--- caldav/calendar.py 2010-12-20 14:02:20 +0000
+++ caldav/calendar.py 2010-12-23 09:57:05 +0000
@@ -148,6 +148,7 @@
@param calname: Get Calendar name
@param context: A standard dictionary for contextual values """
+
if context is None:
context = {}
pool = pooler.get_pool(cr.dbname)
@@ -164,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'):
@@ -227,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)
@@ -254,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)
@@ -273,7 +276,6 @@
@param self: The object pointer,
@param type: Get Attribute Type
"""
-
for name in self.__attribute__:
if self.__attribute__[name]:
self.__attribute__[name][type] = None
@@ -446,6 +448,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 +846,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'),
}
@@ -886,7 +904,6 @@
@param vals: Get Values
@param context: A standard dictionary for contextual values
"""
-
if not vals:
return
for id in ids:
@@ -1279,4 +1296,5 @@
Attendee()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'caldav/wizard/__init__.py'
--- caldav/wizard/__init__.py 2010-04-29 08:01:54 +0000
+++ caldav/wizard/__init__.py 2010-12-23 09:57:05 +0000
@@ -22,5 +22,4 @@
import calendar_event_export
import calendar_event_import
import calendar_event_subscribe
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'caldav/wizard/calendar_event_import.py'
--- caldav/wizard/calendar_event_import.py 2010-12-20 14:02:20 +0000
+++ caldav/wizard/calendar_event_import.py 2010-12-23 09:57:05 +0000
@@ -86,7 +86,11 @@
return _('Import Sucessful')
_defaults = {
+<<<<<<< TREE
'msg': _get_msg,
+=======
+ 'msg': lambda cr, uid, ids, context: _('Import Sucessful')
+>>>>>>> MERGE-SOURCE
}
calendar_event_import()
=== modified file 'crm_caldav/crm_caldav.py'
--- crm_caldav/crm_caldav.py 2010-11-23 07:05:05 +0000
+++ crm_caldav/crm_caldav.py 2010-12-23 09:57:05 +0000
@@ -44,6 +44,7 @@
ical = event_obj.export_cal(cr, uid, event_data, context=context)
return ical.serialize()
+
def import_cal(self, cr, uid, data, data_id=None, context=None):
"""
@param self: The object pointer
@@ -88,6 +89,7 @@
val.update({'recurrent_uid': exists})
model_obj.write(cr, uid, [r_id], val)
ids.append(r_id)
+
elif exists:
model_obj.write(cr, uid, [exists], val)
ids.append(exists)
=== modified file 'crm_caldav/crm_caldav_data.xml'
--- crm_caldav/crm_caldav_data.xml 2010-11-24 04:53:34 +0000
+++ crm_caldav/crm_caldav_data.xml 2010-12-23 09:57:05 +0000
@@ -117,8 +117,8 @@
<record model="basic.calendar.fields" id="map_event_13">
<field name="name" ref="caldav.field_event_dtstamp"/>
<field name="type_id" ref="base_calendar.calendar_lines_event" />
- <field name="field_id" search="[('name','=','date'),('model_id.model','=','calendar.event')]" />
- <field name="fn">field</field>
+ <field name="field_id" search="[('name','=','write_date'),('model_id.model','=','crm.meeting')]" />
+ <field name="fn">datetime_utc</field>
</record>
<record model="basic.calendar.fields" id="map_event_14">
=== modified file 'crm_caldav/crm_caldav_setup.xml'
--- crm_caldav/crm_caldav_setup.xml 2010-11-22 11:42:07 +0000
+++ crm_caldav/crm_caldav_setup.xml 2010-12-23 09:57:05 +0000
@@ -176,8 +176,8 @@
<record id="basic_calendar_fields_24" model="basic.calendar.fields">
<field name="name" ref="caldav.field_event_dtstamp"/>
<field name="type_id" ref="basic_calendar_lines_vevent0"/>
- <field name="field_id" ref="base_calendar.field_calendar_event_date"/>
- <field name="fn">field</field>
+ <field name="field_id" ref="crm.field_crm_meeting_write_date"/>
+ <field name="fn">datetime_utc</field>
</record>
<record id="basic_calendar_fields_25" model="basic.calendar.fields">
<field name="name" ref="caldav.field_event_description"/>
=== modified file 'document/document.py'
--- document/document.py 2010-12-06 13:11:02 +0000
+++ document/document.py 2010-12-23 09:57:05 +0000
@@ -35,6 +35,17 @@
class document_file(osv.osv):
_inherit = 'ir.attachment'
_rec_name = 'datas_fname'
+
+ def attach_parent_id(self, cr, uid, ids=[], context=None):
+ """Attach Parent id For document"""
+
+ parent_id = self.pool.get('document.directory')._get_root_directory(cr,uid)
+ ids = self.search(cr, uid, [('parent_id', '=', False)])
+ attach_doc = self.browse(cr, uid, ids, context=context)
+ for attach in attach_doc:
+ cr.execute("UPDATE ir_attachment SET parent_id = %s,db_datas = decode(encode(%s,'escape'), 'base64') WHERE id = %s", (parent_id, attach.db_datas, attach.id))
+ return True
+
def _get_filestore(self, cr):
return os.path.join(DMS_ROOT_PATH, cr.dbname)
@@ -42,7 +53,8 @@
if context is None:
context = {}
fbrl = self.browse(cr, uid, ids, context=context)
- nctx = nodes.get_node_context(cr, uid, context={})
+
+ nctx = nodes.get_node_context(cr, uid, context=context)
# nctx will /not/ inherit the caller's context. Most of
# it would be useless, anyway (like active_id, active_model,
# bin_size etc.)
@@ -55,9 +67,7 @@
result[fbro.id] = base64.encodestring(data or '')
else:
result[fbro.id] = fnode.get_data_len(cr, fbro)
-
return result
-
#
# This code can be improved
#
@@ -168,10 +178,11 @@
ids2 = []
for fbro in self.browse(cr, uid, ids, context=context):
if ('parent_id' not in vals or fbro.parent_id.id == vals['parent_id']) \
- and ('name' not in vals or fbro.name == vals['name']) :
+ and ('name' not in vals or fbro.name == vals['name']) or not fbro.parent_id:
ids2.append(fbro.id)
continue
fnode = nctx.get_file_node(cr, fbro)
+ print "fnode",fnode
res = fnode.move_to(cr, dnode or fnode.parent, vals.get('name', fbro.name), fbro, dbro, True)
if isinstance(res, dict):
vals2 = vals.copy()
=== modified file 'document/document_data.xml'
--- document/document_data.xml 2010-10-27 10:24:28 +0000
+++ document/document_data.xml 2010-12-23 09:57:05 +0000
@@ -97,8 +97,10 @@
<field name="user_id" eval="False"/>
<field name="parent_id" ref="dir_root"/>
<field name="ressource_id">0</field>
-
</record>
-
+
+ <function model="ir.attachment" name="attach_parent_id"/>
+
+
</data>
</openerp>
=== modified file 'document/nodes.py'
--- document/nodes.py 2010-12-09 10:01:21 +0000
+++ document/nodes.py 2010-12-23 09:57:05 +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:
@@ -1556,4 +1560,4 @@
cr.close()
StringIO.close(self)
-#eof
\ No newline at end of file
+#eof
=== modified file 'document/std_index.py'
--- document/std_index.py 2010-11-12 10:14:16 +0000
+++ document/std_index.py 2010-12-23 09:57:05 +0000
@@ -96,12 +96,7 @@
def _doIndexFile(self,fname):
fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout
- try:
- file_data = _to_unicode(fp.read())
- finally:
- fp.close()
-
- return file_data
+ return _to_unicode(fp.read())
cntIndex.register(DocIndex())
@@ -163,12 +158,7 @@
def _doIndexFile(self,fname):
fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout
- try:
- file_data = _to_unicode( fp.read())
- finally:
- fp.close()
-
- return file_data
+ return _to_unicode( fp.read())
cntIndex.register(PdfIndex())
=== modified file 'document_ftp/wizard/ftp_configuration.py'
--- document_ftp/wizard/ftp_configuration.py 2010-12-06 13:11:02 +0000
+++ document_ftp/wizard/ftp_configuration.py 2010-12-23 09:57:05 +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-12-09 09:59:50 +0000
+++ document_webdav/webdav_server.py 2010-12-23 09:57:05 +0000
@@ -92,14 +92,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