Tryton - Issues

 

Issue7885

Title GTK-Client. Invalid tree path '0'
Priority bug Status testing
Superseder Nosy List Timitos, ced, hbrandes, pokoli, reviewbot, risto3, smarro
Type crash Components tryton
Assigned To ced Keywords review
Reviews 60491002
View: 60491002

Created on 2018-11-25.15:24:28 by hbrandes, last changed by reviewbot.

Messages
review60491002 updated at https://codereview.tryton.org/60491002/#ps1
msg45970 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-01-15.13:23:46
I identified that the bug was introduced by issue7363.
The GTK model of the treeview is not always the same as on the screen when save_tree_state is called (the previous group may be destroyed by Record.reset).
The easiest way to reproduce is to reload 2 times a form with a One2Many in form view.
As only tryton is affected (and not sao), I think it is fair to only fix tryton and keep the full optimization on sao.
Here is review60491002 which forces the display on all tree view in order to keep
msg45514 (view) Author: [hidden] (smarro) (Tryton translator) Date: 2018-12-28.00:43:01
I could reproduce the error:

File "/usr/local/lib/python3.5/dist-packages/tryton/gui/window/form.py", line 200, in sig_switch
    if not self.modified_save():
  File "/usr/local/lib/python3.5/dist-packages/tryton/gui/window/form.py", line 502, in modified_save
    self.screen.save_tree_state()
  File "/usr/local/lib/python3.5/dist-packages/tryton/gui/window/view_form/screen/screen.py", line 841, in save_tree_state
    widget.screen.save_tree_state(store)
  File "/usr/local/lib/python3.5/dist-packages/tryton/gui/window/view_form/screen/screen.py", line 851, in save_tree_state
    selected_paths = view.get_selected_paths()
  File "/usr/local/lib/python3.5/dist-packages/tryton/gui/window/view_form/view/list.py", line 1159, in get_selected_paths
    iter_ = model.get_iter(path)
  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 826, in get_iter
    raise ValueError("invalid tree path '%s'" % path)

Error message:
invalid tree path '0'
msg45405 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-12-20.11:55:17
Just pasting here the steps I received by email:

Hello,

sorry for the late answer. Because of the "random" occurance of the error, it has been very difficult to reproduce it.

On our instance, it is possible to reproduce the error by doing the following steps:
1) Open payment-terms configuration
2) Take on payment term and switch from tree to form
3) Change description
4) Change view of the payment term lines from tree to form
5) Change the remaining days
6) Save
7) Change again some values
8) Save
7) Switch back the global form to tree

For me, it seems that the switch back to the tree expect a state, which has been cleared after save.

In a test-environment, I inserted the lines

                if node == 0:
                    continue

In tryton/gui/window/view_form/view/list.py at line 1158 ( Client 5.0.3 ) in the method get_selected_paths
and could tested it without further problems - but I am not sure, if this is the right way, just to check for the error condition and go ahead.

Thank you and best regards
msg45382 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-12-18.00:19:57
Could you provide the exact error message because in your comment the quote are missing so I'm not sure that the value of the path is 0
msg45314 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-12-14.12:37:29
Could you please provide some steps to reproduce it?
msg45008 (view) Author: [hidden] (hbrandes) Date: 2018-11-25.15:24:27
Sometimes, when editing a formular and want to get back to the list, the GTK-client ( 5.0.2 ) creates an error: 'Invalid tree path 0'. The Stracktrace:

  File "/opt/projekte/Tryton/tryton5.0/tryton-5.0.0/tryton/gui/window/form.py", line 198, in sig_switch
    if not self.modified_save():
  File "/opt/projekte/Tryton/tryton5.0/tryton-5.0.0/tryton/gui/window/form.py", line 500, in modified_save
    self.screen.save_tree_state()
  File "/opt/projekte/Tryton/tryton5.0/tryton-5.0.0/tryton/gui/window/view_form/screen/screen.py", line 842, in save_tree_state
    widget.screen.save_tree_state(store)
  File "/opt/projekte/Tryton/tryton5.0/tryton-5.0.0/tryton/gui/window/view_form/screen/screen.py", line 852, in save_tree_state
    selected_paths = view.get_selected_paths()
  File "/opt/projekte/Tryton/tryton5.0/tryton-5.0.0/tryton/gui/window/view_form/view/list.py", line 1171, in get_selected_paths
    iter_ = model.get_iter(path)
  File "/usr/lib64/python3.7/site-packages/gi/overrides/Gtk.py", line 874, in get_iter
    raise ValueError("invalid tree path '%s'" % path)
History
Date User Action Args
2019-01-15 13:47:09reviewbotsetnosy: + reviewbot
messages: + msg45971
2019-01-15 13:23:47cedsetstatus: need-eg -> testing
reviews: 60491002
messages: + msg45970
keyword: + review
assignedto: ced
2018-12-28 00:43:02smarrosetmessages: + msg45514
2018-12-28 00:31:49smarrosetnosy: + smarro
2018-12-25 13:50:59risto3setnosy: + risto3
2018-12-20 11:55:17pokolisetmessages: + msg45405
2018-12-18 00:19:57cedsetstatus: chatting -> need-eg
nosy: + ced
messages: + msg45382
2018-12-14 12:37:29pokolisetstatus: unread -> chatting
nosy: + pokoli
messages: + msg45314
2018-12-14 10:32:39Timitossetnosy: + Timitos
2018-11-25 15:24:28hbrandescreate