[MERGE] Merge with saas-3-fix-filters-calendar-jke
Calendar ------------ Fix bug timezones Fix bug dashboards Fix bug filters bzr revid: jke@openerp.com-20140218133118-q67jr88oofvkw3nn
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
@@ -6,20 +6,7 @@
|
||||
-->
|
||||
|
||||
<!--For Meetings -->
|
||||
<record id="res_partner_another" model="res.partner">
|
||||
<field name="name">Arshaw</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="customer" eval="False"/>
|
||||
<field name="email">fullcalendar@example.com</field>
|
||||
</record>
|
||||
<record id="res_user_another" model="res.users">
|
||||
<field name="name" >Second Demo User</field>
|
||||
<field name="login" >Second Demo User</field>
|
||||
<field name="partner_id" ref="res_partner_another"/>
|
||||
<field name="company_id" ref="base.main_company" />
|
||||
</record>
|
||||
|
||||
<record id="cal_contact_1" model="calendar.contacts">
|
||||
<record id="cal_contact_1" model="calendar.contacts">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
@@ -105,8 +92,8 @@
|
||||
|
||||
<record id="calendar_event_7" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="user_id" ref="res_user_another"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('res_partner_another'),ref('base.res_partner_8')])]"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.res_partner_7')])]"/>
|
||||
<field name="name">Presentation of the new Calendar</field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-16 6:00:00')" name="date"/>
|
||||
@@ -114,18 +101,7 @@
|
||||
<field eval="8.5" name="duration"/>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_8" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="user_id" ref="res_user_another"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('res_partner_another'),ref('base.partner_root')])]"/>
|
||||
<field name="name">Discuss about the module : Calendar </field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-16 6:00:00')" name="date"/>
|
||||
<field eval="time.strftime('%Y-%m-16 18:30:00')" name="date_deadline"/>
|
||||
<field eval="8.5" name="duration"/>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -57,15 +57,15 @@
|
||||
<label for="duration"/>
|
||||
<div>
|
||||
<field name="duration" widget="float_time"
|
||||
on_change="onchange_dates(date,duration,False,allday)"
|
||||
on_change="onchange_dates(date, duration, False, allday)"
|
||||
class="oe_inline" attrs="{'invisible': [('allday','=',True)]}"/>
|
||||
<label string="hours" attrs="{'invisible': [('allday','=',True)]}"/>
|
||||
(<field name="allday" on_change="onchange_dates(date,False,False,allday)" class="oe_inline"/>
|
||||
(<field name="allday" class="oe_inline"/>
|
||||
<label for="allday" string="All Day?"/>)
|
||||
</div>
|
||||
<field name="date_deadline" groups="base.group_no_one"
|
||||
attrs="{'invisible': ['|', ('allday','=',True), ('duration','<', 24)]}"
|
||||
on_change="onchange_dates(date,False,date_deadline)"/>
|
||||
/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="categ_ids" widget="many2many_tags"/>
|
||||
@@ -121,7 +121,7 @@
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="class"/>
|
||||
<field name="show_as"/>
|
||||
<field name="rrule" invisible="1" readonly="0" />
|
||||
@@ -136,7 +136,7 @@
|
||||
<tree string="Invitation details" editable="top" create="false" delete="false">
|
||||
<field name="partner_id" />
|
||||
<field name="state" />
|
||||
<field name="email" widget="email"/>
|
||||
<field name="email" widget="email"/>
|
||||
|
||||
<button name="do_tentative" states="needsAction,declined,accepted" string="Uncertain" type="object" icon="terp-crm" />
|
||||
<button name="do_accept" string="Accept" states="needsAction,tentative,declined" type="object" icon="gtk-apply"/>
|
||||
@@ -176,7 +176,7 @@
|
||||
<field name="date" string="Start" />
|
||||
<field name="duration" string="Duration" widget="float_time" attrs="{'invisible': [('allday','=',True)]}"/>
|
||||
<field name="allday" class="oe_inline" attrs="{'invisible': [('allday','=',False)]}"/>
|
||||
<field name="partner_ids" widget="many2manyattendee" string="Attendees"/>
|
||||
<field name="partner_ids" widget="many2manyattendee" string="Attendees"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="categ_ids" widget="many2many_tags"/>
|
||||
@@ -213,7 +213,7 @@
|
||||
<field name="name">Meetings Calendar</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Meetings" date_start="date" date_stop="date_deadline" date_delay="duration" all_day="allday"
|
||||
display="[name]" color="color_partner_id" attendee="partner_ids" avatar_model="res.partner"
|
||||
use_contacts="True" event_open_popup="%(calendar.view_calendar_event_form_popup)s">
|
||||
@@ -248,14 +248,14 @@
|
||||
<field name="user_id"/>
|
||||
<field name="show_as"/>
|
||||
<field name="class" string="Privacy"/>
|
||||
<filter icon="terp-go-today" string="My Events" domain="[('user_id','=',uid)]" help="My Events"/>
|
||||
<filter icon="terp-go-today" string="My Events" domain="[('user_id','=',uid)]" help="My Events"/>
|
||||
<filter string="My Meetings" help="My Meetings" name="mymeetings" context='{"mymeetings": 1}'/>
|
||||
<filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/>
|
||||
<separator/>
|
||||
<separator/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Availability" icon="terp-camera_test" domain="[]" context="{'group_by':'show_as'}"/>
|
||||
<filter string="Privacy" icon="terp-locked" domain="[]" context="{'group_by':'class'}"/>
|
||||
<filter string="Privacy" icon="terp-locked" domain="[]" context="{'group_by':'class'}"/>
|
||||
<filter string="Event Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" help="Start Date of Event by Month"/>
|
||||
</group>
|
||||
</search>
|
||||
@@ -267,8 +267,7 @@
|
||||
<field name="res_model">calendar.event</field>
|
||||
<field name="view_mode">calendar,tree,form,gantt</field>
|
||||
<field name="view_id" ref="view_calendar_event_calendar"/>
|
||||
<field name="search_view_id" ref="view_calendar_event_search"/>
|
||||
<field name="context">{"search_default_mymeetings": 1}</field>
|
||||
<field name="search_view_id" ref="view_calendar_event_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to schedule a new meeting.
|
||||
@@ -313,7 +312,7 @@
|
||||
<field name="name">Meetings</field>
|
||||
<field name="res_model">calendar.event</field>
|
||||
<field name="view_mode">form,calendar,tree,gantt</field>
|
||||
<field name="view_id" ref="view_calendar_event_form"/>
|
||||
<field name="view_id" ref="view_calendar_event_form"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
@@ -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'));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user