summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParth Gajjar (Open ERP) <pga@tinyerp.com>2014-03-26 12:40:57 +0530
committerParth Gajjar (Open ERP) <pga@tinyerp.com>2014-03-26 12:40:57 +0530
commitdaed4c8c41cf5e8a776241d8e9f0442febf4d87d (patch)
treed9b4d20e1524dc72b6d13681601da36690c012bb
parent744b4bb2b62f29c661725998e8fa92197a5ac1f2 (diff)
[IMP] send user's company_id for link if api key not set
bzr revid: pga@tinyerp.com-20140326071057-fr76le4yr2yaiohq
-rw-r--r--addons/website_gengo/controllers/main.py6
-rw-r--r--addons/website_gengo/static/src/js/website_gengo.js22
-rw-r--r--addons/website_gengo/static/src/xml/website.gengo.xml2
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 @@
<div class="modal-body">
<b> <h3>Steps for configure a Gengo </h3>
<div class="mb16"> 1. Go To your <b><a target="new" href="https://gengo.com/account/api_settings/">gengo account</a></b> and generate API Keys.</div>
- <div class="mb16"> 2. Then copy generate keys in <a href="/web#return_label=Website&amp;model=res.company&amp;id=1">Your company data</a></div>
+ <div class="mb16"> 2. Then copy generate keys in <a target="new" t-att-href="'/web#return_label=Website&amp;model=res.company&amp;id='+widget.company_id">Your company data</a></div>
</b>
</div>
<div class="modal-footer">