From 7d36f54288a62aa7ea558b91a842bca0eedbe9c2 Mon Sep 17 00:00:00 2001
From: Martin Trigaux
Date: Thu, 8 May 2014 10:39:48 +0200
Subject: [PATCH 1/5] [FIX] account_analytic_analysis: revert method signature
change made at rev 9277
The additional parameters were made to avoid overwriting values when changing of template.
As we can not add parameters in only one module, we overwrite values only for not saved records.
This mitigates the overwrite while not changing the API.
bzr revid: mat@openerp.com-20140508083948-gkk7d1250a8znhlt
---
.../account_analytic_analysis.py | 9 ++++-----
.../account_analytic_analysis_view.xml | 3 ---
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index 6c71f940e8a..785d7cd6db0 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -542,18 +542,17 @@ class account_analytic_account(osv.osv):
'nodestroy': True,
}
- def on_change_template(self, cr, uid, ids, template_id, date_start=False, fix_price_invoices=False, invoice_on_timesheets=False, recurring_invoices=False, context=None):
+ def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
if not template_id:
return {}
- obj_analytic_line = self.pool.get('account.analytic.invoice.line')
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
template = self.browse(cr, uid, template_id, context=context)
- if not fix_price_invoices:
+ if not ids:
res['value']['fix_price_invoices'] = template.fix_price_invoices
res['value']['amount_max'] = template.amount_max
- if not invoice_on_timesheets:
+ if not ids:
res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
res['value']['hours_qtt_est'] = template.hours_qtt_est
@@ -561,7 +560,7 @@ class account_analytic_account(osv.osv):
res['value']['to_invoice'] = template.to_invoice.id
if template.pricelist_id.id:
res['value']['pricelist_id'] = template.pricelist_id.id
- if not recurring_invoices:
+ if not ids:
invoice_line_ids = []
for x in template.recurring_invoice_line_ids:
invoice_line_ids.append((0, 0, {
diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml
index 97fb15e9290..a6fe828926a 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml
+++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml
@@ -38,9 +38,6 @@
{'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]}
-
- on_change_template(template_id, date_start, fix_price_invoices, invoice_on_timesheets, recurring_invoices)
-
From dee000be14fd55f7d287eee8569f769505f339ac Mon Sep 17 00:00:00 2001
From: Cedric Snauwaert
Date: Fri, 9 May 2014 11:48:36 +0200
Subject: [PATCH 2/5] [FIX]modal: when closing a modal, focus previous one to
allow several escape hit key
bzr revid: csn@openerp.com-20140509094836-yhncaqp60od67w7k
---
addons/web/static/src/js/chrome.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index fca55957fd7..80851395520 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -46,6 +46,8 @@ instance.web.Notification = instance.web.Widget.extend({
}
});
+var opened_modal = [];
+
instance.web.action_notify = function(element, action) {
element.do_notify(action.params.title, action.params.text, action.params.sticky);
};
@@ -113,6 +115,8 @@ instance.web.Dialog = instance.web.Widget.extend({
this.init_dialog();
}
this.$buttons.insertAfter(this.$dialog_box.find(".modal-body"));
+ //add to list of currently opened modal
+ opened_modal.push(this.$dialog_box);
return this;
},
_add_buttons: function(buttons) {
@@ -212,9 +216,13 @@ instance.web.Dialog = instance.web.Widget.extend({
//we need this to put the instruction to remove modal from DOM at the end
//of the queue, otherwise it might already have been removed before the modal-backdrop
//is removed when pressing escape key
- var $parent = this.$el.parents('.modal');
setTimeout(function () {
- $parent.remove();
+ //remove last modal from list of opened modal since we just destroy it
+ opened_modal.pop().remove();
+ if (opened_modal.length > 0){
+ //we still have other opened modal so we should focus it
+ opened_modal[opened_modal.length-1].focus()
+ }
},0);
}
this._super();
From 67fb735b50b109dacbba9cf378806f1b74e8be37 Mon Sep 17 00:00:00 2001
From: Kersten Jeremy
Date: Fri, 9 May 2014 14:18:27 +0200
Subject: [PATCH 3/5] [FIX] Event - Allow to specify the timezone from the
event and use it in template mail.
bzr revid: jke@openerp.com-20140509121827-3ngkf93jhduobcoa
---
addons/event/email_template.xml | 2 +-
addons/event/event.py | 27 +++++++++++++++++++++++++--
addons/event/event_view.xml | 1 +
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/addons/event/email_template.xml b/addons/event/email_template.xml
index d99774acd3c..d4479bcfc87 100644
--- a/addons/event/email_template.xml
+++ b/addons/event/email_template.xml
@@ -9,7 +9,7 @@
Your registration at ${object.event_id.name}
Hello ${object.name},
- The event ${object.event_id.name} that you registered for is confirmed and will be held from ${object.event_id.date_begin} to ${object.event_id.date_end}.
+
The event ${object.event_id.name} that you registered for is confirmed and will be held from ${object.event_id.date_begin_located.strftime('%Y-%m-%d %H:%M:%S (%Z)')} to ${object.event_id.date_end_located.strftime('%Y-%m-%d %H:%M:%S (%Z)')}.
For any further information please contact our event department.
Thank you for your participation!
Best regards
]]>
diff --git a/addons/event/event.py b/addons/event/event.py
index 37efedf2549..9d86b6cc4e3 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -18,7 +18,8 @@
# along with this program. If not, see .
#
##############################################################################
-
+import pytz
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from datetime import datetime, timedelta
from openerp.osv import fields, osv
from openerp.tools.translate import _
@@ -150,6 +151,24 @@ class event_event(osv.osv):
continue
return res
+ def _compute_date_tz(self, cr, uid, ids, fld, arg, context=None):
+ if context is None:
+ context = {}
+ res = {}
+
+ print ids
+ for event in self.browse(cr, uid, ids, context=context):
+ res[event.id] = {}
+ context['tz'] = event.date_tz or 'UTC'
+ if fld == 'date_begin_located':
+ res[event.id] = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.date_begin, DEFAULT_SERVER_DATETIME_FORMAT), context=context)
+ elif fld == 'date_end_located':
+ res[event.id] = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.date_end, DEFAULT_SERVER_DATETIME_FORMAT), context=context)
+ return res
+
+ def _tz_get(self, cr, uid, context=None):
+ return [(x, x) for x in pytz.all_timezones]
+
_columns = {
'name': fields.char('Event Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}),
@@ -169,8 +188,11 @@ class event_event(osv.osv):
store={'event.registration': (_get_events_from_registrations, ['state'], 10),
'event.event': (lambda self, cr, uid, ids, c = {}: ids, ['seats_max', 'registration_ids'], 20)}),
'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}),
+ 'date_tz': fields.selection(_tz_get, string='Timezone'),
'date_begin': fields.datetime('Start Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'date_end': fields.datetime('End Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
+ 'date_begin_located': fields.function(_compute_date_tz, string='Start Date Located', type="datetime"),
+ 'date_end_located': fields.function(_compute_date_tz, string='End Date Located', type="datetime"),
'state': fields.selection([
('draft', 'Unconfirmed'),
('cancel', 'Cancelled'),
@@ -197,7 +219,8 @@ class event_event(osv.osv):
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'event.event', context=c),
'user_id': lambda obj, cr, uid, context: uid,
'organizer_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, context=c).company_id.partner_id.id,
- 'address_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, context=c).company_id.partner_id.id
+ 'address_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, context=c).company_id.partner_id.id,
+ 'date_tz': lambda self, cr, uid, ctx: ctx.get('tz', "UTC"),
}
def _check_seats_limit(self, cr, uid, ids, context=None):
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index 2cdb74bea5b..f608724c9a2 100644
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -83,6 +83,7 @@
+
From 0826340b8a761bec3ca5279a9537d8738f40ae1d Mon Sep 17 00:00:00 2001
From: Kersten Jeremy
Date: Fri, 9 May 2014 14:31:21 +0200
Subject: [PATCH 4/5] [FIX] Event - Don't update the context but a copy when we
recompute dates with the timezone specified for the event.
bzr revid: jke@openerp.com-20140509123121-xchv133t7gh0e5nh
---
addons/event/event.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/addons/event/event.py b/addons/event/event.py
index 9d86b6cc4e3..8021cce19ae 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -155,15 +155,13 @@ class event_event(osv.osv):
if context is None:
context = {}
res = {}
-
- print ids
for event in self.browse(cr, uid, ids, context=context):
- res[event.id] = {}
- context['tz'] = event.date_tz or 'UTC'
+ ctx = dict(context, tz=(event.date_tz or 'UTC'))
if fld == 'date_begin_located':
- res[event.id] = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.date_begin, DEFAULT_SERVER_DATETIME_FORMAT), context=context)
+ date_to_convert = event.date_begin
elif fld == 'date_end_located':
- res[event.id] = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.date_end, DEFAULT_SERVER_DATETIME_FORMAT), context=context)
+ date_to_convert = event.date_end
+ res[event.id] = fields.datetime.context_timestamp(cr, uid, datetime.strptime(date_to_convert, DEFAULT_SERVER_DATETIME_FORMAT), context=ctx)
return res
def _tz_get(self, cr, uid, context=None):
From 9e141c760c97af5a663ceacff4b7fdcfc5107acd Mon Sep 17 00:00:00 2001
From: Kersten Jeremy
Date: Fri, 9 May 2014 15:12:03 +0200
Subject: [PATCH 5/5] [FIX] Kanban / Modal - Close the backdrop from dialog
when we open the dialog for add a new column in kanban view. This bug was
introduced since with use bootstrap modal
bzr revid: jke@openerp.com-20140509131203-4gy3nhlj0v6fk7zv
---
addons/web_kanban/static/src/js/kanban.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js
index 1c87c453d7f..db4056167a7 100644
--- a/addons/web_kanban/static/src/js/kanban.js
+++ b/addons/web_kanban/static/src/js/kanban.js
@@ -205,10 +205,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
});
var am = instance.webclient.action_manager;
var form = am.dialog_widget.views.form.controller;
- form.on("on_button_cancel", am.dialog, am.dialog.close);
+ form.on("on_button_cancel", am.dialog, function() { return am.dialog.$dialog_box.modal('hide'); });
form.on('record_created', self, function(r) {
(new instance.web.DataSet(self, self.group_by_field.relation)).name_get([r]).done(function(new_record) {
- am.dialog.close();
+ am.dialog.$dialog_box.modal('hide');
var domain = self.dataset.domain.slice(0);
domain.push([self.group_by, '=', new_record[0][0]]);
var dataset = new instance.web.DataSetSearch(self, self.dataset.model, self.dataset.get_context(), domain);