[gen] While <obj>.<fieldName> allows to get the 'DB' value of some field, <obj>.getValue allows to get a variant of it, ie, the formatted version (via an internal call to field.getFormattedValue).
This commit is contained in:
parent
8aed007623
commit
71bc58a8b0
9 changed files with 67 additions and 36 deletions
|
@ -774,6 +774,17 @@ class AbstractWrapper(object):
|
|||
if custom: return custom(self, *args, **kwargs)
|
||||
|
||||
def getField(self, name): return self.o.getAppyType(name)
|
||||
|
||||
def getValue(self, name, formatted=False, language=None):
|
||||
'''Gets the formatted value of field p_name. If this formatting implies
|
||||
translating some element, translate them in p_langue, or in the user
|
||||
language if not specified.'''
|
||||
field = self.o.getAppyType(name)
|
||||
obj = self.o
|
||||
val = field.getValue(obj)
|
||||
if not formatted: return val
|
||||
return field.getFormattedValue(obj, val, language=language)
|
||||
|
||||
def getLabel(self, name, type='field'):
|
||||
'''Gets the translated label of field named p_name. If p_type is
|
||||
"workflow", p_name denotes a workflow state or transition, not a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue