From bc0a7cbc0c237fd3a7594e1b1d020d1f8e6dc1d6 Mon Sep 17 00:00:00 2001 From: "Parth Gajjar (Open ERP)" Date: Fri, 21 Mar 2014 12:44:38 +0530 Subject: [PATCH] [IMP] added sync option in base_gengo wizard,do not show option in website_gengo bzr revid: pga@tinyerp.com-20140321071438-kip2lkzlzvm0et7n --- .../wizard/base_gengo_translations.py | 11 +++-- .../wizard/base_gengo_translations_view.xml | 9 +++- .../static/src/js/website_gengo.js | 47 ++++++++++++------- .../static/src/xml/website.gengo.xml | 12 +++-- 4 files changed, 53 insertions(+), 26 deletions(-) diff --git a/addons/base_gengo/wizard/base_gengo_translations.py b/addons/base_gengo/wizard/base_gengo_translations.py index 9b96e8c91e3..bf35f46cec4 100644 --- a/addons/base_gengo/wizard/base_gengo_translations.py +++ b/addons/base_gengo/wizard/base_gengo_translations.py @@ -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) diff --git a/addons/base_gengo/wizard/base_gengo_translations_view.xml b/addons/base_gengo/wizard/base_gengo_translations_view.xml index 7b6be31d042..5a322ad3a60 100644 --- a/addons/base_gengo/wizard/base_gengo_translations_view.xml +++ b/addons/base_gengo/wizard/base_gengo_translations_view.xml @@ -8,7 +8,14 @@
- + + + + + + + +