summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2014-06-19 12:26:24 +0200
committerThibault Delavallée <tde@openerp.com>2014-06-19 12:26:24 +0200
commit3dcdd2180a044792cfb00a49809abc913266473e (patch)
tree36e443e5002a780bed97519e0e764aa005c5fd7b /addons
parent1a639ccd0397b49a7bde89a940a4712bac98e5b0 (diff)
[FIX] web_calendar: check for edit access rights + use correct display mode (view or edit) when going into a document form view from the calendar.
Diffstat (limited to 'addons')
-rw-r--r--addons/web_calendar/static/src/js/web_calendar.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js
index 6db2d97cfeb..ad49ff9a9b1 100644
--- a/addons/web_calendar/static/src/js/web_calendar.js
+++ b/addons/web_calendar/static/src/js/web_calendar.js
@@ -212,7 +212,12 @@ openerp.web_calendar = function(instance) {
this.info_fields.push(fv.arch.children[fld].attrs.name);
}
- return (new instance.web.Model(this.dataset.model))
+ var edit_check = new instance.web.Model(this.dataset.model)
+ .call("check_access_rights", ["write", false])
+ .then(function (write_right) {
+ self.write_right = write_right;
+ });
+ var init = new instance.web.Model(this.dataset.model)
.call("check_access_rights", ["create", false])
.then(function (create_right) {
self.create_right = create_right;
@@ -222,6 +227,7 @@ openerp.web_calendar = function(instance) {
self.ready.resolve();
});
});
+ return $.when(edit_check, init);
},
get_fc_init_options: function () {
@@ -834,7 +840,11 @@ openerp.web_calendar = function(instance) {
if (! this.open_popup_action) {
var index = this.dataset.get_id_index(id);
this.dataset.index = index;
- this.do_switch_view('form', null, { mode: "edit" });
+ if (this.write_right) {
+ this.do_switch_view('form', null, { mode: "edit" });
+ } else {
+ this.do_switch_view('form', null, { mode: "view" });
+ }
}
else {
var pop = new instance.web.form.FormOpenPopup(this);