diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index a8efc343420..d42096bbec9 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -19,13 +19,13 @@ # ############################################################################## -import hashlib import pytz import re import time import openerp import openerp.service.report import uuid +from werkzeug.exceptions import BadRequest from datetime import datetime, timedelta from dateutil import parser from dateutil import rrule @@ -34,7 +34,6 @@ from openerp import tools, SUPERUSER_ID from openerp.osv import fields, osv from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools.translate import _ -from openerp import http from openerp.http import request from operator import itemgetter @@ -870,6 +869,7 @@ class calendar_event(osv.Model): ] 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 ids: List of calendar event's IDs. @param start_date: Starting date @@ -888,14 +888,14 @@ class calendar_event(osv.Model): value['duration'] = duration if allday: # For all day event - start = datetime.strptime(start_date.split(' ')[0].split('T')[0], "%Y-%m-%d") - duration = 24.0 - value['duration'] = duration + start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S") user = self.pool['res.users'].browse(cr, uid, uid) tz = pytz.timezone(user.tz) if user.tz else pytz.utc start = pytz.utc.localize(start).astimezone(tz) # convert start in user's timezone start = start.astimezone(pytz.utc) # convert start back to utc - value['date'] = start.strftime("%Y-%m-%d") + ' 00:00:00' + + value['duration'] = 24.0 + value['date'] = datetime.strftime(start, "%Y-%m-%d %H:%M:%S") else: start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S") diff --git a/addons/calendar/calendar_demo.xml b/addons/calendar/calendar_demo.xml index 6880754cc56..9e0b44c89cb 100644 --- a/addons/calendar/calendar_demo.xml +++ b/addons/calendar/calendar_demo.xml @@ -6,20 +6,7 @@ --> - - Arshaw - - - fullcalendar@example.com - - - Second Demo User - Second Demo User - - - - - + @@ -105,8 +92,8 @@ - - + + Presentation of the new Calendar @@ -114,18 +101,7 @@ draft - - - - - - Discuss about the module : Calendar - - - - - draft - + diff --git a/addons/calendar/calendar_view.xml b/addons/calendar/calendar_view.xml index 01c4b596592..92e8b630f23 100644 --- a/addons/calendar/calendar_view.xml +++ b/addons/calendar/calendar_view.xml @@ -57,15 +57,15 @@ - ( + ( ) + /> @@ -121,7 +121,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -176,7 +176,7 @@ - + @@ -213,7 +213,7 @@ Meetings Calendar calendar.event - + @@ -248,14 +248,14 @@ - + - + - + @@ -267,8 +267,7 @@ calendar.event calendar,tree,form,gantt - - {"search_default_mymeetings": 1} + Click to schedule a new meeting. @@ -313,7 +312,7 @@ Meetings calendar.event form,calendar,tree,gantt - + diff --git a/addons/calendar/static/src/js/base_calendar.js b/addons/calendar/static/src/js/base_calendar.js index 0f5693eacbc..337895ee3d5 100644 --- a/addons/calendar/static/src/js/base_calendar.js +++ b/addons/calendar/static/src/js/base_calendar.js @@ -1,7 +1,7 @@ openerp.calendar = function(instance) { var _t = instance.web._t; var QWeb = instance.web.qweb; - instance.calendar = {} + instance.calendar = {}; instance.web.WebClient = instance.web.WebClient.extend({ @@ -11,8 +11,8 @@ openerp.calendar = function(instance) { get_next_notif: function() { var self= this; this.rpc("/calendar/notify") - .then( - function(result) { + .then( + function(result) { _.each(result, function(res) { setTimeout(function() { //If notification not already displayed, we add button and action on it @@ -21,25 +21,25 @@ openerp.calendar = function(instance) { res.message += QWeb.render("notify_footer"); a = self.do_notify(res.title,res.message,true); - $(".link2event").on('click', function() { + $(".link2event").on('click', function() { self.rpc("/web/action/load", { action_id: "calendar.action_calendar_event_notify", - }).then( function(r) { + }).then( function(r) { r.res_id = res.event_id; - return self.action_manager.do_action(r); - }); + return self.action_manager.do_action(r); + }); }); - a.element.find(".link2recall").on('click',function() { + a.element.find(".link2recall").on('click',function() { self.get_notif_box(this).find('.ui-notify-close').trigger("click"); - }); - a.element.find(".link2showed").on('click',function() { + }); + a.element.find(".link2showed").on('click',function() { self.get_notif_box(this).find('.ui-notify-close').trigger("click"); self.rpc("/calendar/notify_ack"); }); } //If notification already displayed in the past, we remove the css attribute which hide this notification else if (self.get_notif_box($.find(".eid_"+res.event_id)).attr("style") !== ""){ - self.get_notif_box($.find(".eid_"+res.event_id)).attr("style",""); + self.get_notif_box($.find(".eid_"+res.event_id)).attr("style",""); } },res.timer * 1000); }); @@ -48,7 +48,7 @@ openerp.calendar = function(instance) { }, check_notifications: function() { var self= this; - self.get_next_notif(); + self.get_next_notif(); setInterval(function(){ self.get_next_notif(); }, 5 * 60 * 1000 ); @@ -58,7 +58,7 @@ openerp.calendar = function(instance) { show_application: function() { this._super(); this.check_notifications(); - } + }, }); @@ -92,7 +92,7 @@ openerp.calendar = function(instance) { var reload_page = function(){ return location.replace(action_url); - } + }; reload_page(); }, @@ -108,7 +108,7 @@ openerp.calendar = function(instance) { }); }, map_tag: function(value){ - return _.map(value, function(el) {return {name: el[1], id:el[0], state: el[2]};}) + return _.map(value, function(el) {return {name: el[1], id:el[0], state: el[2]};}); }, get_render_data: function(ids){ var self = this; @@ -121,7 +121,7 @@ openerp.calendar = function(instance) { if (! self.get("effective_readonly")) { var tag_element = self.tags.tagElements(); _.each(data,function(value, key){ - $(tag_element[key]).find(".custom-edit").addClass(data[key][2]) + $(tag_element[key]).find(".custom-edit").addClass(data[key][2]); }); } } @@ -134,7 +134,7 @@ openerp.calendar = function(instance) { instance.session.session_bind(instance.session.origin).done(function () { new instance.calendar.invitation(null,db,action,id,view,attendee_data).appendTo($("body").addClass('openerp')); }); - } + };
Click to schedule a new meeting. @@ -313,7 +312,7 @@ Meetings calendar.event form,calendar,tree,gantt - +