On 6.0, using in a form a O2M in tree mode results in a
You have to follow the following scenario
- Open the form on a record it should display the O2M in tree mode
- Go to the next record
- Go back to the list view of records
- Do a search
It will result in the following traceback:
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/screen_container.py", line 527, in activate
self.do_search(widget)
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/screen_container.py", line 530, in do_search
self.screen.search_filter(self.get_text())
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/screen/screen.py", line 317, in search_filter
self.clear()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/screen/screen.py", line 1150, in clear
self.group.clear()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/model/group.py", line 138, in clear
record.destroy()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/model/record.py", line 670, in destroy
v.destroy()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/model/group.py", line 521, in destroy
self.clear()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/model/group.py", line 138, in clear
record.destroy()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/model/record.py", line 670, in destroy
v.destroy()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/model/group.py", line 521, in destroy
self.clear()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/model/group.py", line 139, in clear
self.signal(
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/signal_event.py", line 15, in signal
fnct(self, signal_data, *data)
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/screen/screen.py", line 444, in _group_list_changed
view.group_list_changed(group, signal)
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/list.py", line 915, in group_list_changed
self.display()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/list.py", line 1033, in display
self.record = current_record
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/__init__.py", line 49, in record
self.screen.current_record = value
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/screen/screen.py", line 470, in __set_current_record
self.signal('record-message', (pos, len(self.group) + self.offset,
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/signal_event.py", line 15, in signal
fnct(self, signal_data, *data)
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 501, in _sig_label
self._set_button_sensitive()
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 276, in _set_button_sensitive
deletable = self.screen.deletable
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/screen/screen.py", line 157, in deletable
return all(r.deletable for r in self.selected_records)
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/screen/screen.py", line 1127, in selected_records
return self.current_view.selected_records if self.current_view else []
File "/home/nicoe/projets/tryton/old-repos/tryton-env/6.0/tryton/tryton/gui/window/view_form/view/list.py", line 1168, in selected_records
sel.selected_foreach(_func_sel_get, records)
AttributeError: 'NoneType' object has no attribute 'selected_foreach'
My interpretation was that there was a signal that was not correctly disconnected. Unfortunately, the signal between the Screen
and the Group
cannot be removed as it's used to update the screen when new records are added to the group.
I finally opted for a check on get_realized()
in https://foss.heptapod.net/tryton/tryton/-/blob/2513bd1a6b39ae78f27de2f58910ec223b022ea1/tryton/tryton/gui/window/view_form/view/list.py#L1167 but I may have missed a way to disconnect the signal at the right time.
Version 6.4 and onwards are not impacted because the signals have been removed.