[IMP]: caldav: Improvement in Invite Attendee

bzr revid: rpa@openerp.co.in-20100208095704-zvgmjs8pnkw6zyix
This commit is contained in:
rpa (Open ERP) 2010-02-08 15:27:04 +05:30
parent 9165d7aa70
commit e6213959fa
2 changed files with 18 additions and 14 deletions

View File

@ -186,10 +186,10 @@ class invite_attendee_wizard(osv.osv_memory):
'email': fields.char('Email', size=124),
'contact_ids': fields.many2many('res.partner.address', 'invite_contact_rel',
'invite_id', 'contact_id', 'Contacts'),
'send_mail': fields.boolean('Send mail?', help='Check this if you want\
to send an Email to Invited Person')
}
def do_invite(self, cr, uid, ids, context={}):
datas = self.read(cr, uid, ids)[0]
model = False
@ -241,9 +241,12 @@ class invite_attendee_wizard(osv.osv_memory):
})
att_id = att_obj.create(cr, uid, vals)
if model_field:
obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]})
att_obj._send_mail(cr, uid, [att_id], mail_to, email_from=tools.config.get('email_from', False))
obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)],
'state': 'delegated'})
if datas.get('send_mail'):
att_obj._send_mail(cr, uid, [att_id], mail_to, \
email_from=tools.config.get('email_from', False))
return {}
@ -374,8 +377,8 @@ class calendar_attendee(osv.osv):
request was delegated to"),
'delegated_from': fields.function(_compute_data, method=True, string=\
'Delegated From', type="char", store=True, size=124, multi='delegated_from'),
'parent_ids': fields.many2many('calendar.attendee', 'calendar_attendee_parent_rel', 'attendee_id', 'parent_id', 'Delegrated To'),
'child_ids': fields.many2many('calendar.attendee', 'calendar_attendee_child_rel', 'attendee_id', 'child_id', 'Delegrated From'),
'parent_ids': fields.many2many('calendar.attendee', 'calendar_attendee_parent_rel', 'attendee_id', 'parent_id', 'Delegrated From'),
'child_ids': fields.many2many('calendar.attendee', 'calendar_attendee_child_rel', 'attendee_id', 'child_id', 'Delegrated To'),
'sent_by': fields.function(_compute_data, method=True, string='Sent By', type="char", multi='sent_by', store=True, size=124, help="Specify the user that is acting on behalf of the calendar user"),
'sent_by_uid': fields.function(_compute_data, method=True, string='Sent By User', type="many2one", relation="res.users", multi='sent_by_uid'),
'cn': fields.function(_compute_data, method=True, string='Common name', type="char", size=124, multi='cn', store=True),
@ -394,7 +397,7 @@ request was delegated to"),
'state': lambda *x: 'needs-action',
}
response_re = response_re = re.compile("Are you coming\?.*(YES|NO|MAYBE).*", re.UNICODE)
response_re = response_re = re.compile("Are you coming\?.*\n*.*(YES|NO|MAYBE).*", re.UNICODE)
def msg_new(self, cr, uid, msg):
return False

View File

@ -11,6 +11,7 @@
<field name="arch" type="xml">
<form string="Invite People">
<field name="type" />
<field name="send_mail" />
<newline/>
<group col="1" colspan="4"
attrs="{'invisible': [('type', '!=', 'external')]}">
@ -84,27 +85,27 @@
<field name="ref" colspan="4" readonly="1"/>
</page>
<page string="Delegation Info">
<separator string="Delegated to" colspan="4" />
<separator string="Delegated From" colspan="4" />
<field name="parent_ids" nolabel="1"
colspan="4" readonly="1" />
<separator string="Delegated from" colspan="4" />
<separator string="Delegated To" colspan="4" />
<field name="child_ids" nolabel="1"
colspan="4" readonly="1" />
</page>
</notebook>
<group col="6" colspan="4">
<field name="state" select="2" />
<button name="do_tentative"
<button name="do_tentative" states="needs-action,declined,accepted"
string="Uncertain" type="object"
icon="terp-crm" />
<button name="do_accept" string="Accept"
<button name="do_accept" string="Accept" states="needs-action,tentative,declined"
type="object" icon="gtk-apply" />
<button name="do_decline" string="Decline"
<button name="do_decline" string="Decline" states="needs-action,tentative,accepted"
type="object" icon="gtk-cancel" />
<button
name="%(caldav.action_view_calendar_invite_attendee_wizard)d"
string="Delegate" type="action"
icon="gtk-sort-descending"
icon="gtk-sort-descending" states="needs-action,tentative,declined,accepted"
context="{'model' : 'calendar.attendee', 'attendee_field' : 'child_ids'}" />
</group>
</form>