[FIX] Calendar: minor improvement

bzr revid: hmo@tinyerp.com-20100709133529-68fftd7xbjz69uoq
This commit is contained in:
Harry (OpenERP) 2010-07-09 19:05:29 +05:30
parent 5b1ba83812
commit 6ad5e67930
4 changed files with 36 additions and 30 deletions

View File

@ -379,6 +379,9 @@ property or property parameter."),
_defaults = {
'state': 'needs-action',
'user_id': lambda self, cr, uid, ctx: uid,
'role': 'req-participant',
'rsvp': True,
'cutype': 'individual',
}
def copy(self, cr, uid, id, default=None, context=None):
@ -543,13 +546,13 @@ property or property parameter."),
context = {}
for vals in self.browse(cr, uid, ids, context=context):
user = vals.user_id
if user:
mod_obj = self.pool.get(vals.ref._name)
if vals.ref:
if vals.ref.user_id.id != user.id:
defaults = {'user_id': user.id}
new_event = mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context)
#user = vals.user_id
#if user:
# mod_obj = self.pool.get(vals.ref._name)
# if vals.ref:
# if vals.ref.user_id.id != user.id:
# defaults = {'user_id': user.id}
# new_event = mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context)
self.write(cr, uid, vals.id, {'state': 'accepted'}, context)
return True
@ -1417,6 +1420,8 @@ true, it will allow you to hide the event alarm information without removing it.
until_date = arg[2]
res = super(calendar_event, self).search(cr, uid, args_without_date, \
offset, limit, order, context, count)
#Search Event ID which are invitted
return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)

View File

@ -76,13 +76,26 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invitation details">
<field name="email" string="Invitation To"/>
<field name="user_id" string="Internal User" />
<field name="partner_address_id" string="Contact" />
<field name="role" />
<field name="sent_by_uid" string="Invitation From" />
<field name="role" string="My Role"/>
<field name="cutype" string="Invitation type"/>
<field name="state" />
<field name="cutype" invisible="1"/>
<field name="rsvp" invisible="1"/>
<field name="rsvp" string="Required to Join"/>
<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'}" />
</tree>
</field>
</record>

View File

@ -75,7 +75,8 @@ send an Email to Invited Person')
obj = self.pool.get(model)
res_obj = obj.browse(cr, uid, context_id)
att_obj = self.pool.get('calendar.attendee')
user_obj = self.pool.get('res.users')
current_user = user_obj.browse(cr, uid, uid, context=context)
for datas in self.read(cr, uid, ids, context=context):
type = datas.get('type')
vals = []
@ -89,7 +90,7 @@ send an Email to Invited Person')
else:
return {}
if type == 'internal':
user_obj = self.pool.get('res.users')
if not datas.get('user_ids'):
raise osv.except_osv(_('Error!'), ("Please select any User"))
for user_id in datas.get('user_ids'):
@ -139,7 +140,7 @@ send an Email to Invited Person')
self._columns['type'].selection))
raise osv.except_osv(_('Error!'), ("%s must have an email Address to send mail") %(name[0]))
att_obj._send_mail(cr, uid, attendees, mail_to, \
email_from= tools.config.get('email_from', False))
email_from = current_user.user_email or tools.config.get('email_from', False))
return {}

View File

@ -342,20 +342,7 @@
</field>
</field>
</record>
<!-- Calendar Attendee Tree View -->
<record id="attendee_tree_view_inherit" model="ir.ui.view">
<field name="name">calendar.attendee.tree.inherit</field>
<field name="model">calendar.attendee</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base_calendar.base_calendar_attendee_tree_view"/>
<field name="arch" type="xml">
<field name="role" position="after">
<field name="categ_id" string="Event Type"/>
</field>
</field>
</record>
</data>
</openerp>