<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">
@param calname: Get Calendar name
@param context: A standard dictionary for contextual values """
+
if context is None:
context = {}
pool = pooler.get_pool(cr.dbname)
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'):
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)
@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)
@param self: The object pointer,
@param type: Get Attribute Type
"""
-
for name in self.__attribute__:
if self.__attribute__[name]:
self.__attribute__[name][type] = None
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":
'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'),
}
@param vals: Get Values
@param context: A standard dictionary for contextual values
"""
-
if not vals:
return
for id in ids:
Attendee()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import calendar_event_export
import calendar_event_import
import calendar_event_subscribe
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
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
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)
<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">
<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"/>
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'create_date': fields.datetime('Create Date', readonly=True),
+ 'email': fields.integer('# Emails', size=128, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True, domain="[('type','=','claim')]"),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.claim')]", readonly=True),
+ 'probability': fields.float('Probability',digits=(16,2),readonly=True, group_operator="avg"),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
count(*) as nbr,
c.priority as priority,
c.type_action as type_action,
+ (SELECT count(id) FROM mailgate_message WHERE model='crm.claim' AND res_id=id AND history=True) AS email,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected
<field name="partner_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="nbr" string="#Claim" sum="#Claim"/>
+ <field name="email" sum="# Mails"/>
<field name="delay_close" avg="Avg Closing Delay"/>
<field name="delay_expected"/>
<field name="state" invisible="1"/>
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)
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.)
result[fbro.id] = base64.encodestring(data or '')
else:
result[fbro.id] = fnode.get_data_len(cr, fbro)
-
return result
-
#
# This code can be improved
#
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)
<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>
# 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:
# 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:
cr.close()
StringIO.close(self)
-#eof
\ No newline at end of file
+#eof
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())
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())
# 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()
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):