[FIX] Export translations + Cache on translations + Resynchronization wizard Corrections
bzr revid: ach@tinyerp.com-20100512104249-pqdbofr2xikw59l9
This commit is contained in:
parent
8f81995ec8
commit
db035455a3
|
@ -150,8 +150,8 @@ class ir_translation(osv.osv):
|
|||
if not context:
|
||||
context = {}
|
||||
ids = super(ir_translation, self).create(cursor, user, vals, context=context)
|
||||
for trans_obj in self.read(cursor, user, [ids], ['name','type','res_id'], context=context):
|
||||
self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US'))
|
||||
for trans_obj in self.read(cursor, user, [ids], ['name','type','res_id','src','lang'], context=context):
|
||||
self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], trans_obj['lang'], source=trans_obj['src'])
|
||||
self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']])
|
||||
return ids
|
||||
|
||||
|
@ -159,16 +159,16 @@ class ir_translation(osv.osv):
|
|||
if not context:
|
||||
context = {}
|
||||
result = super(ir_translation, self).write(cursor, user, ids, vals, context=context)
|
||||
for trans_obj in self.read(cursor, user, ids, ['name','type','res_id'], context=context):
|
||||
self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US'))
|
||||
for trans_obj in self.read(cursor, user, ids, ['name','type','res_id','src','lang'], context=context):
|
||||
self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], trans_obj['lang'], source=trans_obj['src'])
|
||||
self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']])
|
||||
return result
|
||||
|
||||
def unlink(self, cursor, user, ids, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
for trans_obj in self.read(cursor, user, ids, ['name','type','res_id'], context=context):
|
||||
self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US'))
|
||||
for trans_obj in self.read(cursor, user, ids, ['name','type','res_id','src','lang'], context=context):
|
||||
self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], trans_obj['lang'], source=trans_obj['src'])
|
||||
self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']])
|
||||
result = super(ir_translation, self).unlink(cursor, user, ids, context=context)
|
||||
return result
|
||||
|
|
|
@ -1092,8 +1092,7 @@ class orm_template(object):
|
|||
if getattr(self._columns[f], arg, None):
|
||||
res[f][arg] = getattr(self._columns[f], arg)
|
||||
|
||||
#TODO: optimize
|
||||
res_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'field', context.get('lang', False) or 'en_US')
|
||||
res_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'field', context.get('lang', False) or 'en_US', self._columns[f].string)
|
||||
if res_trans:
|
||||
res[f]['string'] = res_trans
|
||||
help_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'help', context.get('lang', False) or 'en_US')
|
||||
|
@ -1708,7 +1707,8 @@ class orm_template(object):
|
|||
for lang in langs:
|
||||
for field in vals:
|
||||
if field in self._columns:
|
||||
self.pool.get('ir.translation')._set_ids(cr, uid, self._name+','+field, 'field', lang, [0], vals[field])
|
||||
src = self._columns[field].string
|
||||
self.pool.get('ir.translation')._set_ids(cr, uid, self._name+','+field, 'field', lang, [0], vals[field], src)
|
||||
for table in self._inherits:
|
||||
cols = intersect(self._inherit_fields.keys(), vals)
|
||||
if cols:
|
||||
|
|
|
@ -29,7 +29,7 @@ import sys
|
|||
|
||||
from datetime import datetime
|
||||
from lxml import etree
|
||||
|
||||
import time
|
||||
import ir
|
||||
import misc
|
||||
import netsvc
|
||||
|
@ -252,13 +252,13 @@ form: module.record_id""" % (xml_id,)
|
|||
if ids:
|
||||
self.pool.get(d_model).unlink(cr, self.uid, ids)
|
||||
self.pool.get('ir.model.data')._unlink(cr, self.uid, d_model, ids)
|
||||
|
||||
|
||||
def _remove_ir_values(self, cr, name, value, model):
|
||||
ir_value_ids = self.pool.get('ir.values').search(cr, self.uid, [('name','=',name),('value','=',value),('model','=',model)])
|
||||
if ir_value_ids:
|
||||
self.pool.get('ir.values').unlink(cr, self.uid, ir_value_ids)
|
||||
self.pool.get('ir.model.data')._unlink(cr, self.uid, 'ir.values', ir_value_ids)
|
||||
|
||||
|
||||
return True
|
||||
|
||||
def _tag_report(self, cr, rec, data_node=None):
|
||||
|
@ -278,7 +278,7 @@ form: module.record_id""" % (xml_id,)
|
|||
res['header'] = eval(rec.get('header','False'))
|
||||
if rec.get('report_type'):
|
||||
res['report_type'] = rec.get('report_type')
|
||||
|
||||
|
||||
res['multi'] = rec.get('multi') and eval(rec.get('multi','False'))
|
||||
|
||||
xml_id = rec.get('id','').encode('utf8')
|
||||
|
@ -355,7 +355,7 @@ form: module.record_id""" % (xml_id,)
|
|||
# Special check for wizard having attribute menu=False on update
|
||||
value = 'ir.actions.wizard,'+str(id)
|
||||
self._remove_ir_values(cr, string, value, model)
|
||||
|
||||
|
||||
def _tag_url(self, cr, rec, data_node=None):
|
||||
url = rec.get("string",'').encode('utf8')
|
||||
target = rec.get("target",'').encode('utf8')
|
||||
|
|
Loading…
Reference in New Issue