[IMP] send user's company_id for link if api key not set

bzr revid: pga@tinyerp.com-20140326071057-fr76le4yr2yaiohq
This commit is contained in:
Parth Gajjar (Open ERP) 2014-03-26 12:40:57 +05:30
parent 744b4bb2b6
commit daed4c8c41
3 changed files with 10 additions and 20 deletions

View File

@ -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

View File

@ -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);
},

View File

@ -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">