[REF] base_gengo: misc code improvements made during code review
bzr revid: qdp-launchpad@openerp.com-20120829095022-i3fsdc0nvok78q25
This commit is contained in:
@@ -26,12 +26,7 @@ class ir_translation(osv.Model):
|
||||
_name = "ir.translation"
|
||||
_inherit = "ir.translation"
|
||||
_columns = {
|
||||
'gengo_comment': fields.text("Comments & Activity"),
|
||||
'gengo_translation': fields.boolean("Gengo Auto Translation ?", help='If checked the term will be translated by Gengo automatically.'),
|
||||
'gengo_control': fields.boolean('Gengo Traslated', help="If Term is translated using Gengo Service, the check box will be checked.", readonly=True),
|
||||
'gengo_comment': fields.text("Comments & Activity Linked to Gengo"),
|
||||
'job_id': fields.char('Gengo JobId', size=32),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'gengo_control': False,
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
<field name="inherit_id" ref="base.view_translation_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Translations">
|
||||
<filter icon="terp-project" string="In Progress" domain="[('state','=','inprogress')]"></filter>
|
||||
<filter string="To Control" domain="[('state','=','translated')]"></filter>
|
||||
<filter string="To Approve In Gengo" domain="[('state','=','inprogress'),('gengo_translation','=',True)]"></filter>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -20,12 +19,10 @@
|
||||
<field name="model">ir.translation</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form[@string='Translations']/sheet" position="inside">
|
||||
<group string="Gengo Comments & Activity" col="1">
|
||||
<field name="gengo_comment" nolabel="1" placeholder="Gengo Comments & Activity..."/>
|
||||
</group>
|
||||
<group col="4">
|
||||
<group string="Gengo Translation Service" col="4" colspan="4">
|
||||
<field name="gengo_translation" />
|
||||
<field name="gengo_control" />
|
||||
<label string="Note: If the translation state is 'In Progress', it means that the translation has to be approved to be uploaded in this system. You are suppose to do that directly by using your Gengo Account"/>
|
||||
<field name="gengo_comment" nolabel="1" placeholder="Gengo Comments & Activity..." colspan="4"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -65,7 +65,7 @@ CRON_VALS = {
|
||||
'numbercall': -1,
|
||||
'model': "'base.update.translations'",
|
||||
'function': "",
|
||||
'args': "'(20,)'",#not sure
|
||||
'args': "'(%s,)'" %s GENGO_DEFAULT_LIMIT,
|
||||
}
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ class base_update_translation(osv.osv_memory):
|
||||
model, res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base_gengo', xml_id)
|
||||
cron_pool.write(cr, uid, [res], {'active': True}, context=context)
|
||||
except:
|
||||
#the cron job was not found, probably deleted previously, so we create it again using default values
|
||||
CRON_VALS.update({'name': name, "function": fn})
|
||||
return cron_pool.create(cr, uid, CRON_VALS, context)
|
||||
|
||||
@@ -243,8 +244,7 @@ class base_update_translation(osv.osv_memory):
|
||||
continue
|
||||
if job_response['response']['job']['status'] == 'approved':
|
||||
vals.update({'state': 'translated',
|
||||
'value': job_response['response']['job']['body_tgt'],
|
||||
'gengo_control': True})
|
||||
'value': job_response['response']['job']['body_tgt'])
|
||||
up_term += 1
|
||||
job_comment = gengo.getTranslationJobComments(id=term.job_id)
|
||||
if job_comment['opstat']=='ok':
|
||||
|
||||
Reference in New Issue
Block a user