[FIX] Modifying default value for other than char/string/selection fields from 'Setting/Technical/Actions/User-defined Defaults' view sets wrong pickle value for respective record. (Maintenance Case: 607398)
lp bug: https://launchpad.net/bugs/1153628 fixed bzr revid: rgo@tinyerp.com-20140506055725-ryorjswf236plhlc
This commit is contained in:
commit
166b8efabb
|
@ -22,6 +22,7 @@ import pickle
|
|||
|
||||
from openerp.osv import osv, fields
|
||||
from openerp.osv.orm import except_orm
|
||||
from openerp.tools.safe_eval import safe_eval as eval
|
||||
|
||||
EXCLUDED_FIELDS = set((
|
||||
'report_sxw_content', 'report_rml_content', 'report_sxw', 'report_rml',
|
||||
|
@ -121,7 +122,10 @@ class ir_values(osv.osv):
|
|||
record = self.browse(cursor, user, id, context=context)
|
||||
if record.key == 'default':
|
||||
# default values are pickled on the fly
|
||||
value = pickle.dumps(value)
|
||||
try:
|
||||
value = isinstance(value, (str, unicode)) and pickle.dumps(eval(value)) or pickle.dumps(value)
|
||||
except Exception:
|
||||
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=None):
|
||||
|
|
Loading…
Reference in New Issue