bzr revid: sbh@tinyerp.com-20100108070731-ac0thxljh3ozt1rd
This commit is contained in:
sbh (Open ERP)
2010-01-08 12:37:31 +05:30
7 changed files with 21 additions and 20 deletions
+6 -4
View File
@@ -44,7 +44,9 @@ def map_data(cr, uid, obj):
continue
mapping =obj.__attribute__[map_dict].get('mapping', False)
if mapping:
map_val = mapping[map_val]
map_val = mapping[map_val.lower()]
else:
map_val = map_val.lower()
if field_type == 'many2many':
ids = []
if not map_val:
@@ -374,12 +376,12 @@ class Alarm(CalDAV, osv.osv_memory):
related = days>=0 and 'after' or 'before'
self.ical_set('trigger_interval', interval, 'value')
self.ical_set('trigger_duration', duration, 'value')
self.ical_set('trigger_occurs', related, 'value')
self.ical_set('trigger_occurs', related.lower(), 'value')
if child.params:
if child.params.get('related'):
self.ical_set('trigger_related', child.params.get('related')[0].lower(), 'value')
else:
self.ical_set(child.name.lower(), child.value, 'value')
self.ical_set(child.name.lower(), child.value.lower(), 'value')
vals = map_data(cr, uid, self)
return vals
@@ -406,7 +408,7 @@ class Attendee(CalDAV, osv.osv_memory):
if para.lower() == 'cn':
self.ical_set(para.lower(), ical_data.params[para][0]+':'+ ical_data.value, 'value')
else:
self.ical_set(para.lower(), ical_data.params[para][0], 'value')
self.ical_set(para.lower(), ical_data.params[para][0].lower(), 'value')
if not ical_data.params.get('CN'):
self.ical_set('cn', ical_data.value, 'value')
vals = map_data(cr, uid, self)
+11 -12
View File
@@ -35,7 +35,7 @@ class crm_meeting(osv.osv):
_order = "id desc"
_inherits = {'crm.case': "inherit_case_id"}
__attribute__ = {
'class': {'field': 'class', 'type': 'text'},
'class': {'field': 'class', 'type': 'selection'},
'created': {'field': 'create_date', 'type': 'datetime'}, # keep none for now
'description': {'field': 'description', 'type': 'text'},
'dtstart': {'field': 'date', 'type': 'datetime'},
@@ -44,8 +44,8 @@ class crm_meeting(osv.osv):
'priority': {'field': 'priority', 'type': 'int'},
'dtstamp' : {'field': 'date', 'type': 'datetime'},
'seq': None,
'status': {'field': 'state', 'type': 'selection', 'mapping': {'TENTATIVE': 'draft', \
'CONFIRMED': 'open' , 'CANCELLED': 'cancel'}},
'status': {'field': 'state', 'type': 'selection', 'mapping': {'tentative': 'draft', \
'confirmed': 'open' , 'cancelled': 'cancel'}},
'summary': {'field': 'name', 'type': 'text'},
'transp': {'field': 'transparent', 'type': 'text'},
'uid': {'field': 'id', 'type': 'text'},
@@ -173,18 +173,15 @@ class crm_meeting(osv.osv):
def on_change_duration(self, cr, uid, id, date, duration):
if not date:
return {}
start_date = datetime.datetime.fromtimestamp(time.mktime(time.strptime(date, "%Y-%m-%d %H:%M:%S")))
start_date = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
if duration >= 0 :
end = start_date + datetime.timedelta(hours=duration)
if duration < 0:
raise osv.except_osv(_('Warning !'),
_('You can not set negative Duration.'))
res = {'value' : {'date_deadline' : end.strftime('%Y-%m-%d %H:%M:%S')}}
return res
def export_cal(self, cr, uid, ids, context={}):
crm_data = self.read(cr, uid, ids, [], context ={'read':True})
event_obj = self.pool.get('basic.calendar.event')
@@ -218,17 +215,19 @@ class crm_meeting(osv.osv):
vals = event_obj.import_ical(cr, uid, file_content)
for val in vals:
is_exists = common.uid2openobjectid(cr, val['id'], self._name)
val.pop('id')
if val.has_key('create_date'): val.pop('create_date')
val['caldav_url'] = context.get('url') or ''
caldav_alarm_id = val['caldav_alarm_id']
if caldav_alarm_id:
caldav_alarm = self.browse(cr, uid, caldav_alarm_id)
val['alarm_id'] = caldav_alarm.alarm_id
# caldav_alarm_id = val['caldav_alarm_id']
val.pop('id')
if is_exists:
if val['caldav_alarm_id']:
val['alarm_id'] = self.browse(cr, uid, is_exists).caldav_alarm_id.alarm_id.id
self.write(cr, uid, [is_exists], val)
else:
case_id = self.create(cr, uid, val)
if caldav_alarm_id:
alarm_id = self.browse(cr, uid, is_exists).caldav_alarm_id.alarm_id
self.write(cr, uid, case_id, {'alarm_id': alarm_id})
return {'count': len(vals)}
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100):
+1 -1
View File
@@ -22,5 +22,5 @@
import crm_project_bug
import crm_project_future
import crm_project_feature
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+3 -3
View File
@@ -34,11 +34,11 @@
'init_xml': [
'crm_bugs_data.xml'
],
'update_xml': [
'update_xml': [
'crm_bugs_view.xml',
'crm_bugs_menu.xml',
'crm_future_view.xml',
'crm_future_menu.xml',
'crm_feature_view.xml',
'crm_feature_menu.xml',
],
'demo_xml': ['crm_bugs_demo.xml'],
'installable': True,