Tryton - Issues

 

Issue7885

Title GTK-Client. Invalid tree path '0'
Priority bug Status resolved
Superseder Nosy List Timitos, ced, hbrandes, pokoli, reviewbot, risto3, roundup-bot, 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 roundup-bot.

Messages
New changeset 315e10b42d1b by Cédric Krier in branch '5.0':
Always display tree views to keep model up to date
https://hg.tryton.org/tryton/rev/315e10b42d1b
msg46639 (view) Author: [hidden] (risto3) Date: 2019-01-30.14:22:30
let me retract that, it appears that I updated all production clients but my own, only my dev client is updated. close until further notice
msg46638 (view) Author: [hidden] (risto3) Date: 2019-01-30.14:04:28
poppycock, as mentioned in the other PR, this project patchset is applied to my tree. Besides, the traceback is nearly identical (difference in gobject)

@  changeset:   6072:135048361208
|  branch:      5.0
|  tag:         tip
|  user:        Richard PALO <richard.palo@free.fr>
|  date:        Sat Jan 26 11:41:30 2019 +0100
|  summary:     Index: tryton/gui/window/nomodal.py
|
o  changeset:   6071:e37441ab0e27
|  branch:      5.0
|  parent:      6057:cea2b53096be
|  user:        Richard PALO <richard.palo@free.fr>
|  date:        Sat Jan 26 11:41:20 2019 +0100
|  summary:     invalid tree path trial fix
msg46614 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-01-30.11:21:23
More over your traceback shows you are running an installed 5.0.6 so clearly you do not have the patch.
msg46613 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-01-30.10:47:07
You do not know if it is related, so do not reopen issue.
msg46612 (view) Author: [hidden] (risto3) Date: 2019-01-30.10:44:39
not totally, we still see the following:

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

but it is after the a few of these:
File "/usr/lib/python3.7/site-packages/pygtkcompat/generictreemodel.py", line 65, in wrapped_func
    return func(*args, **kargs)
  File "/usr/lib/python3.7/site-packages/pygtkcompat/generictreemodel.py", line 302, in do_unref_node
    self.on_unref_node(self.get_user_data(iter))
  File "/usr/lib/python3.7/site-packages/pygtkcompat/generictreemodel.py", line 161, in get_user_data
    return _get_user_data_as_pyobject(iter)
  File "/usr/lib/python3.7/site-packages/pygtkcompat/generictreemodel.py", line 51, in _get_user_data_as_pyobject
    return ctypes.cast(citer.contents.user_data, ctypes.py_object).value 

Where this happened for us was in updating the tax accounts used in 'TVA Achat(Vente) de biens(services) Taux Normal'
New changeset 3aa697ba6e14 by Cédric Krier in branch 'default':
Always display tree views to keep model up to date
https://hg.tryton.org/tryton-env/rev/3aa697ba6e14
New changeset 9e9ae0cba1c3 by Cédric Krier in branch 'default':
Always display tree views to keep model up to date
https://hg.tryton.org/tryton/rev/9e9ae0cba1c3
msg46576 (view) Author: [hidden] (smarro) (Tryton translator) Date: 2019-01-29.22:04:50
Patch works ok
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-02-11 00:12:07roundup-botsetmessages: + msg46939
2019-01-30 14:22:30risto3setstatus: chatting -> resolved
messages: + msg46639
2019-01-30 14:04:28risto3setstatus: resolved -> chatting
messages: + msg46638
2019-01-30 11:21:28cedsetstatus: chatting -> resolved
2019-01-30 11:21:24cedsetstatus: resolved -> chatting
messages: + msg46614
2019-01-30 10:47:07cedsetstatus: chatting -> resolved
messages: + msg46613
2019-01-30 10:44:39risto3setstatus: resolved -> chatting
messages: + msg46612
2019-01-30 10:11:53roundup-botsetmessages: + msg46602
2019-01-30 10:11:47roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg46600
2019-01-29 22:04:50smarrosetmessages: + msg46576
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