[IMP]: base_calendar: Remaining changes for all day event, Added views and menus for Event and invitation
bzr revid: rpa@tinyerp.com-20100419134720-xcjg2lrl0nt86r9u
This commit is contained in:
parent
782a9701dc
commit
317b4eeab7
|
@ -795,7 +795,26 @@ class calendar_event(osv.osv):
|
|||
def _tz_get(self, cr, uid, context={}):
|
||||
return [(x.lower(), x) for x in pytz.all_timezones]
|
||||
|
||||
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, context={}):
|
||||
def onchange_allday(self, cr, uid, ids, allday, context={}):
|
||||
"""
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar event’s IDs.
|
||||
@param allday: Value of allday boolean
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
if not allday or not ids:
|
||||
return {}
|
||||
event = self.browse(cr, uid, ids, context=context)[0]
|
||||
value = {
|
||||
'date': event.date and event.date[:11] + '00:00:00',
|
||||
'date_deadline': event.date_deadline and event.date_deadline[:11] + '00:00:00',
|
||||
'duration': 24
|
||||
}
|
||||
return {'value': value}
|
||||
|
||||
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context={}):
|
||||
"""
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
@ -805,14 +824,23 @@ class calendar_event(osv.osv):
|
|||
@param duration: Get Duration between start date and end date or False
|
||||
@param end_date: Get Ending Date or False
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
"""
|
||||
if not start_date:
|
||||
return {}
|
||||
value = {}
|
||||
if not start_date:
|
||||
return value
|
||||
if not end_date and not duration:
|
||||
duration = 8.00
|
||||
value['duration'] = 8.00
|
||||
value['duration'] = duration
|
||||
|
||||
if allday: # For all day event
|
||||
start = start_date[:11] + '00:00:00'
|
||||
value = {
|
||||
'date': start,
|
||||
'date_deadline': start,
|
||||
'duration': 24
|
||||
}
|
||||
return {'value': value}
|
||||
|
||||
start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
|
||||
if end_date and not duration:
|
||||
end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
|
||||
|
@ -822,6 +850,7 @@ class calendar_event(osv.osv):
|
|||
elif not end_date:
|
||||
end = start + timedelta(hours=duration)
|
||||
value['date_deadline'] = end.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
return {'value': value}
|
||||
|
||||
def _set_rrulestring(self, cr, uid, id, name, value, arg, context):
|
||||
|
@ -998,8 +1027,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
('3', 'Third'), ('4', 'Fourth'), \
|
||||
('5', 'Fifth'), ('-1', 'Last')], 'By day'),
|
||||
'month_list': fields.selection(months.items(), 'Month'),
|
||||
'end_date': fields.date('Repeat Until')
|
||||
'end_date': fields.date('Repeat Until'),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel',\
|
||||
'event_id', 'attendee_id', 'Attendees'),
|
||||
'allday': fields.boolean('All Day')
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'class': lambda *a: 'public',
|
||||
'show_as': lambda *a: 'busy',
|
||||
|
@ -1007,6 +1040,46 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
'select1': lambda *x: 'date',
|
||||
'interval': lambda *x: 1,
|
||||
}
|
||||
|
||||
def open_event(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Open Event From for Editing
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of event’s IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: Dictionary value which open Crm Meeting form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
value = {}
|
||||
|
||||
id2 = data_obj._get_id(cr, uid, 'base_calendar', 'event_form_view')
|
||||
id3 = data_obj._get_id(cr, uid, 'base_calendar', 'event_tree_view')
|
||||
id4 = data_obj._get_id(cr, uid, 'base_calendar', 'event_calendar_view')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
if id4:
|
||||
id4 = data_obj.browse(cr, uid, id4, context=context).res_id
|
||||
for id in ids:
|
||||
value = {
|
||||
'name': _('Event'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'calendar.event',
|
||||
'view_id': False,
|
||||
'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': base_calendar_id2real_id(id),
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
return value
|
||||
|
||||
def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args):
|
||||
"""
|
||||
|
@ -1085,8 +1158,8 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
|
||||
count = 0
|
||||
for data in cr.dictfetchall():
|
||||
start_date = base_start_date and datetime.strptime(base_start_date, "%Y-%m-%d") or False
|
||||
until_date = base_until_date and datetime.strptime(base_until_date, "%Y-%m-%d") or False
|
||||
start_date = base_start_date and datetime.strptime(base_start_date[:10], "%Y-%m-%d") or False
|
||||
until_date = base_until_date and datetime.strptime(base_until_date[:10], "%Y-%m-%d") or False
|
||||
if count > limit:
|
||||
break
|
||||
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
|
||||
|
@ -1261,7 +1334,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
context.update({'alarm_id': vals.get('alarm_id')})
|
||||
alarm_obj.do_alarm_create(cr, uid, new_ids, self._name, 'date', \
|
||||
context=context)
|
||||
|
||||
return res
|
||||
|
||||
def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}):
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
|
||||
<data noupdate="1">
|
||||
|
||||
<record model="res.request.link" id="request_link_meeting">
|
||||
<field name="name">Event</field>
|
||||
<field name="object">calendar.event</field>
|
||||
</record>
|
||||
|
||||
<record model="res.alarm" id="alarm1">
|
||||
<field name="name">1 minute before</field>
|
||||
<field name="active" eval="1" />
|
||||
|
|
|
@ -100,8 +100,31 @@
|
|||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_view_attendee_form" model="ir.actions.act_window">
|
||||
<field name="name">Event Invitations</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">calendar.attendee</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="base_calendar.base_calendar_attendee_tree_view" />
|
||||
<field name="context">{'default_sent_by_uid': uid}</field>
|
||||
</record>
|
||||
|
||||
<!-- Calenadar's menu -->
|
||||
<menuitem id="base.menu_calendar_configuration" name="Calendar"
|
||||
parent="base.menu_base_config" sequence="10" />
|
||||
|
||||
<!-- Invitation menu -->
|
||||
<menuitem id="menu_attendee_invitations"
|
||||
name="Event Invitations" parent="base.menu_calendar_configuration"
|
||||
groups="base.group_extended" sequence="10"
|
||||
action="action_view_attendee_form" />
|
||||
|
||||
<!-- ALARM FORM VIEW-->
|
||||
|
||||
<record id="res_alarm_form_view" model="ir.ui.view">
|
||||
<record id="res_alarm_form_view" model="ir.ui.view">
|
||||
<field name="name">res.alarm.form</field>
|
||||
<field name="model">res.alarm</field>
|
||||
<field name="type">form</field>
|
||||
|
@ -121,36 +144,228 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="res_alarm_tree_view" model="ir.ui.view">
|
||||
<field name="name">res.alarm.tree</field>
|
||||
<field name="model">res.alarm</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Reminder details">
|
||||
<field name="name" select="1"/>
|
||||
<field name="trigger_interval" select="1"/>
|
||||
<field name="trigger_duration" select="1"/>
|
||||
<field name="trigger_occurs" select="1"/>
|
||||
<field name="trigger_related" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_res_alarm_view" model="ir.actions.act_window">
|
||||
<!-- ALARM TREE VIEW-->
|
||||
|
||||
<record id="res_alarm_tree_view" model="ir.ui.view">
|
||||
<field name="name">res.alarm.tree</field>
|
||||
<field name="model">res.alarm</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Reminder details">
|
||||
<field name="name" select="1"/>
|
||||
<field name="trigger_interval" select="1"/>
|
||||
<field name="trigger_duration" select="1"/>
|
||||
<field name="trigger_occurs" select="1"/>
|
||||
<field name="trigger_related" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_res_alarm_view" model="ir.actions.act_window">
|
||||
<field name="name">Available Alarms</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.alarm</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<!--Available alarms-->
|
||||
<menuitem id="base.menu_calendar_configuration" name="Calendar"
|
||||
parent="base.menu_base_config" sequence="10" />
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_crm_meeting_avail_alarm"
|
||||
groups="base.group_extended"
|
||||
action="base_calendar.action_res_alarm_view"
|
||||
parent="base.menu_calendar_configuration" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
<!-- Event Form View-->
|
||||
|
||||
<record model="ir.ui.view" id="event_form_view">
|
||||
<field name="name">Event Form</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Meetings">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1" string="Summary"
|
||||
colspan="4" />
|
||||
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
|
||||
<newline/>
|
||||
<field name="date" string="Start Date" required="1" select="1"
|
||||
on_change="onchange_dates(date,duration,False,allday)" />
|
||||
<field name="duration" widget="float_time"
|
||||
on_change="onchange_dates(date,duration,False,allday)" attrs="{'readonly': [('allday', '=', True)]}"/>
|
||||
<field name="date_deadline" string="End Date"
|
||||
required="1" select="1"
|
||||
on_change="onchange_dates(date,False,date_deadline)" />
|
||||
<field name="location" />
|
||||
<field name="alarm_id" string="Reminder"
|
||||
widget="selection" />
|
||||
<group colspan="2" col="4" >
|
||||
<field name="rrule_type" string="Recurrency"
|
||||
colspan="1" attrs="{'readonly':[('recurrent_uid','!=',False)]}"/>
|
||||
<button string="Edit All"
|
||||
help="Edit all Ourrences of recurrent Meeting"
|
||||
attrs="{'invisible':[('rrule_type','in', ('none', False))]}"
|
||||
name="open_event" icon="gtk-edit"
|
||||
type="object" />
|
||||
</group>
|
||||
</group>
|
||||
<group col="4" colspan="4" name="rrule" attrs="{'invisible': [('rrule_type','!=','custom')]}">
|
||||
<separator string="Select data for Custom Rule" colspan="8"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="freq" />
|
||||
<field name="interval" />
|
||||
<field name="count" />
|
||||
<field name="end_date" />
|
||||
</group>
|
||||
<group col="14" colspan="4" name="Select weekdays"
|
||||
attrs="{'invisible' : [('freq','!=','weekly')]}">
|
||||
<field name="mo" colspan="1" />
|
||||
<field name="tu" colspan="1" />
|
||||
<field name="we" colspan="1" />
|
||||
<field name="th" colspan="1" />
|
||||
<field name="fr" colspan="1" />
|
||||
<field name="sa" colspan="1" />
|
||||
<field name="su" colspan="1" />
|
||||
<newline />
|
||||
</group>
|
||||
<group col="10" colspan="4"
|
||||
attrs="{'invisible' : [('freq','!=','monthly'), ('freq','!=','yearly')]}">
|
||||
<group col="2" colspan="1">
|
||||
<field name="select1" />
|
||||
</group>
|
||||
<group col="2" colspan="1"
|
||||
attrs="{'invisible' : [('select1','=','day')]}">
|
||||
<field name="day"
|
||||
attrs="{'required' : [('select1','=','date')]}" />
|
||||
</group>
|
||||
<group col="3" colspan="1"
|
||||
attrs="{'invisible' : [('select1','=','date')]}">
|
||||
<field name="byday" string="The"
|
||||
attrs="{'required' : [('select1','=','day')]}" />
|
||||
<field name="week_list" nolabel="1"
|
||||
attrs="{'required' : [('select1','=','day')]}" />
|
||||
</group>
|
||||
<group col="1" colspan="1"
|
||||
attrs="{'invisible' : [('freq','!=','yearly')]}">
|
||||
<field name="month_list" string="of"
|
||||
colspan="1"
|
||||
attrs="{'required' : [('freq','=','yearly')]}" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Event">
|
||||
<group col="6" colspan="4">
|
||||
<separator colspan="6" string="Visibility"/>
|
||||
<field name="show_as" string="Show time as"/>
|
||||
<field name="class" string="Privacy"/>
|
||||
<field name="rrule" groups="base.group_extended" />
|
||||
<field name="recurrent_id" invisible="1" />
|
||||
<field name="recurrent_uid" invisible="1" />
|
||||
</group>
|
||||
<separator string="Description" colspan="4" />
|
||||
<field name="description" nolabel="1" colspan="4" />
|
||||
<separator colspan="4"/>
|
||||
</page>
|
||||
<page string="Invitation Detail">
|
||||
<button string="Invite People"
|
||||
name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
|
||||
icon="terp-partner" type="action"
|
||||
context="{'model' : 'calendar.event', 'attendee_field':'attendee_ids'}" colspan="2"/>
|
||||
<field name="attendee_ids" colspan="4"
|
||||
nolabel="1" widget="one2many" mode="tree,form">
|
||||
<tree string="Invitation details" editable="top">
|
||||
<field name="email" />
|
||||
<field name="role" select="1" />
|
||||
<field name="state" />
|
||||
</tree>
|
||||
<form string="Invitation details">
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
<field name="email" />
|
||||
<field name="rsvp" select="1" />
|
||||
<field name="cutype" select="1" />
|
||||
<field name="role" select="1" />
|
||||
<separator colspan="4" string="" />
|
||||
<group col="6" colspan="4">
|
||||
<field name="state" select="2" />
|
||||
<button name="do_tentative"
|
||||
states="needs-action,declined,accepted"
|
||||
string="Uncertain"
|
||||
type="object"
|
||||
icon="terp-crm" />
|
||||
<button name="do_accept"
|
||||
string="Accept"
|
||||
states="needs-action,tentative,declined"
|
||||
type="object"
|
||||
icon="gtk-apply" />
|
||||
<button name="do_decline"
|
||||
string="Decline"
|
||||
states="needs-action,tentative,accepted"
|
||||
type="object"
|
||||
icon="gtk-cancel" />
|
||||
<button
|
||||
name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
|
||||
string="Delegate"
|
||||
type="action"
|
||||
icon="gtk-sort-descending"
|
||||
states="needs-action,tentative,declined,accepted"
|
||||
context="{'model' : 'calendar.attendee', 'attendee_field' : 'child_ids'}" />
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Event Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="event_tree_view">
|
||||
<field name="name">Event Tree</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Events">
|
||||
<field name="id" widget="char" />
|
||||
<field name="name" string="Subject" />
|
||||
<field name="date" string="Meeting Date" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Event Calendar View -->
|
||||
|
||||
<record model="ir.ui.view" id="event_calendar_view">
|
||||
<field name="name">Events Calendar</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Events" date_start="date" color="show_as" date_delay="duration">
|
||||
<field name="name"/>
|
||||
<field name="class"/>
|
||||
<field name="show_as"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Event action -->
|
||||
|
||||
<record id="action_view_event" model="ir.actions.act_window">
|
||||
<field name="name">Events</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">calendar.event</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
</record>
|
||||
|
||||
<!-- Event menu -->
|
||||
<menuitem id="menu_events"
|
||||
name="Events" parent="base.menu_calendar_configuration"
|
||||
sequence="5" action="action_view_event" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue