diff options
| author | Meera Trambadia (OpenERP) <mtr@tinyerp.com> | 2011-09-16 11:11:38 +0530 |
|---|---|---|
| committer | Meera Trambadia (OpenERP) <mtr@tinyerp.com> | 2011-09-16 11:11:38 +0530 |
| commit | d979aad3de95ae24aa1db52cf17c4eecf3d3ce6b (patch) | |
| tree | 592698c8e0dab53fcd157dd456a800bd4a80b5bf /addons/base_calendar/wizard | |
| parent | eea80125f7d1c739260929fb1f38866ef21439e1 (diff) | |
| parent | d101d3fbaaffe2d0219ac6cfeef50338a2501664 (diff) | |
[MERGE] branch merged with lp:openobject-addons
bzr revid: mtr@tinyerp.com-20110916054138-93b3caomaij5dyp4
Diffstat (limited to 'addons/base_calendar/wizard')
6 files changed, 3 insertions, 378 deletions
diff --git a/addons/base_calendar/wizard/__init__.py b/addons/base_calendar/wizard/__init__.py index 8b45dc18a17..cd0690b1dc0 100644 --- a/addons/base_calendar/wizard/__init__.py +++ b/addons/base_calendar/wizard/__init__.py @@ -19,9 +19,7 @@ # ############################################################################## -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.py b/addons/base_calendar/wizard/base_calendar_invite_attendee.py index 7d5b26026b5..a429db8e925 100644 --- a/addons/base_calendar/wizard/base_calendar_invite_attendee.py +++ b/addons/base_calendar/wizard/base_calendar_invite_attendee.py @@ -98,12 +98,12 @@ send an Email to Invited Person') user = user_obj.browse(cr, uid, user_id) res = { 'user_id': user_id, - 'email': user.address_id.email + 'email': user.user_email } res.update(ref) vals.append(res) - if user.address_id.email: - mail_to.append(user.address_id.email) + if user.user_email: + mail_to.append(user.user_email) elif type == 'external' and datas.get('email'): res = {'email': datas['email']} diff --git a/addons/base_calendar/wizard/base_calendar_set_exrule.py b/addons/base_calendar/wizard/base_calendar_set_exrule.py deleted file mode 100644 index 80fe1e44720..00000000000 --- a/addons/base_calendar/wizard/base_calendar_set_exrule.py +++ /dev/null @@ -1,163 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). -# -# 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 <http://www.gnu.org/licenses/>. -# -############################################################################## - -from base_calendar import base_calendar -from osv import fields, osv -from tools.translate import _ -import tools -import re - - -months = { - 1: "January", 2: "February", 3: "March", 4: "April", \ - 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", \ - 10: "October", 11: "November", 12: "December" -} - -class base_calendar_set_exrule(osv.osv_memory): - """ - Set Exrule. - """ - - _name = "base.calendar.set.exrule" - _description = "Set Exrule" - - _columns = { - 'freq': fields.selection([('None', 'No Repeat'), \ - ('secondly', 'Secondly'), \ - ('minutely', 'Minutely'), \ - ('hourly', 'Hourly'), \ - ('daily', 'Daily'), \ - ('weekly', 'Weekly'), \ - ('monthly', 'Monthly'), \ - ('yearly', 'Yearly')], 'Frequency',required=True), - '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'), - 'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \ - ('WE', 'Wednesday'), ('TH', 'Thursday'), \ - ('FR', 'Friday'), ('SA', 'Saturday'), \ - ('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'), - - } - - def view_init(self, cr, uid, fields, context=None): - """ - This function checks for precondition before wizard executes - @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 fields: List of fields for default value - @param context: A standard dictionary for contextual values - """ - if context is None: - context = {} - event_obj = self.pool.get(context.get('active_model')) - for event in event_obj.browse(cr, uid, context.get('active_ids', []), context=context): - if not event.rrule: - raise osv.except_osv(_("Warning !"), _("Please Apply Recurrency before applying Exception Rule.")) - return False - - def compute_exrule_string(self, cr, uid, ids, context=None): - """ - Compute rule string. - @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 - """ - - weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] - weekstring = '' - monthstring = '' - yearstring = '' - if context is None: - context = {} - ex_id = base_calendar.base_calendar_id2real_id(context.get('active_id', False)) - model = context.get('model', False) - model_obj = self.pool.get(model) - for datas in self.read(cr, uid, ids, context=context): - freq = datas.get('freq') - if freq == 'None': - model_obj.write(cr, uid, ex_id,{'exrule': ''}) - 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)) - if byday: - weekstring = ';BYDAY=' + ','.join(byday) - - elif freq == 'monthly': - if datas.get('select1')=='date' and (datas.get('day') < 1 or datas.get('day') > 31): - raise osv.except_osv(_('Error!'), ("Please select proper Day of month")) - if datas.get('select1')=='day': - monthstring = ';BYDAY=' + datas.get('byday') + datas.get('week_list') - elif datas.get('select1')=='date': - monthstring = ';BYMONTHDAY=' + str(datas.get('day')) - - elif freq == 'yearly': - if datas.get('select1')=='date' and (datas.get('day') < 1 or datas.get('day') > 31): - raise osv.except_osv(_('Error!'), ("Please select proper Day of month")) - bymonth = ';BYMONTH=' + str(datas.get('month_list')) - if datas.get('select1')=='day': - bystring = ';BYDAY=' + datas.get('byday') + datas.get('week_list') - elif datas.get('select1')=='date': - bystring = ';BYMONTHDAY=' + str(datas.get('day')) - yearstring = bymonth + bystring - - if datas.get('end_date'): - datas['end_date'] = ''.join((re.compile('\d')).findall(datas.get('end_date'))) + '235959Z' - enddate = (datas.get('count') and (';COUNT=' + str(datas.get('count'))) or '') +\ - ((datas.get('end_date') and (';UNTIL=' + datas.get('end_date'))) or '') - - exrule_string = 'FREQ=' + freq.upper() + weekstring + interval_srting \ - + enddate + monthstring + yearstring - - model_obj.write(cr, uid, ex_id,{'exrule': exrule_string}) - return {'type': 'ir.actions.act_window_close'} - - _defaults = { - 'freq': lambda *x: 'None', - 'select1': lambda *x: 'date', - 'interval': lambda *x: 1, - } - -base_calendar_set_exrule() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/base_calendar/wizard/base_calendar_set_exrule_view.xml b/addons/base_calendar/wizard/base_calendar_set_exrule_view.xml deleted file mode 100644 index 2a2d6412d4b..00000000000 --- a/addons/base_calendar/wizard/base_calendar_set_exrule_view.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - <record id="view_base_calendar_set_exrule" model="ir.ui.view"> - <field name="name">base.calendar.set.exrule.form</field> - <field name="model">base.calendar.set.exrule</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Set Exrule"> - <separator string="Select range to Exclude" colspan="8"/> - <group col="8" colspan="6"> - <field name="interval" /> - <field name="freq" /> - <field name="count" /> - <field name="end_date" /> - </group> - <group col="8" colspan="8" name="Select weekdays" - attrs="{'invisible' : [('freq','!=','weekly')]}"> - <field name="mo" colspan="1" /> - <field name="tu" colspan="1" /> - <field name="we" colspan="1" /> - <field name="th" colspan="1" /> - <field name="fr" colspan="1" /> - <field name="sa" colspan="1" /> - <field name="su" colspan="1" /> - <newline /> - </group> - <group col="8" colspan="6" - attrs="{'invisible' : [('freq','!=','monthly'), ('freq','!=','yearly')]}"> - <group col="2" colspan="1"> - <field name="select1" /> - </group> - <group col="2" colspan="1" - attrs="{'invisible' : [('select1','=','day')]}"> - <field name="day" - attrs="{'required' : [('select1','=','date')]}"/> - </group> - <group col="3" colspan="1" - attrs="{'invisible' : [('select1','=','date')]}"> - <field name="byday" string="The" - attrs="{'required' : [('select1','=','day')]}"/> - <field name="week_list" nolabel="1" - attrs="{'required' : [('select1','=','day')]}"/> - </group> - <group col="1" colspan="1" - attrs="{'invisible' : [('freq','!=','yearly')]}"> - <field name="month_list" string="of" - colspan="1" - attrs="{'required' : [('freq','=','yearly')]}"/> - </group> - </group> - <group colspan="4" col="6"> - <separator string="" colspan="8"/> - <label string="" colspan="2"/> - <button icon="gtk-cancel" special="cancel" string="_Cancel"/> - <button icon="gtk-ok" string="_Ok" name="compute_exrule_string" type="object"/> - </group> - </form> - </field> - </record> - - <record id="action_base_calendar_set_exrule" model="ir.actions.act_window"> - <field name="name">Set Exclude range</field> - <field name="res_model">base.calendar.set.exrule</field> - <field name="view_type">form</field> - <field name="view_mode">form,tree</field> - <field name="target">new</field> - </record> - - </data> -</openerp> diff --git a/addons/base_calendar/wizard/calendar_event_edit_all.py b/addons/base_calendar/wizard/calendar_event_edit_all.py deleted file mode 100644 index 23f67f579f2..00000000000 --- a/addons/base_calendar/wizard/calendar_event_edit_all.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). -# -# 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 <http://www.gnu.org/licenses/>. -# -############################################################################## - -from osv import osv -from osv import fields - -class calendar_event_edit_all(osv.osv_memory): - - def _default_values(self, cr, uid, context=None): - """ Get Default value for Start Date - @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 context: A standard dictionary for contextual values - @Return: Get Default value for Start Date - """ - context_id = context and context.get('active_id', False) or False - if context_id: - if context.get('date'): - return context.get('date') - else: - model = context.get('model', False) - model_obj = self.pool.get(model) - event = model_obj.read(cr, uid, context_id, ['name', 'location', 'alarm_id']) - return event['date'] - - def _default_deadline(self, cr, uid, context=None): - """ Get Default value for End Date - @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 context: A standard dictionary for contextual values - @return: Get Default value for End Date - """ - - context_id = context and context.get('active_id', False) or False - if context_id: - if context.get('date_deadline'): - return context.get('date_deadline') - else: - model = context.get('model', False) - model_obj = self.pool.get(model) - event = model_obj.read(cr, uid, context_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 - @return: dictionary {} - """ - if context is None: - context = {} - - context_id = context and context.get('active_id', False) or False - if context_id: - for datas in self.read(cr, uid, ids): - model = context.get('model', False) - model_obj = self.pool.get(model) - model_obj.modify_all(cr, uid, [context_id], datas, context=context) - return {'type': 'ir.actions.act_window_close'} - - _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 deleted file mode 100644 index 82f403e9254..00000000000 --- a/addons/base_calendar/wizard/calendar_event_edit_all_view.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - <record id="view_calendar_event_edit_all" model="ir.ui.view"> - <field name="name">calendar.event.edit.all.form</field> - <field name="model">calendar.event.edit.all</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Edit all Occurrences"> - <group colspan="4" > - <separator string="" colspan="4" /> - <newline/> - <field name='name' colspan="4" /> - <newline /> - <field name='location' colspan="4" /> - <newline /> - <field name='date' /> - <field name='date_deadline' /> - <newline /> - <field name='alarm_id'/> - </group> - <separator string="" colspan="4" /> - <group colspan="4" col="6"> - <button icon="gtk-cancel" special="cancel" string="Cancel"/> - <button icon="gtk-save" string="_Save" name="modify_this" type="object"/> - </group> - </form> - </field> - </record> - - <record id="action_calendar_event_edit_all" model="ir.actions.act_window"> - <field name="name">Edit all events</field> - <field name="res_model">calendar.event.edit.all</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form</field> - <field name="view_id" ref="view_calendar_event_edit_all"/> - <field name="target">new</field> - </record> - - </data> -</openerp> |
