[IMP]: base_calenadr: Improvement in views, Added search view , Fixed problem of delegate event invitation

bzr revid: rpa@tinyerp.com-20100513113759-zxot0r0sqrg1jd4h
This commit is contained in:
rpa (Open ERP) 2010-05-13 17:07:59 +05:30
parent a47b0f9d59
commit 2331abec58
3 changed files with 66 additions and 28 deletions

View File

@ -243,22 +243,22 @@ class calendar_attendee(osv.osv):
attdata.sent_by_uid.address_id.email)
if name == 'cn':
if attdata.user_id:
result[id][name] = self._get_address(attdata.user_id.name, attdata.email)
result[id][name] = attdata.user_id.name
elif attdata.partner_address_id:
result[id][name] = self._get_address(attdata.partner_id.name, attdata.email)
result[id][name] = attdata.partner_address_id.name or attdata.partner_id.name
else:
result[id][name] = self._get_address(None, attdata.email)
result[id][name] = attdata.email or ''
if name == 'delegated_to':
todata = []
for parent in attdata.parent_ids:
if parent.email:
todata.append('MAILTO:' + parent.email)
for child in attdata.child_ids:
if child.email:
todata.append('MAILTO:' + child.email)
result[id][name] = ', '.join(todata)
if name == 'delegated_from':
fromdata = []
for child in attdata.child_ids:
if child.email:
fromdata.append('MAILTO:' + child.email)
for parent in attdata.parent_ids:
if parent.email:
fromdata.append('MAILTO:' + parent.email)
result[id][name] = ', '.join(fromdata)
if name == 'event_date':
if attdata.ref:

View File

@ -8,8 +8,13 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invitation details">
<field name="email" string="Invitation To"/>
<field name="sent_by_uid" string="Invitation From" />
<group col="6" colspan="4">
<field name="email" string="Invitation To"/>
<field name="cutype" string="Invitation type" />
<field name="rsvp" />
<field name="role" string="Role" />
<field name="sent_by_uid" string="Invitation From" />
</group>
<notebook colspan="4">
<page string="Invitation">
<separator string="Invitation Detail" colspan="4" />
@ -20,9 +25,6 @@
string="Partner Contact" />
<field name="partner_id"
string="Partner" readonly="1" />
<field name="role" string="Role" />
<field name="cutype" string="Invitation type" />
<field name="rsvp" />
</group>
<separator string="Event Detail" colspan="4" />
<group colspan="4" col="4">
@ -181,7 +183,7 @@
<field name="model">calendar.event</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Meetings">
<form string="Events">
<group col="6" colspan="4">
<field name="name" select="1" string="Summary"
colspan="4" />
@ -257,7 +259,6 @@
<field name="user_id" string="Responsible User" />
<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>
@ -333,6 +334,7 @@
<field name="location" />
<field name="show_as" />
<field name="class" string="Privacy" />
<field name="user_id" invisible="1"/>
</tree>
</field>
</record>
@ -353,6 +355,44 @@
</field>
</record>
<!-- Event Search View-->
<record id="view_calendar_event_filter" model="ir.ui.view">
<field name="name">Calendar Events Search</field>
<field name="model">calendar.event</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Events">
<group col="12" colspan="4">
<filter icon="terp-partner" string="My Events"
domain="[('user_id','=',uid)]"
help="My Events" />
<separator orientation="vertical"/>
<field name="name" select="1" string="Summary"/>
<field name="location" select="1" string="Location"/>
<separator orientation="vertical"/>
<field name="user_id" select="1" widget="selection"/>
<separator orientation="vertical"/>
<field name="show_as" select="1"/>
<field name="class" select="1"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="16">
<filter string="Date" icon="terp-project"
domain="[]" context="{'group_by':'date'}" />
<filter string="Availability" icon="terp-project"
domain="[]" context="{'group_by':'show_as'}" />
<filter string="Privacy" icon="terp-crm"
domain="[]" context="{'group_by':'class'}" />
<separator orientation="vertical" />
<filter string="Responsible" icon="terp-crm" domain="[]"
context="{'group_by':'user_id'}" />
</group>
</search>
</field>
</record>
<!-- Event action -->
<record id="action_view_event" model="ir.actions.act_window">
@ -361,6 +401,7 @@
<field name="res_model">calendar.event</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="search_view_id" ref="view_calendar_event_filter"/>
</record>
<!-- Event menu -->

View File

@ -66,20 +66,19 @@ send an Email to Invited Person')
model = False
model_field = False
context_id = context and context.get('active_id', False) or False
if not context or not context.get('model'):
return {}
else:
model = context.get('model')
model_field = context.get('attendee_field', False)
obj = self.pool.get(model)
res_obj = obj.browse(cr, uid, context_id)
att_obj = self.pool.get('calendar.attendee')
for datas in self.read(cr, uid, ids, context=context):
obj = self.pool.get(model)
res_obj = obj.browse(cr, uid, context_id)
type = datas.get('type')
att_obj = self.pool.get('calendar.attendee')
vals = []
mail_to = []
attendees = []
@ -123,15 +122,13 @@ send an Email to Invited Person')
if contact.email:
mail_to.append(contact.email)
att = att_obj.browse(cr, uid, context_id)
for att_val in vals:
if model == 'calendar.attendee':
if ref:
att_val.update({
'parent_ids': [(4, att.id)],
'ref': att.ref._name + ',' +str(att.ref.id)
})
att = att_obj.browse(cr, uid, context_id)
att_val.update({
'parent_ids': [(4, att.id)],
'ref': att.ref._name + ',' +str(att.ref.id)
})
attendees.append(att_obj.create(cr, uid, att_val))
if model_field:
for attendee in attendees: