From 52f667cbf8cce95e8c79632ed2f34311d02407bf Mon Sep 17 00:00:00 2001 From: "ATP (Open ERP)" <> Date: Thu, 11 Mar 2010 10:53:02 +0530 Subject: [PATCH] [IMP]: base_calendar: Converted wizard into osv_memory wizard bzr revid: rpa@tinyerp.com-20100311052302-0eqro8knu4mpjs12 --- addons/base_calendar/__terp__.py | 3 +- addons/base_calendar/wizard/__init__.py | 3 +- .../wizard/calendar_event_edit_all.py | 85 +++++++++++++++++++ .../wizard/calendar_event_edit_all_view.xml | 41 +++++++++ .../wizard/wizard_cal_edit_event.py | 78 ----------------- 5 files changed, 130 insertions(+), 80 deletions(-) create mode 100644 addons/base_calendar/wizard/calendar_event_edit_all.py create mode 100644 addons/base_calendar/wizard/calendar_event_edit_all_view.xml delete mode 100644 addons/base_calendar/wizard/wizard_cal_edit_event.py diff --git a/addons/base_calendar/__terp__.py b/addons/base_calendar/__terp__.py index e433fbb7668..ce65e1166c5 100644 --- a/addons/base_calendar/__terp__.py +++ b/addons/base_calendar/__terp__.py @@ -40,7 +40,8 @@ ], "demo_xml" : [], "update_xml" : [ - 'security/ir.model.access.csv', + 'security/ir.model.access.csv', + 'wizard/calendar_event_edit_all_view.xml', 'base_calendar_view.xml' ], "installable" : True, diff --git a/addons/base_calendar/wizard/__init__.py b/addons/base_calendar/wizard/__init__.py index 60c61475131..38f790bcd42 100644 --- a/addons/base_calendar/wizard/__init__.py +++ b/addons/base_calendar/wizard/__init__.py @@ -18,7 +18,8 @@ # along with this program. If not, see . # ############################################################################## -import wizard_cal_edit_event + +import calendar_event_edit_all # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_calendar/wizard/calendar_event_edit_all.py b/addons/base_calendar/wizard/calendar_event_edit_all.py new file mode 100644 index 00000000000..0a7fddadb2a --- /dev/null +++ b/addons/base_calendar/wizard/calendar_event_edit_all.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# 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 . +# +############################################################################## + +from osv import fields, osv +from tools.translate import _ +import netsvc +import pooler +import time +import tools +import wizard + +class calendar_event_edit_all(osv.osv_memory): + + def _default_values(self, cr, uid, context={}): + """ + @Return : Get Default value for Start Date + """ + if context.get('date'): + return context.get('date') + else: + model = context.get('model') + model_obj = self.pool.get(model) + event = model_obj.read(cr, uid, context['active_id'], ['name', 'location', 'alarm_id']) + return event['date'] + + def _default_deadline(self, cr, uid, context={}): + """ + @return : Get Default value for End Date + """ + if context.get('date_deadline'): + return context.get('date_deadline') + else: + model = context.get('model') + model_obj = self.pool.get(model) + event = model_obj.read(cr, uid, context['active_id'], ['name', 'location', 'alarm_id']) + return event['date_deadline'] + + def _modify_this(self, cr, uid, ids, context=None): + """ + Modify All event for Crm Meeting. + @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 edit all’s IDs + """ + for datas in self.read(cr, uid, ids): + model = context.get('model') + model_obj = self.pool.get(model) + model_obj.modify_all(cr, uid, [context['active_id']], datas, context) + return {} + + _name = "calendar.event.edit.all" + _description = "Calendar Edit all event" + _columns ={ + 'name':fields.char('Title', size=64, required=True), + 'date':fields.datetime('Start Date', required=True), + 'date_deadline':fields.datetime('End Date', required=True), + 'location':fields.char('Location', size=124), + 'alarm_id':fields.many2one('res.alarm', 'Reminder'), + } + _defaults = { + 'date':_default_values, + 'date_deadline':_default_deadline + } + +calendar_event_edit_all() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_calendar/wizard/calendar_event_edit_all_view.xml b/addons/base_calendar/wizard/calendar_event_edit_all_view.xml new file mode 100644 index 00000000000..15bd025441a --- /dev/null +++ b/addons/base_calendar/wizard/calendar_event_edit_all_view.xml @@ -0,0 +1,41 @@ + + + + + calendar.event.edit.all.form + calendar.event.edit.all + form + +
+ + + + + + + + + + + + + + +