diff --git a/addons/base_calendar/__openerp__.py b/addons/base_calendar/__openerp__.py index 7e77f025476..de44f6e0333 100644 --- a/addons/base_calendar/__openerp__.py +++ b/addons/base_calendar/__openerp__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,34 +15,35 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## { - "name" : "Basic Calendar Functionality", - "version" : "1.0", - "depends" : ["base"], + "name" : "Basic Calendar Functionality", + "version" : "1.0", + "depends" : ["base"], 'description': """Full featured calendar system that support: - Alerts (create requests) - Recurring events (*) - - Invitations to others people""", - "author" : "Tiny", - 'category': 'Generic Modules/Others', - 'website': 'http://www.openerp.com', + - Invitations to others people""", + "author" : "Tiny", + 'category': 'Generic Modules/Others', + 'website': 'http://www.openerp.com', "init_xml" : [ 'base_calendar_data.xml' - ], - "demo_xml" : [], + ], + "demo_xml" : [], "update_xml" : [ 'security/ir.model.access.csv', - 'wizard/calendar_event_edit_all_view.xml', - 'wizard/base_calendar_invite_attendee_view.xml', + 'wizard/calendar_event_edit_all_view.xml', + 'wizard/base_calendar_invite_attendee_view.xml', + 'wizard/base_calendar_set_exrule_view.xml', 'base_calendar_view.xml' - ], - # "test" : ['test/base_calendar_test.yml'], - "installable" : True, - "active" : False, + ], + # "test" : ['test/base_calendar_test.yml'], + "installable" : True, + "active" : False, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index c53bf131002..4c3940301b3 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -44,7 +44,6 @@ def get_recurrent_dates(rrulestring, exdate, startdate=None, exrule=None): @param startdate: Startdate for computing recurrent dates @return: List of Recurrent dates """ - def todate(date): val = parser.parse(''.join((re.compile('\d')).findall(date))) return val @@ -97,7 +96,7 @@ def real_id2base_calendar_id(real_id, recurrent_date): return '%d-%s' % (real_id, recurrent_date) return real_id -def _links_get(self, cr, uid, context={}): +def _links_get(self, cr, uid, context=None): """ Get request link. @param cr: the current row, from the database cursor, @@ -213,7 +212,9 @@ class calendar_attendee(osv.osv): def _get_address(self, name=None, email=None): """ - Get Email Address + Gives email information in ical CAL-ADDRESS type format + @param name: Name for CAL-ADDRESS value + @param email: Email address for CAL-ADDRESS value """ if name and email: name += ':' @@ -221,7 +222,7 @@ class calendar_attendee(osv.osv): def _compute_data(self, cr, uid, ids, name, arg, context): """ - Compute data on field. + Compute data on function fields for attendee values . @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar attendee’s IDs. @@ -241,6 +242,7 @@ class calendar_attendee(osv.osv): else: result[id][name] = self._get_address(attdata.sent_by_uid.name, \ attdata.sent_by_uid.address_id.email) + if name == 'cn': if attdata.user_id: result[id][name] = attdata.user_id.name @@ -248,40 +250,47 @@ class calendar_attendee(osv.osv): result[id][name] = attdata.partner_address_id.name or attdata.partner_id.name else: result[id][name] = attdata.email or '' + if name == 'delegated_to': todata = [] 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 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: result[id][name] = attdata.ref.date else: result[id][name] = False + if name == 'event_end_date': if attdata.ref: result[id][name] = attdata.ref.date_deadline else: result[id][name] = False + if name == 'sent_by_uid': if attdata.ref: result[id][name] = (attdata.ref.user_id.id, attdata.ref.user_id.name) else: result[id][name] = uid + if name == 'language': user_obj = self.pool.get('res.users') lang = user_obj.read(cr, uid, uid, ['context_lang'], context=context)['context_lang'] result[id][name] = lang.replace('_', '-') + return result - def _links_get(self, cr, uid, context={}): + def _links_get(self, cr, uid, context=None): """ Get request link for ref field in calendar attendee. @param cr: the current row, from the database cursor, @@ -297,7 +306,7 @@ class calendar_attendee(osv.osv): def _lang_get(self, cr, uid, context={}): """ - Get language for language function field. + Get language for language selection field. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param context: A standard dictionary for contextual values @@ -313,60 +322,60 @@ class calendar_attendee(osv.osv): 'cutype': fields.selection([('individual', 'Individual'), \ ('group', 'Group'), ('resource', 'Resource'), \ ('room', 'Room'), ('unknown', '') ], \ - 'Invite Type', help="Specify the type of Invitation"), - 'member': fields.char('Member', size=124, - help="Indicate the groups that the attendee belongs to"), + 'Invite Type', help="Specify the type of Invitation"), + 'member': fields.char('Member', size=124, + help="Indicate the groups that the attendee belongs to"), 'role': fields.selection([('req-participant', 'Participation required'), \ ('chair', 'Chair Person'), \ ('opt-participant', 'Optional Participation'), \ ('non-participant', 'For information Purpose')], 'Role', \ - help='Participation role for the calendar user'), - 'state': fields.selection([('tentative', 'Tentative'), - ('needs-action', 'Needs Action'), - ('accepted', 'Accepted'), - ('declined', 'Declined'), + help='Participation role for the calendar user'), + 'state': fields.selection([('tentative', 'Tentative'), + ('needs-action', 'Needs Action'), + ('accepted', 'Accepted'), + ('declined', 'Declined'), ('delegated', 'Delegated')], 'State', readonly=True, \ - help="Status of the attendee's participation"), - 'rsvp': fields.boolean('Required Reply?', - help="Indicats whether the favor of a reply is requested"), + help="Status of the attendee's participation"), + 'rsvp': fields.boolean('Required Reply?', + help="Indicats whether the favor of a reply is requested"), 'delegated_to': fields.function(_compute_data, method=True, \ string='Delegated To', type="char", size=124, store=True, \ multi='delegated_to', help="The users that the original \ -request was delegated to"), +request was delegated to"), 'delegated_from': fields.function(_compute_data, method=True, string=\ - 'Delegated From', type="char", store=True, size=124, multi='delegated_from'), + '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 From'), + 'attendee_id', 'parent_id', 'Delegrated From'), 'child_ids': fields.many2many('calendar.attendee', 'calendar_attendee_child_rel', \ - 'attendee_id', 'child_id', 'Delegrated To'), + '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"), + 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'), + 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), + type="char", size=124, multi='cn', store=True), 'dir': fields.char('URI Reference', size=124, help="Reference to the URI\ -that points to the directory information corresponding to the attendee."), +that points to the directory information corresponding to the attendee."), 'language': fields.function(_compute_data, method=True, string='Language', \ type="selection", selection=_lang_get, multi='language', \ store=True, help="To specify the language for text values in a\ -property or property parameter."), - 'user_id': fields.many2one('res.users', 'User'), - 'partner_address_id': fields.many2one('res.partner.address', 'Contact'), +property or property parameter."), + 'user_id': fields.many2one('res.users', 'User'), + 'partner_address_id': fields.many2one('res.partner.address', 'Contact'), 'partner_id': fields.related('partner_address_id', 'partner_id', type='many2one', \ - relation='res.partner', string='Partner', help="Partner related to contact"), - 'email': fields.char('Email', size=124, help="Email of Invited Person"), + relation='res.partner', string='Partner', help="Partner related to contact"), + 'email': fields.char('Email', size=124, help="Email of Invited Person"), 'event_date': fields.function(_compute_data, method=True, string='Event Date', \ - type="datetime", multi='event_date'), + type="datetime", multi='event_date'), 'event_end_date': fields.function(_compute_data, method=True, \ string='Event End Date', type="datetime", \ - multi='event_end_date'), - 'ref': fields.reference('Event Ref', selection=_links_get, size=128), - 'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"), + multi='event_end_date'), + 'ref': fields.reference('Event Ref', selection=_links_get, size=128), + 'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"), } _defaults = { - 'state': lambda *x: 'needs-action', + 'state': lambda *x: 'needs-action', } def get_ics_file(self, cr, uid, event_obj, context=None): @@ -401,7 +410,7 @@ property or property parameter."), event.add('location').value = event_obj.location if event_obj.rrule: event.add('rrule').value = event_obj.rrule - + if event_obj.alarm_id: # computes alarm data valarm = event.add('valarm') @@ -422,10 +431,10 @@ property or property parameter."), if interval == 'minutes': delta = timedelta(minutes=duration) trigger.value = delta - + # Compute other details valarm.add('DESCRIPTION').value = alarm_data['name'] or 'OpenERP' - + for attendee in event_obj.attendee_ids: attendee_add = event.add('attendee') attendee_add.params['CUTYPE'] = [str(attendee.cutype)] @@ -435,15 +444,18 @@ property or property parameter."), res = cal.serialize() return res - def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}): + def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): """ - Send mail for calendar attendee. + Send mail for event invitation to event attendees. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, - @param ids: List of calendar attendee’s IDs. + @param ids: List of attendee’s IDs. + @param email_from: Email address for user sending the mail @param context: A standard dictionary for contextual values @return: True """ + if not context: + context = {} company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name for att in self.browse(cr, uid, ids, context=context): @@ -457,26 +469,26 @@ property or property parameter."), att_infos.append(((att2.user_id and att2.user_id.name) or \ (att2.partner_id and att2.partner_id.name) or \ att2.email) + ' - Status: ' + att2.state.title()) - body_vals = {'name': res_obj.name, - 'start_date': res_obj.date, - 'end_date': res_obj.date_deadline or False, - 'description': res_obj.description or '-', - 'location': res_obj.location or '-', - 'attendees': '
'.join(att_infos), - 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', - 'sign': sign, + body_vals = {'name': res_obj.name, + 'start_date': res_obj.date, + 'end_date': res_obj.date_deadline or False, + 'description': res_obj.description or '-', + 'location': res_obj.location or '-', + 'attendees': '
'.join(att_infos), + 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', + 'sign': sign, 'company': company } body = html_invitation % body_vals attach = self.get_ics_file(cr, uid, res_obj, context=context) if mail_to and email_from: tools.email_send( - email_from, - mail_to, - sub, - body, - attach=attach and [('invitation.ics', attach)] or None, - subtype='html', + email_from, + mail_to, + sub, + body, + attach=attach and [('invitation.ics', attach)] or None, + subtype='html', reply_to=email_from ) return True @@ -487,7 +499,7 @@ property or property parameter."), @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar attendee’s IDs. - @param user_id: User id + @param user_id: Changed value of User id @return: dictionary of value. which put value in email and availability fields. """ @@ -498,24 +510,27 @@ property or property parameter."), return {'value': {'email': user.address_id.email, 'availability':user.availability}} def do_tentative(self, cr, uid, ids, context=None, *args): - """ @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 attendee’s IDs - @param *args: Get Tupple value - @param context: A standard dictionary for contextual values """ + """ Makes event invitation as Tentative + @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 attendee’s IDs + @param *args: Get Tupple value + @param context: A standard dictionary for contextual values + """ self.write(cr, uid, ids, {'state': 'tentative'}, context) def do_accept(self, cr, uid, ids, context=None, *args): """ - Update state which value is accepted. + Update state of invitation as Accepted and + if the invited user is other then event user it will make a copy of this event for invited user @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar attendee’s IDs. + @param context: A standard dictionary for contextual values @return: True """ - if not context: context = {} @@ -532,21 +547,23 @@ property or property parameter."), return True def do_decline(self, cr, uid, ids, context=None, *args): - """ @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 attendee’s IDs - @param *args: Get Tupple value - @param context: A standard dictionary for contextual values """ + """ Marks event invitation as Declined + @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 attendee’s IDs + @param *args: Get Tupple value + @param context: A standard dictionary for contextual values """ self.write(cr, uid, ids, {'state': 'declined'}, context) def create(self, cr, uid, vals, context=None): - """ @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 vals: Get Values - @param context: A standard dictionary for contextual values """ + """ Overrides orm create method. + @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 vals: Get Values + @param context: A standard dictionary for contextual values """ if not context: context = {} @@ -561,46 +578,50 @@ property or property parameter."), calendar_attendee() class res_alarm(osv.osv): + """Resource Alarm """ _name = 'res.alarm' _description = 'Basic Alarm Information' + _columns = { - 'name':fields.char('Name', size=256, required=True), + 'name':fields.char('Name', size=256, required=True), 'trigger_occurs': fields.selection([('before', 'Before'), \ ('after', 'After')], \ - 'Triggers', required=True), + 'Triggers', required=True), 'trigger_interval': fields.selection([('minutes', 'Minutes'), \ ('hours', 'Hours'), \ ('days', 'Days')], 'Interval', \ - required=True), - 'trigger_duration': fields.integer('Duration', required=True), + required=True), + 'trigger_duration': fields.integer('Duration', required=True), 'trigger_related': fields.selection([('start', 'The event starts'), \ ('end', 'The event ends')], \ - 'Related to', required=True), + 'Related to', required=True), 'duration': fields.integer('Duration', help="""Duration' and 'Repeat' \ -are both optional, but if one occurs, so MUST the other"""), - 'repeat': fields.integer('Repeat'), +are both optional, but if one occurs, so MUST the other"""), + 'repeat': fields.integer('Repeat'), 'active': fields.boolean('Active', help="If the active field is set to \ true, it will allow you to hide the event alarm information without removing it.") } _defaults = { - 'trigger_interval': lambda *x: 'minutes', - 'trigger_duration': lambda *x: 5, - 'trigger_occurs': lambda *x: 'before', - 'trigger_related': lambda *x: 'start', - 'active': lambda *x: 1, + 'trigger_interval': lambda *x: 'minutes', + 'trigger_duration': lambda *x: 5, + 'trigger_occurs': lambda *x: 'before', + 'trigger_related': lambda *x: 'start', + 'active': lambda *x: 1, } - def do_alarm_create(self, cr, uid, ids, model, date, context={}): + def do_alarm_create(self, cr, uid, ids, model, date, context=None): """ - Create Alarm for meeting. + Create Alarm for event. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of res alarm’s IDs. @param model: Model name. + @param date: Event date @param context: A standard dictionary for contextual values @return: True """ - + if not context: + context = {} alarm_obj = self.pool.get('calendar.alarm') ir_obj = self.pool.get('ir.model') model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0] @@ -615,20 +636,20 @@ true, it will allow you to hide the event alarm information without removing it. self.do_alarm_unlink(cr, uid, [data.id], model) if basic_alarm: vals = { - 'action': 'display', - 'description': data.description, - 'name': data.name, - 'attendee_ids': [(6, 0, map(lambda x:x.id, data.attendee_ids))], - 'trigger_related': basic_alarm.trigger_related, - 'trigger_duration': basic_alarm.trigger_duration, - 'trigger_occurs': basic_alarm.trigger_occurs, - 'trigger_interval': basic_alarm.trigger_interval, - 'duration': basic_alarm.duration, - 'repeat': basic_alarm.repeat, - 'state': 'run', - 'event_date': data[date], - 'res_id': data.id, - 'model_id': model_id, + 'action': 'display', + 'description': data.description, + 'name': data.name, + 'attendee_ids': [(6, 0, map(lambda x:x.id, data.attendee_ids))], + 'trigger_related': basic_alarm.trigger_related, + 'trigger_duration': basic_alarm.trigger_duration, + 'trigger_occurs': basic_alarm.trigger_occurs, + 'trigger_interval': basic_alarm.trigger_interval, + 'duration': basic_alarm.duration, + 'repeat': basic_alarm.repeat, + 'state': 'run', + 'event_date': data[date], + 'res_id': data.id, + 'model_id': model_id, 'user_id': uid } alarm_id = alarm_obj.create(cr, uid, vals) @@ -638,16 +659,17 @@ true, it will allow you to hide the event alarm information without removing it. cr.commit() return True - def do_alarm_unlink(self, cr, uid, ids, model, context={}): + def do_alarm_unlink(self, cr, uid, ids, model, context=None): """ Delete alarm specified in ids @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of res alarm’s IDs. - @param model: Model name. + @param model: Model name for which alarm is to be cleared. @return: True """ - + if not context: + context = {} alarm_obj = self.pool.get('calendar.alarm') ir_obj = self.pool.get('ir.model') model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0] @@ -670,51 +692,53 @@ class calendar_alarm(osv.osv): __attribute__ = {} _columns = { - 'alarm_id': fields.many2one('res.alarm', 'Basic Alarm', ondelete='cascade'), + 'alarm_id': fields.many2one('res.alarm', 'Basic Alarm', ondelete='cascade'), 'name': fields.char('Summary', size=124, help="""Contains the text to be \ used as the message subject for email \ - or contains the text to be used for display"""), + or contains the text to be used for display"""), 'action': fields.selection([('audio', 'Audio'), ('display', 'Display'), \ ('procedure', 'Procedure'), ('email', 'Email') ], 'Action', \ - required=True, help="Defines the action to be invoked when an alarm is triggered"), + required=True, help="Defines the action to be invoked when an alarm is triggered"), 'description': fields.text('Description', help='Provides a more complete \ description of the calendar component, than that \ - provided by the "SUMMARY" property'), + provided by the "SUMMARY" property'), 'attendee_ids': fields.many2many('calendar.attendee', 'alarm_attendee_rel', \ - 'alarm_id', 'attendee_id', 'Attendees', readonly=True), + 'alarm_id', 'attendee_id', 'Attendees', readonly=True), 'attach': fields.binary('Attachment', help="""* Points to a sound resource,\ which is rendered when the alarm is triggered for audio, * File which is intended to be sent as message attachments for email, * Points to a procedure resource, which is invoked when\ - the alarm is triggered for procedure."""), - 'res_id': fields.integer('Resource ID'), - 'model_id': fields.many2one('ir.model', 'Model'), - 'user_id': fields.many2one('res.users', 'Owner'), - 'event_date': fields.datetime('Event Date'), - 'event_end_date': fields.datetime('Event End Date'), - 'trigger_date': fields.datetime('Trigger Date', readonly="True"), + the alarm is triggered for procedure."""), + 'res_id': fields.integer('Resource ID'), + 'model_id': fields.many2one('ir.model', 'Model'), + 'user_id': fields.many2one('res.users', 'Owner'), + 'event_date': fields.datetime('Event Date'), + 'event_end_date': fields.datetime('Event End Date'), + 'trigger_date': fields.datetime('Trigger Date', readonly="True"), 'state':fields.selection([ - ('draft', 'Draft'), - ('run', 'Run'), - ('stop', 'Stop'), - ('done', 'Done'), - ], 'State', select=True, readonly=True), + ('draft', 'Draft'), + ('run', 'Run'), + ('stop', 'Stop'), + ('done', 'Done'), + ], 'State', select=True, readonly=True), } _defaults = { - 'action': lambda *x: 'email', - 'state': lambda *x: 'run', + 'action': lambda *x: 'email', + 'state': lambda *x: 'run', } - def create(self, cr, uid, vals, context={}): + + def create(self, cr, uid, vals, context=None): """ - create new record. + Overrides orm create method. @param self: The object pointer @param cr: the current row, from the database cursor, @param vals: dictionary of fields value.{‘name_of_the_field’: value, ...} @param context: A standard dictionary for contextual values @return: new record id for calendar_alarm. """ - + if not context: + context = {} event_date = vals.get('event_date', False) if event_date: dtstart = datetime.strptime(vals['event_date'], "%Y-%m-%d %H:%M:%S") @@ -731,7 +755,7 @@ class calendar_alarm(osv.osv): def do_run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): - """ + """Scheduler for event reminder @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -754,11 +778,11 @@ class calendar_alarm(osv.osv): for alarm in self.browse(cr, uid, alarm_ids): if alarm.action == 'display': value = { - 'name': alarm.name, - 'act_from': alarm.user_id.id, - 'act_to': alarm.user_id.id, - 'body': alarm.description, - 'trigger_date': alarm.trigger_date, + 'name': alarm.name, + 'act_from': alarm.user_id.id, + 'act_to': alarm.user_id.id, + 'body': alarm.description, + 'trigger_date': alarm.trigger_date, 'ref_doc1': '%s,%s' % (alarm.model_id.model, alarm.res_id) } request_id = request_obj.create(cr, uid, value) @@ -788,9 +812,9 @@ class calendar_alarm(osv.osv): mail_to.append(att.user_id.address_id.email) if mail_to: tools.email_send( - tools.config.get('email_from', False), - mail_to, - sub, + tools.config.get('email_from', False), + mail_to, + sub, body ) self.write(cr, uid, [alarm.id], {'state':'done'}) @@ -808,7 +832,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={}): - """ + """Sets duration as 24 Hours if event is selcted for all day @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -820,23 +844,23 @@ class calendar_event(osv.osv): 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={}): - """ + def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context=None): + """Returns duration and/or end date based on values passed @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 start_date: Get starting date - @param duration: Get Duration between start date and end date or False - @param end_date: Get Ending Date or False + @param start_date: Starting date + @param duration: Duration between start date and end date + @param end_date: Ending Datee @param context: A standard dictionary for contextual values """ + if not context: + context = {} value = {} if not start_date: return value @@ -845,10 +869,7 @@ class calendar_event(osv.osv): 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} @@ -865,19 +886,21 @@ class calendar_event(osv.osv): return {'value': value} - def _set_rrulestring(self, cr, uid, id, name, value, arg, context): + def _set_rrulestring(self, cr, uid, id, name, value, arg, context=None): """ - Set rule string. + Sets values of fields that defines event recurrence from the value of rrule string @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @param context: A standard dictionary for contextual values @return: dictionary of rrule value. """ + if not context: + context = {} cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\ mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\ day=0,select1='date',month_list=Null ,byday=Null where id=%s" % (self._table, id)) - + if not value: cr.execute("UPDATE %s set rrule_type='none' where id=%s" % (self._table, id)) return True @@ -906,19 +929,19 @@ class calendar_event(osv.osv): for day in val['byday'].split(','): new_val[day] = True val.pop('byday') - + if val.get('until'): until = parser.parse(''.join((re.compile('\d')).findall(val.get('until')))) new_val['end_date'] = until.strftime('%Y-%m-%d') val.pop('until') new_val.pop('until') - + if val.get('bymonthday'): new_val['day'] = val.get('bymonthday') val.pop('bymonthday') new_val['select1'] = 'date' new_val.pop('bymonthday') - + if val.get('byday'): d = val.get('byday') if '-' in d: @@ -928,12 +951,12 @@ class calendar_event(osv.osv): new_val['byday'] = d[:1] new_val['week_list'] = d[1:3].upper() new_val['select1'] = 'day' - + if val.get('bymonth'): new_val['month_list'] = val.get('bymonth') val.pop('bymonth') new_val.pop('bymonth') - + for k, v in new_val.items(): temp = ", %s='%s'" % (k, v) qry += temp @@ -941,16 +964,16 @@ class calendar_event(osv.osv): whr = " where id=%(id)s" qry = qry + whr val.update({ - 'table': self._table, - 'rule_type': rrule_type, - 'id': id, + 'table': self._table, + 'rule_type': rrule_type, + 'id': id, }) cr.execute(qry % val) return True def _get_rulestring(self, cr, uid, ids, name, arg, context=None): """ - Get rule string. + Gets Recurrence rule string according to value type RECUR of iCalendar from the values given. @param self: The object pointer @param cr: the current row, from the database cursor, @param id: List of calendar event's ids. @@ -968,7 +991,7 @@ class calendar_event(osv.osv): raise osv.except_osv('Warning!', 'Interval can not be Negative') if datas.get('count', 0) < 0: raise osv.except_osv('Warning!', 'Count can not be Negative') - rrule_custom = self.compute_rule_string(cr, uid, datas,\ + rrule_custom = self.compute_rule_string(cr, uid, datas, \ context=context) result[event] = rrule_custom else: @@ -977,40 +1000,40 @@ class calendar_event(osv.osv): return result _columns = { - 'id': fields.integer('ID'), - 'sequence': fields.integer('Sequence'), - 'name': fields.char('Description', size=64, required=True), - 'date': fields.datetime('Date'), - 'date_deadline': fields.datetime('Deadline'), - 'create_date': fields.datetime('Created', readonly=True), - 'duration': fields.float('Duration'), - 'description': fields.text('Your action'), + 'id': fields.integer('ID'), + 'sequence': fields.integer('Sequence'), + 'name': fields.char('Description', size=64, required=False), + 'date': fields.datetime('Date'), + 'date_deadline': fields.datetime('Deadline'), + 'create_date': fields.datetime('Created', readonly=True), + 'duration': fields.float('Duration'), + 'description': fields.text('Your action'), 'class': fields.selection([('public', 'Public'), ('private', 'Private'), \ - ('confidential', 'Confidential')], 'Mark as'), - 'location': fields.char('Location', size=264, help="Location of Event"), + ('confidential', 'Confidential')], 'Mark as'), + 'location': fields.char('Location', size=264, help="Location of Event"), 'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], \ - 'Show as'), - 'base_calendar_url': fields.char('Caldav URL', size=264), + 'Show as'), + 'base_calendar_url': fields.char('Caldav URL', size=264), 'exdate': fields.text('Exception Date/Times', help="This property \ -defines the list of date/time exceptions for arecurring calendar component."), +defines the list of date/time exceptions for arecurring calendar component."), 'exrule': fields.char('Exception Rule', size=352, help="defines a \ -rule or repeating pattern for an exception to a recurrence set"), +rule or repeating pattern for an exception to a recurrence set"), 'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \ string='Recurrent Rule', store=True, \ fnct_inv=_set_rrulestring, help='Defines a\ rule or repeating pattern for recurring events\n\ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ - FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'), + FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'), 'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \ ('weekly', 'Weekly'), ('monthly', 'Monthly'), \ - ('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'), - 'alarm_id': fields.many2one('res.alarm', 'Alarm'), - 'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'), - 'recurrent_uid': fields.integer('Recurrent ID'), - 'recurrent_id': fields.datetime('Recurrent ID date'), + ('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'), + 'alarm_id': fields.many2one('res.alarm', 'Alarm'), + 'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'), + 'recurrent_uid': fields.integer('Recurrent ID'), + 'recurrent_id': fields.datetime('Recurrent ID date'), 'vtimezone': fields.related('user_id', 'context_tz', type='char', size=24, \ - string='Timezone', store=True), - 'user_id': fields.many2one('res.users', 'Responsible'), + string='Timezone', store=True), + 'user_id': fields.many2one('res.users', 'Responsible'), 'freq': fields.selection([('None', 'No Repeat'), \ ('secondly', 'Secondly'), \ ('minutely', 'Minutely'), \ @@ -1018,44 +1041,44 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ ('daily', 'Daily'), \ ('weekly', 'Weekly'), \ ('monthly', 'Monthly'), \ - ('yearly', 'Yearly')], 'Frequency'), - 'interval': fields.integer('Interval'), - 'count': fields.integer('Count'), - 'mo': fields.boolean('Mon'), - 'tu': fields.boolean('Tue'), - 'we': fields.boolean('Wed'), - 'th': fields.boolean('Thu'), - 'fr': fields.boolean('Fri'), - 'sa': fields.boolean('Sat'), - 'su': fields.boolean('Sun'), + ('yearly', 'Yearly')], 'Frequency'), + 'interval': fields.integer('Interval'), + 'count': fields.integer('Count'), + 'mo': fields.boolean('Mon'), + 'tu': fields.boolean('Tue'), + 'we': fields.boolean('Wed'), + 'th': fields.boolean('Thu'), + 'fr': fields.boolean('Fri'), + 'sa': fields.boolean('Sat'), + 'su': fields.boolean('Sun'), 'select1': fields.selection([('date', 'Date of month'), \ - ('day', 'Day of month')], 'Option'), - 'day': fields.integer('Date of month'), + ('day', 'Day of month')], 'Option'), + 'day': fields.integer('Date of month'), 'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \ ('WE', 'Wednesday'), ('TH', 'Thursday'), \ ('FR', 'Friday'), ('SA', 'Saturday'), \ - ('SU', 'Sunday')], 'Weekday'), + ('SU', 'Sunday')], 'Weekday'), 'byday': fields.selection([('1', 'First'), ('2', 'Second'), \ ('3', 'Third'), ('4', 'Fourth'), \ ('5', 'Fifth'), ('-1', 'Last')], 'By day'), 'month_list': fields.selection(months.items(), 'Month'), 'end_date': fields.date('Repeat Until'), - 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel',\ - 'event_id', 'attendee_id', 'Attendees'), + 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', \ + 'event_id', 'attendee_id', 'Attendees'), 'allday': fields.boolean('All Day'), 'active': fields.boolean('Active', help="If the active field is set to \ true, it will allow you to hide the event alarm information without removing it.") } _defaults = { - 'class': lambda *a: 'public', - 'show_as': lambda *a: 'busy', - 'freq': lambda *x: 'None', - 'select1': lambda *x: 'date', - 'interval': lambda *x: 1, - 'active': lambda *x: 1, + 'class': lambda *a: 'public', + 'show_as': lambda *a: 'busy', + 'freq': lambda *x: 'None', + 'select1': lambda *x: 'date', + 'interval': lambda *x: 1, + 'active': lambda *x: 1, } - + def open_event(self, cr, uid, ids, context=None): """ Open Event From for Editing @@ -1067,11 +1090,11 @@ true, it will allow you to hide the event alarm information without removing it. """ 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') @@ -1088,32 +1111,32 @@ true, it will allow you to hide the event alarm information without removing it. 'view_mode': 'form,tree', 'res_model': 'calendar.event', 'view_id': False, - 'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')], + '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): - """ + """Modifies only one event record out of virtual recurrent events + and creates new event as a specific instance of a Recurring Event", @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 event_id: Get Event_id - @param real_date: Get Real Date + @param event_id: Id of Recurring Event + @param real_date: Date of event recurrence that is being modified @param context: A standard dictionary for contextual values - @param *args: Get Tuppel Value - + @param *args: Get Tupple Value """ event_id = base_calendar_id2real_id(event_id) datas = self.read(cr, uid, event_id, context=context) defaults.update({ - 'recurrent_uid': base_calendar_id2real_id(datas['id']), - 'recurrent_id': defaults.get('date') or real_date, - 'rrule_type': 'none', + 'recurrent_uid': base_calendar_id2real_id(datas['id']), + 'recurrent_id': defaults.get('date') or real_date, + 'rrule_type': 'none', 'rrule': '' }) exdate = datas['exdate'] and datas['exdate'].split(',') or [] @@ -1125,13 +1148,14 @@ true, it will allow you to hide the event alarm information without removing it. def modify_all(self, cr, uid, event_ids, defaults, context=None, *args): """ - Modify name, date, date_deadline fields. + Modifies the recurring event @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param event_ids: List of crm meeting’s IDs. + @param context: A standard dictionary for contextual values @return: True """ - + for event_id in event_ids: event_id = base_calendar_id2real_id(event_id) @@ -1146,11 +1170,12 @@ true, it will allow you to hide the event alarm information without removing it. qry += ", location = '%(location)s'" qry += "WHERE id = %s" % (event_id) cr.execute(qry %(defaults)) - + return True def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): - """ + """Gives virtual event ids for recurring events based on value of Recurrence Rule + This method gives ids of dates that comes between start date and end date of calendar views @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -1167,7 +1192,7 @@ true, it will allow you to hide the event alarm information without removing it. result = [] if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, m.date, m.date_deadline, \ - m.exdate from " + self._table + \ + m.exdate, m.exrule from " + self._table + \ " m where m.id in ("\ + ','.join(map(lambda x: str(x), ids))+")") @@ -1214,7 +1239,7 @@ true, it will allow you to hide the event alarm information without removing it. new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) - rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date) + rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date, data['exrule']) for rdate in rdates: r_date = datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S") if start_date and r_date < start_date: @@ -1229,15 +1254,16 @@ true, it will allow you to hide the event alarm information without removing it. if isinstance(select, (str, int, long)): return ids and ids[0] or False return ids - + def compute_rule_string(self, cr, uid, datas, context=None, *args): """ - Compute rule string. + Compute rule string according to value type RECUR of iCalendar from the values given. @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 datas: dictionary of freq and interval value. - @return: string value which compute FREQILY;INTERVAL + @param context: A standard dictionary for contextual values + @return: String value of the format RECUR of iCalendar """ weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] @@ -1248,9 +1274,9 @@ true, it will allow you to hide the event alarm information without removing it. freq = datas.get('freq') if freq == 'None': return '' - + interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or '' - + if freq == 'weekly': byday = map(lambda x: x.upper(), filter(lambda x: datas.get(x) and x in weekdays, datas)) @@ -1286,7 +1312,7 @@ true, it will allow you to hide the event alarm information without removing it. return rrule_string - def search(self, cr, uid, args, offset=0, limit=100, order=None, + def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): """ Overrides orm search method. @@ -1295,6 +1321,8 @@ true, it will allow you to hide the event alarm information without removing it. @param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...]. @param offset: The Number of Results to Pass @param limit: The Number of Results to Return + @param context: A standard dictionary for contextual values + @param count: If its True the method returns number of records instead of ids @return: List of id """ args_without_date = [] @@ -1317,14 +1345,16 @@ true, it will allow you to hide the event alarm information without removing it. return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) + def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ - Writes values in one or several fields. + Overrides orm write method. @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 crm meeting's ids @param vals: Dictionary of field value. + @param context: A standard dictionary for contextual values @return: True """ if not context: @@ -1348,7 +1378,7 @@ true, it will allow you to hide the event alarm information without removing it. event_id = base_calendar_id2real_id(event_id) if not event_id in new_ids: new_ids.append(event_id) - + res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) if vals.has_key('alarm_id') or vals.has_key('base_calendar_alarm_id'): alarm_obj = self.pool.get('res.alarm') @@ -1364,6 +1394,7 @@ true, it will allow you to hide the event alarm information without removing it. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of crm meeting's ids + @param context: A standard dictionary for contextual values @return: the object list. """ if isinstance(ids, (str, int, long)): @@ -1378,15 +1409,19 @@ true, it will allow you to hide the event alarm information without removing it. return res - def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'): + def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): """ Overrides orm Read method.Read List of fields for calendar event. @param cr: the current row, from the database cursor, @param user: the current user’s ID for security checks, @param ids: List of calendar event's id. @param fields: List of fields. + @param context: A standard dictionary for contextual values @return: List of Dictionary of form [{‘name_of_the_field’: value, ...}, ...] """ + if not context: + context = {} + if isinstance(ids, (str, int, long)): select = [ids] else: @@ -1408,14 +1443,17 @@ true, it will allow you to hide the event alarm information without removing it. return result and result[0] or False return result - def copy(self, cr, uid, id, default=None, context={}): + def copy(self, cr, uid, id, default=None, context=None): """ Duplicate record on specified id. @param self: the object pointer. @param cr: the current row, from the database cursor, @param id: id of record from which we duplicated. + @param context: A standard dictionary for contextual values @return: Duplicate record id. """ + if not context: + context = {} res = super(calendar_event, self).copy(cr, uid, base_calendar_id2real_id(id), default, context) alarm_obj = self.pool.get('res.alarm') alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date') @@ -1428,6 +1466,7 @@ true, it will allow you to hide the event alarm information without removing it. @param self: the object pointer. @param cr: the current row, from the database cursor, @param id: List of calendar event's id. + @param context: A standard dictionary for contextual values @return: True """ res = False @@ -1454,15 +1493,18 @@ true, it will allow you to hide the event alarm information without removing it. alarm_obj.do_alarm_unlink(cr, uid, ids, self._name) return res - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): """ Create new record. @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 vals: dictionary of every field value. + @param context: A standard dictionary for contextual values @return: new created record id. """ + if not context: + context = {} 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') @@ -1478,7 +1520,7 @@ class calendar_todo(osv.osv): _description = "Calendar Task" def _get_date(self, cr, uid, ids, name, arg, context): - """ + """ Get Date @param self: The object pointer @param cr: the current row, from the database cursor, @@ -1494,7 +1536,7 @@ class calendar_todo(osv.osv): return res def _set_date(self, cr, uid, id, name, value, arg, context): - """ + """ Set Date @param self: The object pointer @param cr: the current row, from the database cursor, @@ -1512,8 +1554,8 @@ class calendar_todo(osv.osv): _columns = { 'date': fields.function(_get_date, method=True, fnct_inv=_set_date, \ - string='Duration', store=True, type='datetime'), - 'duration': fields.integer('Duration'), + string='Duration', store=True, type='datetime'), + 'duration': fields.integer('Duration'), } __attribute__ = {} @@ -1526,7 +1568,7 @@ class ir_attachment(osv.osv): _inherit = 'ir.attachment' def search_count(self, cr, user, args, context=None): - """ + """ @param self: The object pointer @param cr: the current row, from the database cursor, @param user: the current user’s ID for security checks, @@ -1539,9 +1581,9 @@ class ir_attachment(osv.osv): args1.append(map(lambda x:str(x).split('-')[0], arg)) return super(ir_attachment, self).search_count(cr, user, args1, context) - def search(self, cr, uid, args, offset=0, limit=None, order=None, + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): - """ + """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -1555,8 +1597,8 @@ class ir_attachment(osv.osv): for i, arg in enumerate(new_args): if arg[0] == 'res_id': new_args[i] = (arg[0], arg[1], base_calendar_id2real_id(arg[2])) - return super(ir_attachment, self).search(cr, uid, new_args, offset=offset, - limit=limit, order=order, + return super(ir_attachment, self).search(cr, uid, new_args, offset=offset, + limit=limit, order=order, context=context, count=False) ir_attachment() @@ -1565,12 +1607,12 @@ class ir_values(osv.osv): def set(self, cr, uid, key, key2, name, models, value, replace=True, \ isobject=False, meta=False, preserve_user=False, company=False): - """ + """ Set IR Values @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 model: Get The Model + @param model: Get The Model """ new_model = [] @@ -1582,16 +1624,17 @@ class ir_values(osv.osv): return super(ir_values, self).set(cr, uid, key, key2, name, new_model, \ value, replace, isobject, meta, preserve_user, company) - def get(self, cr, uid, key, key2, models, meta=False, context={}, \ + def get(self, cr, uid, key, key2, models, meta=False, context=None, \ res_id_req=False, without_user=True, key2_req=True): - """ + """ Get IR Values @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 model: Get The Model + @param model: Get The Model """ - + if not context: + context = {} new_model = [] for data in models: if type(data) in (list, tuple): @@ -1607,20 +1650,19 @@ class ir_model(osv.osv): _inherit = 'ir.model' - def read(self, cr, uid, ids, fields=None, context={}, + def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): """ - Read IR Model + Overrides orm read method. @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 IR Model’s IDs. - @param context: A standard dictionary for contextual values + @param context: A standard dictionary for contextual values """ - - new_ids = isinstance(ids, (str, int, long)) and [ids] or ids - - data = super(ir_model, self).read(cr, uid, new_ids, fields=fields, \ + if not context: + context = {} + data = super(ir_model, self).read(cr, uid, ids, fields=fields, \ context=context, load=load) if data: for val in data: @@ -1632,12 +1674,12 @@ ir_model() class virtual_report_spool(web_services.report_spool): def exp_report(self, db, uid, object, ids, datas=None, context=None): - """ + """ Export Report @param self: The object pointer @param db: get the current database, @param uid: the current user’s ID for security checks, - @param context: A standard dictionary for contextual values + @param context: A standard dictionary for contextual values """ if object == 'printscreen.list': @@ -1657,19 +1699,19 @@ class res_users(osv.osv): def _get_user_avail(self, cr, uid, ids, context=None): """ - Get USer Availability + Get User Availability @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 res user’s IDs. - @param context: A standard dictionary for contextual values + @param context: A standard dictionary for contextual values """ current_datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S') res = {} attendee_obj = self.pool.get('calendar.attendee') attendee_ids = attendee_obj.search(cr, uid, [ - ('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime), + ('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime), ('state', '=', 'accepted'), ('user_id', 'in', ids) ]) @@ -1688,12 +1730,12 @@ class res_users(osv.osv): def _get_user_avail_fun(self, cr, uid, ids, name, args, context=None): """ - Get USer Availability Function + Get User Availability Function @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 res user’s IDs. - @param context: A standard dictionary for contextual values + @param context: A standard dictionary for contextual values """ return self._get_user_avail(cr, uid, ids, context=context) @@ -1701,8 +1743,9 @@ class res_users(osv.osv): _columns = { 'availability': fields.function(_get_user_avail_fun, type='selection', \ selection=[('free', 'Free'), ('busy', 'Busy')], \ - string='Free/Busy', method=True), + string='Free/Busy', method=True), } + res_users() diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index 0c8a52260ef..d31266c9090 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -1,6 +1,8 @@ + + calendar.attendee.form @@ -65,6 +67,8 @@ + + calendar.attendee.tree @@ -77,10 +81,14 @@ + + - + + + calendar.attendee.search calendar.attendee @@ -99,11 +107,26 @@ + + + + + + + + + - + + Event Invitations ir.actions.act_window @@ -115,10 +138,12 @@ + + @@ -138,9 +163,6 @@ - - - @@ -162,7 +184,8 @@ - + + Available Alarms ir.actions.act_window @@ -170,6 +193,8 @@ form tree,form + + + diff --git a/addons/base_calendar/wizard/__init__.py b/addons/base_calendar/wizard/__init__.py index 27614aacd88..8b45dc18a17 100644 --- a/addons/base_calendar/wizard/__init__.py +++ b/addons/base_calendar/wizard/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -15,12 +15,13 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## import calendar_event_edit_all import base_calendar_invite_attendee +import base_calendar_set_exrule # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_calendar/wizard/base_calendar_invite_attendee_view.xml b/addons/base_calendar/wizard/base_calendar_invite_attendee_view.xml index 4fe55998e59..bea5ea66a84 100644 --- a/addons/base_calendar/wizard/base_calendar_invite_attendee_view.xml +++ b/addons/base_calendar/wizard/base_calendar_invite_attendee_view.xml @@ -13,37 +13,38 @@ - - - + colspan="6" /> -