[IMP] added sync option in base_gengo wizard,do not show option in website_gengo
bzr revid: pga@tinyerp.com-20140321071438-kip2lkzlzvm0et7n
This commit is contained in:
parent
0660bf99af
commit
bc0a7cbc0c
|
@ -53,9 +53,12 @@ class base_gengo_translations(osv.osv_memory):
|
|||
_name = 'base.gengo.translations'
|
||||
_columns = {
|
||||
'restart_send_job': fields.boolean("Restart Sending Job"),
|
||||
'sync_type': fields.selection([('send', 'Send New Terms'),
|
||||
('receive', 'Receive Translation'),
|
||||
('both', 'Both')], "Sync Type"),
|
||||
'lang_id': fields.many2one('res.lang', 'Language', required=True),
|
||||
}
|
||||
|
||||
_defaults = {'sync_type' : 'both'}
|
||||
def gengo_authentication(self, cr, uid, context=None):
|
||||
'''
|
||||
This method tries to open a connection with Gengo. For that, it uses the Public and Private
|
||||
|
@ -117,8 +120,10 @@ class base_gengo_translations(osv.osv_memory):
|
|||
#send immediately a new request for the selected language (if any)
|
||||
ctx = context.copy()
|
||||
ctx['gengo_language'] = wizard.lang_id.id
|
||||
self._sync_request(cr, uid, limit=GENGO_DEFAULT_LIMIT, context=ctx)
|
||||
self._sync_response( cr, uid, limit=GENGO_DEFAULT_LIMIT, context=ctx)
|
||||
if wizard.sync_type in ['send','both']:
|
||||
self._sync_request(cr, uid, limit=GENGO_DEFAULT_LIMIT, context=ctx)
|
||||
if wizard.sync_type in ['receive','both']:
|
||||
self._sync_response( cr, uid, limit=GENGO_DEFAULT_LIMIT, context=ctx)
|
||||
#check the cron jobs and eventually restart/recreate them
|
||||
if wizard.restart_send_job:
|
||||
self.do_check_schedular(cr, uid, 'gengo_sync_send_request_scheduler', _('Gengo Sync Translation (Request)'), '_sync_request', context=context)
|
||||
|
|
|
@ -8,7 +8,14 @@
|
|||
<form string="Gengo Request Form" version="7.0">
|
||||
<group>
|
||||
<field name="lang_id"/>
|
||||
<field name="restart_send_job"/>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="sync_type" widget="radio"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="restart_send_job"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="act_update" string="Send" type="object" class="oe_highlight"/>
|
||||
|
|
|
@ -25,25 +25,34 @@
|
|||
},
|
||||
translation_gengo: function () {
|
||||
var self = this;
|
||||
var dialog = new website.GengoTranslatorDialog();
|
||||
dialog.appendTo($(document.body));
|
||||
self.gengo_translate = true;
|
||||
dialog.on('activate', this, function () {
|
||||
dialog.$el.modal('hide');
|
||||
self.translate().then(function () {
|
||||
self.gengo_translate = false;
|
||||
if($('.oe_translatable_todo').length > 0){
|
||||
self.$el.find('form.navbar-form.navbar-left > *').addClass("hidden");
|
||||
self.$el.find('.gengo_post,.gengo_info,.gengo_discard').removeClass("hidden");
|
||||
}
|
||||
else{
|
||||
self.$el.find('form.navbar-form.navbar-left > *').addClass("hidden");
|
||||
self.$el.find('.gengo_inprogress,.gengo_info,.gengo_discard').removeClass("hidden");
|
||||
|
||||
}
|
||||
if(!localStorage['website_gengo_nodialog']){
|
||||
var dialog = new website.GengoTranslatorDialog();
|
||||
dialog.appendTo($(document.body));
|
||||
self.gengo_translate = true;
|
||||
dialog.on('activate', this, function () {
|
||||
localStorage['website_gengo_nodialog'] = dialog.$('input[name=do_not_show]').prop('checked') || '';
|
||||
dialog.$el.modal('hide');
|
||||
self.translation_gengo_display()
|
||||
});
|
||||
}
|
||||
else{
|
||||
self.gengo_translate = true;
|
||||
self.translation_gengo_display()
|
||||
}
|
||||
},
|
||||
translation_gengo_display:function(){
|
||||
var self = this;
|
||||
self.translate().then(function () {
|
||||
self.gengo_translate = false;
|
||||
if($('.oe_translatable_todo').length > 0){
|
||||
self.$el.find('form.navbar-form.navbar-left > *').addClass("hidden");
|
||||
self.$el.find('.gengo_post,.gengo_info,.gengo_discard').removeClass("hidden");
|
||||
}
|
||||
else{
|
||||
self.$el.find('form.navbar-form.navbar-left > *').addClass("hidden");
|
||||
self.$el.find('.gengo_inprogress,.gengo_info,.gengo_discard').removeClass("hidden");
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
translation_gengo_post: function () {
|
||||
var self = this;
|
||||
|
@ -72,10 +81,12 @@
|
|||
openerp.jsonRpc('/website/set_translations', 'call', {
|
||||
'data': trans,
|
||||
'lang': website.get_context()['lang'],
|
||||
}).done(function(){
|
||||
}).then(function () {
|
||||
$('.oe_translatable_todo').addClass('oe_translatable_inprogress').removeClass('oe_translatable_todo');
|
||||
self.$el.find('.gengo_wait').addClass("hidden");
|
||||
self.$el.find('.gengo_inprogress,.gengo_discard').removeClass("hidden");
|
||||
}).fail(function () {
|
||||
alert("Could not Post translation");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
</section>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="pull-left">
|
||||
<input type="checkbox" name="do_not_show"/>
|
||||
Do not show this dialog later.
|
||||
</div>
|
||||
<button type="button" data-action="activate" class="btn btn-primary">Ok</button>
|
||||
or
|
||||
<a data-action="discard" data-dismiss="modal" href="#">Cancel</a>
|
||||
|
@ -57,10 +61,10 @@
|
|||
<div class="modal-body">
|
||||
<section>
|
||||
<select class="form-control" required="required" autofocus="autofocus">
|
||||
<option value="machine">Translation By Machine</option>
|
||||
<option value="standard">Standard</option>
|
||||
<option value="pro">Pro</option>
|
||||
<option value="ultra">Ultra</option>
|
||||
<option value="machine">Translation By Machine (Free)</option>
|
||||
<option value="standard">Standard - $0.05 per word</option>
|
||||
<option value="pro">Pro - $0.10 per word</option>
|
||||
<option value="ultra">Ultra - $0.15 per word</option>
|
||||
</select>
|
||||
</section>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue