Tryton - Issues



Title Wizard does not refresh buttons states properly
Priority bug Status resolved
Superseder Nosy List adrien.benduc, ced, jcavallo, pokoli, roundup-bot
Type behavior Components tryton
Assigned To Keywords patch, review
Reviews 43421002
View: 43421002

Created on 2017-06-16.15:17:18 by adrien.benduc, last changed by roundup-bot.

File name Uploaded Type Edit Remove
tryton.diff adrien.benduc, 2017-06-16.15:17:17 text/plain
New changeset afb881b715be by Adrien in branch 'default':
Use group-changed to update wizard buttons states
msg34894 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-30.00:53:27
Indeed I think it is right to use group-changed instead of record-modified because  record-modified is often call earlier because the listener is not supposed to use the values. But group-changed is triggered by record-changed which is called when the field is really changed.
For sao, it is not affected because it is a behavior that is not yet implemented. There is a "TODO record-modified" in the code.

Finally, could you submit the patch following
msg34401 (view) Author: [hidden] (adrien.benduc) Date: 2017-07-03.18:24:28

Sorry I could not tell, I'm not using SAO.
msg34351 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-06-29.17:51:55
Is sao also affected?
msg34102 (view) Author: [hidden] (adrien.benduc) Date: 2017-06-16.15:17:17

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 ?
Date User Action Args
2017-10-29 00:48:13roundup-botsetstatus: chatting -> resolved
nosy: + roundup-bot
messages: + msg36597
2017-08-22 10:35:43adrien.benducsetreviews: 43421002
keyword: + review
2017-07-30 00:53:27cedsetnosy: + ced
messages: + msg34894
2017-07-03 18:24:28adrien.benducsetmessages: + msg34401
2017-06-29 17:51:55pokolisetstatus: unread -> chatting
nosy: + pokoli
messages: + msg34351
2017-06-19 12:02:00cedsettitle: tryton: Wizard does not refresh buttons states properly -> Wizard does not refresh buttons states properly
2017-06-19 11:58:25adrien.benducsetcomponent: + tryton
2017-06-16 15:17:18adrien.benduccreate

Showing 10 items. Show all history (warning: this could be VERY long)