Perhaps there are problems with the pyson evaluation of the fields.Function balanced…
Adding a default value of True
, the tree is no longer all red.
@classmethod
def view_attributes(cls):
return [
('/tree', 'visual',
If(((Eval('state') == 'draft') & ~Bool(Eval('balanced',True))),
'danger', '')),
]
from the console I compare ‘state’ with ‘balanced’:
>>> i.fields_get('balanced')
{'balanced': {'context': '{}', 'loading': 'lazy', 'name': 'balanced', 'on_change': [], 'on_change_with': [], 'readonly': True, 'required': False, 'states': '{}', 'type': 'boolean', 'domain': '[]', 'searchable': False, 'sortable': False, 'string': 'Balanced', 'help': '', 'create': True, 'delete': True}}
>>> i.fields_get('state')
{'state': {'context': '{}', 'loading': 'eager', 'name': 'state', 'on_change': [], 'on_change_with': [], 'readonly': True, 'required': True, 'states': '{}', 'type': 'selection', 'domain': '[]', 'searchable': True, 'sortable': True, 'string': 'État', 'help': '', 'selection': [('draft', 'Brouillon'), ('posted', 'Posté')], 'selection_change_with': [], 'sort': True, 'create': True, 'delete': True}}
Seemingly the only pertinent differences is that ‘balanced’ has lazy ‘loading’ and no searcher.