summaryrefslogtreecommitdiff
path: root/addons/google_calendar/static/src/js
diff options
context:
space:
mode:
authorjke-openerp <jke@openerp.com>2013-12-02 15:31:33 +0100
committerjke-openerp <jke@openerp.com>2013-12-02 15:31:33 +0100
commit27a42cc6eb606cb353dba71a2c7be0e83eda89cf (patch)
treec11718b33230c6ba810e3929dd614179710fdd2c /addons/google_calendar/static/src/js
parent74d698f42f7c377d0f01595904c0c68851c030d1 (diff)
[IMP] google oAuth2 + start synchro calendar (insert ok, bug with recurrent)
bzr revid: jke@openerp.com-20131202143133-u6vi1xw1oa9w8qpf
Diffstat (limited to 'addons/google_calendar/static/src/js')
-rw-r--r--addons/google_calendar/static/src/js/calendar_sync.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/addons/google_calendar/static/src/js/calendar_sync.js b/addons/google_calendar/static/src/js/calendar_sync.js
new file mode 100644
index 00000000000..62639c6771f
--- /dev/null
+++ b/addons/google_calendar/static/src/js/calendar_sync.js
@@ -0,0 +1,40 @@
+/*---------------------------------------------------------
+ * OpenERP web_calendar
+ *---------------------------------------------------------*/
+
+openerp.google_calendar = function(instance) {
+ var _t = instance.web._t,
+ _lt = instance.web._lt;
+ var QWeb = instance.web.qweb;
+
+ instance.web_calendar.FullCalendarView.include({
+ view_loading: function(r) {
+ var self = this;
+ this.$el.on('click', 'div.oe_dhx_cal_sync_button', function() {
+ self.sync_calendar(r);
+ });
+ return this._super(r);
+ },
+ sync_calendar: function(res) {
+ var self = this;
+ var context = instance.web.pyeval.eval('context');
+ console.log("Model is..." + res.model);
+
+ self.rpc('/web_calendar_sync/sync_calendar/sync_data', {
+ arch: res.arch,
+ fields: res.fields,
+ model:res.model,
+ fromurl: window.location.href,
+ LocalContext:context
+ }).always(function(o) {
+ if (o.status == "NeedAuth") {
+ alert(_t("You will be redirected on gmail to authorize your OpenErp to access your calendar !"));
+ window.location = o.url;
+ }
+ console.log(o);
+ //self.reload();
+ });
+ }
+ });
+
+};