Wizard does not refresh buttons states properly
Hello,
It's been awhile we noticed that buttons in the wizard dialog view are not properly updated when states are defined and depends on some fields of the StateView.
For instance:
I have a wizard with a single StateView. (Let's assume it is the start state).
here's the code:
start = StateView('some.state.view', 'module.some_state_view_form', [
Button('Next', 'next', 'tryton-go-next', default=True, states={'invisible': Bool(Eval('some_field_check'))})
])
So, as defined, the button 'Next' should be invisible if the value of the field 'some_field_check' is True.
The bug occurs when the field 'some_field_check' is updated with a on_change_with_some_field_check() method in the StateView.
The field is showed in the view and is correctly updated, but the Button does not change according to the new value.
I've debugged the client and found a solution, but i'm not sure of it:
It seems that Today, the buttons are updated on the WizardDialog class when record-modified is triggered. But at this time, all values are not yet updated, so buttons are updated without the new value of the some_field_check.
What I've done is to trigger the 'group-changed' signal instead of the 'record-modified' one in the WizardDialog and ensure in the Screen class that we correctly signal the event 'group-changed'.
I've attached the diff to the issue.
It seems to be working pretty well, but is it the right way to do it ?
Files
Download | Creator | Timestamp | Type |
---|---|---|---|
tryton.diff | @adrien.benduc | 2017-06-16 13:17:17.613000 UTC | text/plain |