[FIX] base_calendar: use 'onchange_dates' instead of 'onchange_allday' since it also returns duration

bzr revid: olt@tinyerp.com-20101028120920-qb6mg4oxyn8df9x7
This commit is contained in:
olt@tinyerp.com 2010-10-28 14:09:20 +02:00
parent ab9e19e595
commit 6de4c3eb3a
3 changed files with 11 additions and 3 deletions

View File

@ -916,7 +916,7 @@ class calendar_event(osv.osv):
return [(x.lower(), x) for x in pytz.all_timezones]
def onchange_allday(self, cr, uid, ids, allday, context=None):
"""Sets duration as 24 Hours if event is selcted for all day
"""Sets duration as 24 Hours if event is selected for all day
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -1630,6 +1630,14 @@ true, it will allow you to hide the event alarm information without removing it.
if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'):
vals['vtimezone'] = vals['vtimezone'][40:]
updated_vals = self.onchange_dates(cr, uid, [],
vals.get('date', False),
vals.get('duration', False),
vals.get('date_deadline', False),
vals.get('allday', False),
context=context)
vals.update(updated_vals.get('value', {}))
res = super(calendar_event, self).create(cr, uid, vals, context)
alarm_obj = self.pool.get('res.alarm')
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date', context=context)

View File

@ -229,7 +229,7 @@
<group col="6" colspan="4">
<field name="name" select="1" string="Summary"
colspan="4" required="1" />
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
<field name="allday" colspan="2" on_change="onchange_dates(date,False,False,allday)" />
<newline/>
<field name="date" string="Start Date" required="1" select="1"
on_change="onchange_dates(date,duration,False,allday)" />

View File

@ -32,7 +32,7 @@
<field name="categ_id" widget="selection"
string="Meeting Type" groups="base.group_extended"
domain="[('object_id.model', '=', 'crm.meeting')]" />
<field name="allday" on_change="onchange_allday(allday)" />
<field name="allday" on_change="onchange_dates(date,False,False,allday)" />
<newline/>
<field name="date" string="Start Date" required="1"
on_change="onchange_dates(date,duration,False,allday)" />