[IMP]: crm, caldav: Implemented function for custom alarm creation

bzr revid: rpa@openerp.co.in-20100106103327-g9ftp88zj6e2a0v3
This commit is contained in:
rpa (Open ERP) 2010-01-06 16:03:27 +05:30
parent 21f28c53d0
commit 4064bd5a60
4 changed files with 37 additions and 10 deletions

View File

@ -50,8 +50,6 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reminder details">
<field name="duration"/>
<field name="repeat"/>
<separator string="Reminder details" colspan="4" />
<group col="4" colspan="4">
<field name="trigger_duration" nolabel="1" select="1"/>
@ -60,6 +58,9 @@
<field name="trigger_related" nolabel="1" select="1"/>
</group>
<separator string="" colspan="4" />
<field name="duration"/>
<field name="repeat"/>
<separator string="" colspan="4" />
<group colspan="4">
<label string="" colspan="2"/>
<button icon='gtk-cancel' special="cancel" string="Cancel"/>

View File

@ -115,9 +115,7 @@ class crm_caldav_attendee(osv.osv):
'language': fields.char('LANGUAGE', size=124, help="To specify the language for text values in a property or property parameter."),
'user_id': fields.many2one('res.users', 'Responsible'),
}
_defaults = {
}
crm_caldav_attendee()
class crm_caldav_alarm(osv.osv):
@ -170,8 +168,23 @@ are both optional, but if one occurs, so MUST the other"""),
'trigger_duration': lambda *x: 5,
'trigger_occurs': lambda *x: 'BEFORE',
'trigger_related': lambda *x: 'start',
'active': lambda *x: 1,
}
def do_create(self, cr, uid, ids, context=None, *args):
datas = self.read(cr, uid, ids)[0]
summary = str(datas['trigger_duration']) + ' ' + \
datas['trigger_interval'].title() + ' ' + \
datas['trigger_occurs'].title()
self.write(cr, uid, ids, {'name': summary})
if not context or not context.get('model'):
return {}
else:
model = context.get('model')
obj = self.pool.get(model)
obj.write(cr, uid, context['active_id'], {'alarm_id': ids[0]})
return {}
crm_caldav_alarm()
class ir_attachment(osv.osv):

View File

@ -359,7 +359,18 @@ class crm_meeting(osv.osv):
if isinstance(ids, (str, int, long)) and isinstance(res, list):
return res and res[0] or False
return res
def onchange_rrule_type(self, cr, uid, ids, type, *args, **argv):
if type == 'none':
return {'value': {'rrule': ''}}
if type == 'custom':
return {}
rrule = self.pool.get('caldav.set.rrule')
rrulestr = rrule.compute_rule_string(cr, uid, {'freq': type.upper(),\
'interval': 1})
return {'value': {'rrule': rrulestr}}
def onchange_case_id(self, cr, uid, ids, *args, **argv):
return self._map_ids('onchange_case_id', cr, uid, ids, *args, **argv)
def onchange_partner_id(self, cr, uid, ids, *args, **argv):
@ -523,7 +534,7 @@ class invite_attendee_wizard(osv.osv_memory):
'users': fields.many2many('res.users', 'invite_user_rel', \
'invite_id', 'user_id', 'Users'),
'availability': fields.selection([('free', 'Free'), \
('busy', 'Busy'), ('both', 'Both')], 'User Avaliability')
('busy', 'Busy'), ('both', 'Both')], 'User Avaliability')
}
_defaults = {

View File

@ -114,8 +114,10 @@
/>
</group>
<group colspan="2" col="3">
<field name="rrule_type" string="Recurrency" colspan="1"/>
<button string="Custom"
<field name="rrule_type" string="Recurrency"
on_change="onchange_rrule_type(rrule_type)"
colspan="1" />
<button string="Custom"
name="%(caldav.action_view_caldav_set_rrule_wizard)d"
icon="gtk-save-as" type="action" context="{'model' : 'crm.meeting'}"
attrs="{'readonly':[('rrule_type','!=','custom')]}"