From daed4c8c41cf5e8a776241d8e9f0442febf4d87d Mon Sep 17 00:00:00 2001 From: "Parth Gajjar (Open ERP)" Date: Wed, 26 Mar 2014 12:40:57 +0530 Subject: [PATCH] [IMP] send user's company_id for link if api key not set bzr revid: pga@tinyerp.com-20140326071057-fr76le4yr2yaiohq --- addons/website_gengo/controllers/main.py | 6 ++--- .../static/src/js/website_gengo.js | 22 +++++-------------- .../static/src/xml/website.gengo.xml | 2 +- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/addons/website_gengo/controllers/main.py b/addons/website_gengo/controllers/main.py index 6bc2850253d..b8fc9c7d59b 100644 --- a/addons/website_gengo/controllers/main.py +++ b/addons/website_gengo/controllers/main.py @@ -16,7 +16,7 @@ class website_gengo(http.Controller): def check_gengo_set(self): ir_translation_obj = request.registry['res.users'] user = request.registry['res.users'].browse(request.cr, request.uid, request.uid) - flag = 1 + company_flag = 0 if not user.company_id.gengo_public_key or not user.company_id.gengo_private_key: - flag = 0 - return flag + company_flag = user.company_id.id + return company_flag diff --git a/addons/website_gengo/static/src/js/website_gengo.js b/addons/website_gengo/static/src/js/website_gengo.js index 92ae13d002f..ec7c47e8a5b 100644 --- a/addons/website_gengo/static/src/js/website_gengo.js +++ b/addons/website_gengo/static/src/js/website_gengo.js @@ -35,7 +35,7 @@ }); openerp.jsonRpc('/website/check_gengo_set', 'call', { }).then(function (res) { - if (res == 1){ + if (res == 0){ var dialog = new website.GengoTranslatorPostDialog(self.new_words); dialog.appendTo($(document.body)); dialog.on('service_level', this, function () { @@ -71,7 +71,7 @@ }); }); }else{ - var dialog = new website.GengoApiConfigDialog(); + var dialog = new website.GengoApiConfigDialog(res); dialog.appendTo($(document.body)); } }); @@ -117,20 +117,6 @@ 'hidden.bs.modal': 'destroy', }), template: 'website.GengoTranslatorStatisticDialog', - init:function(res){ - var self = this; - this.inprogess = 0; - this.new_words = 0; - this.done = res.done; - $('.oe_translatable_todo').each(function () { - self.new_words += $(this).text().trim().replace(/ +/g," ").split(" ").length; - }); - $('.oe_translatable_inprogress').each(function () { - self.inprogess += $(this).text().trim().replace(/ +/g," ").split(" ").length; - }); - this.total = this.done + this.inprogess; - return this._super.apply(this, arguments); - }, start: function (res) { this.$el.modal(this.res); }, @@ -140,6 +126,10 @@ 'hidden.bs.modal': 'destroy', }), template: 'website.GengoApiConfigDialog', + init:function(company_id){ + this.company_id = company_id; + return this._super.apply(this, arguments); + }, start: function (res) { this.$el.modal(this.res); }, diff --git a/addons/website_gengo/static/src/xml/website.gengo.xml b/addons/website_gengo/static/src/xml/website.gengo.xml index ea5be56bab7..717344bc3b3 100644 --- a/addons/website_gengo/static/src/xml/website.gengo.xml +++ b/addons/website_gengo/static/src/xml/website.gengo.xml @@ -116,7 +116,7 @@