fix: browserView getData setting for boolean field
This commit is contained in:
parent
17e86e64c7
commit
9e8ba76461
3 changed files with 13 additions and 2 deletions
|
@ -334,7 +334,7 @@ class EmailFieldInstance(FieldInstance):
|
||||||
class BooleanFieldInstance(FieldInstance):
|
class BooleanFieldInstance(FieldInstance):
|
||||||
|
|
||||||
def marshall(self, value):
|
def marshall(self, value):
|
||||||
return value
|
return bool(value)
|
||||||
|
|
||||||
def display(self, value):
|
def display(self, value):
|
||||||
#return value and _(u'Yes') or _(u'No')
|
#return value and _(u'Yes') or _(u'No')
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Instance(BaseInstance):
|
||||||
fi = f.getFieldInstance(self, context=kw.get('context'),
|
fi = f.getFieldInstance(self, context=kw.get('context'),
|
||||||
request=kw.get('request'))
|
request=kw.get('request'))
|
||||||
name = f.name
|
name = f.name
|
||||||
value = getattr(self.context, name) or fi.default
|
value = getattr(self.context, name, fi.default)
|
||||||
if mode in ('view', 'preview'):
|
if mode in ('view', 'preview'):
|
||||||
value = fi.display(value)
|
value = fi.display(value)
|
||||||
else:
|
else:
|
||||||
|
|
11
util/date.py
11
util/date.py
|
@ -65,3 +65,14 @@ def year(d=None):
|
||||||
if d is None:
|
if d is None:
|
||||||
d = datetime.today()
|
d = datetime.today()
|
||||||
return d.year
|
return d.year
|
||||||
|
|
||||||
|
def month(d=None):
|
||||||
|
if d is None:
|
||||||
|
d = datetime.today()
|
||||||
|
return d.month
|
||||||
|
|
||||||
|
def day(d=None):
|
||||||
|
if d is None:
|
||||||
|
d = datetime.today()
|
||||||
|
return d.day
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue