bzr revid: fp@tinyerp.com-20090406123517-edduwnx871b4q5pc
This commit is contained in:
Fabien Pinckaers
2009-04-06 14:35:17 +02:00
5 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ class ir_values(osv.osv):
if self.CONCURRENCY_CHECK_FIELD in ctx:
del ctx[self.CONCURRENCY_CHECK_FIELD]
if not self.browse(cursor, user, id, context=context).object:
value = pickle.dumps(eval(value))
value = pickle.dumps(value)
self.write(cursor, user, id, {name[:-9]: value}, context=ctx)
def onchange_object_id(self, cr, uid, ids, object_id, context={}):
+1 -1
View File
@@ -166,7 +166,7 @@ class res_partner(osv.osv):
}
def copy(self, cr, uid, id, default=None, context={}):
name = self.read(cr, uid, [id], ['name'])[0]['name']
default.update({'name': name+' (copy)'})
default.update({'name': name+' (copy)', 'events':[]})
return super(res_partner, self).copy(cr, uid, id, default, context)
def _check_ean_key(self, cr, uid, ids):
+2
View File
@@ -626,12 +626,14 @@ class function(_column):
# convert the data returned by the function with the size of that data...
res = dict(map(lambda (x, y): (x, tools.human_size(len(y or ''))), res.items()))
return res
get_memory = get
def set(self, cr, obj, id, name, value, user=None, context=None):
if not context:
context = {}
if self._fnct_inv:
self._fnct_inv(obj, cr, user, id, name, value, self._fnct_inv_arg, context)
set_memory = set
# ---------------------------------------------------------
# Related fields
+3 -1
View File
@@ -181,12 +181,14 @@ class browse_record(object):
fffields = map(lambda x: x[0], ffields)
datas = self._table.read(self._cr, self._uid, ids, fffields, context=self._context, load="_classic_write")
if self._fields_process:
lang = self._context.get('lang', 'en_US') or 'en_US'
lang_obj = self.pool.get('res.lang').browse(self._cr, self._uid,self.pool.get('res.lang').search(self._cr, self._uid,[('code','=',lang)])[0])
for n, f in ffields:
if f._type in self._fields_process:
for d in datas:
d[n] = self._fields_process[f._type](d[n])
if d[n]:
d[n].set_value(self._cr, self._uid, d[n], self, f)
d[n].set_value(self._cr, self._uid, d[n], self, f, lang_obj)
# create browse records for 'remote' objects
+2 -8
View File
@@ -132,18 +132,12 @@ _LOCALE2WIN32 = {
}
class _format(object):
def set_value(self, cr, uid, name, object, field):
def set_value(self, cr, uid, name, object, field, lang_obj):
#super(_date_format, self).__init__(self)
pool_lang = pooler.get_pool(cr.dbname).get('res.lang')
self.object = object
self._field = field
self.name = name
lang = self.object._context.get('lang', 'en_US') or 'en_US'
lids = pool_lang.search(cr, uid,[('code','=',lang)])
if lids:
self.lang_obj = pool_lang.browse(cr, uid,lids[0])
else:
self.lang_obj = False
self.lang_obj = lang_obj
class _float_format(float, _format):