Files
tryton/trytond/model/fields/property.py
T
Cédric Krier 66f0ada474 Allow to use related fields (many2one and reference) in read
Use rec_name function field instead of name_get and name_search
Remove get function on many2one field
Don't put record name in reference field
Handle rec_name in default_get so default value for many2one are now only id
2009-02-17 11:40:31 +01:00

25 lines
913 B
Python

#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from trytond.model.fields.function import Function
class Property(Function):
def __init__(self, **args):
super(Property, self).__init__('', **args)
self.readonly = False
def get(self, cursor, user, ids, model, name, values=None, context=None):
property_obj = model.pool.get('ir.property')
res = property_obj.get(cursor, user, name, model._name, ids,
context=context)
return res
def set(self, cursor, user, record_id, model, name, value, context=None):
property_obj = model.pool.get('ir.property')
return property_obj.set(cursor, user, name, model._name, record_id,
(value and (self.model_name or '') + ',' + str(value)) or False,
context=context)