1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
23 from osv import fields
25 class calendar_event_edit_all(osv.osv_memory):
27 def _default_values(self, cr, uid, context=None):
28 """ Get Default value for Start Date
29 @param self: The object pointer
30 @param cr: the current row, from the database cursor,
31 @param uid: the current user’s ID for security checks,
32 @param context: A standard dictionary for contextual values
33 @Return: Get Default value for Start Date
35 context_id = context and context.get('active_id', False) or False
37 if context.get('date'):
38 return context.get('date')
40 model = context.get('model', False)
41 model_obj = self.pool.get(model)
42 event = model_obj.read(cr, uid, context_id, ['name', 'location', 'alarm_id'])
45 def _default_deadline(self, cr, uid, context=None):
46 """ Get Default value for End Date
47 @param self: The object pointer
48 @param cr: the current row, from the database cursor,
49 @param uid: the current user’s ID for security checks,
50 @param context: A standard dictionary for contextual values
51 @return: Get Default value for End Date
54 context_id = context and context.get('active_id', False) or False
56 if context.get('date_deadline'):
57 return context.get('date_deadline')
59 model = context.get('model', False)
60 model_obj = self.pool.get(model)
61 event = model_obj.read(cr, uid, context_id, ['name', 'location', 'alarm_id'])
62 return event['date_deadline']
64 def modify_this(self, cr, uid, ids, context=None):
66 Modify All event for Crm Meeting.
67 @param cr: the current row, from the database cursor,
68 @param uid: the current user’s ID for security checks,
69 @param ids: List of calendar event edit all’s IDs
70 @return: dictionary {}
75 context_id = context and context.get('active_id', False) or False
77 for datas in self.read(cr, uid, ids):
78 model = context.get('model', False)
79 model_obj = self.pool.get(model)
80 model_obj.modify_all(cr, uid, [context_id], datas, context=context)
81 return {'type': 'ir.actions.act_window_close'}
83 _name = "calendar.event.edit.all"
84 _description = "Calendar Edit all event"
86 'name': fields.char('Title', size=64, required=True),
87 'date': fields.datetime('Start Date', required=True),
88 'date_deadline': fields.datetime('End Date', required=True),
89 'location': fields.char('Location', size=124),
90 'alarm_id': fields.many2one('res.alarm', 'Reminder'),
93 'date': _default_values,
94 'date_deadline': _default_deadline
96 calendar_event_edit_all()
98 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: