sde1000 / quicktill

Figure out where all the money and stock went to
GNU General Public License v3.0
43 stars 8 forks source link

"Use Stock" from stockline popup crash #294

Closed sde1000 closed 1 month ago

sde1000 commented 1 month ago

Bob was trying to remove stock from sale from the festival stock lines, accessing the "Use Stock" function via the stock lines menu and the stock line detail popup.

Traceback:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/quicktill/till.py", line 299, in run
    ui_gtk.run(
  File "/usr/lib/python3/dist-packages/quicktill/ui_gtk.py", line 637, in run
    tillconfig.mainloop.iterate()
  File "/usr/lib/python3/dist-packages/quicktill/event_glib.py", line 23, in iterate
    raise self._exc_info[0].with_traceback(
  File "/usr/lib/python3/dist-packages/quicktill/ui_gtk.py", line 102, in _keypress
    ui.handle_raw_keyboard_input(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 108, in handle_raw_keyboard_input
    handle_keyboard_input(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 86, in handle_keyboard_input
    basicwin._focus.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 307, in hotkeypress
    self.parent.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 307, in hotkeypress
    self.parent.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 307, in hotkeypress
    self.parent.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/register.py", line 3357, in hotkeypress
    super().hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 411, in hotkeypress
    basicwin._focus.keypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 713, in keypress
    i[0]()
  File "/usr/lib/python3/dist-packages/quicktill/stocklines.py", line 397, in <lambda>
    lambda: ui.handle_keyboard_input(keyboard.K_USESTOCK),
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 86, in handle_keyboard_input
    basicwin._focus.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 307, in hotkeypress
    self.parent.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 307, in hotkeypress
    self.parent.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 307, in hotkeypress
    self.parent.hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/register.py", line 3357, in hotkeypress
    super().hotkeypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 411, in hotkeypress
    basicwin._focus.keypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/ui.py", line 723, in keypress
    self.parent.keypress(k)
  File "/usr/lib/python3/dist-packages/quicktill/stocklines.py", line 426, in keypress
    usestock.line_chosen(self.stockline)
  File "/usr/lib/python3/dist-packages/quicktill/usestock.py", line 59, in line_chosen
    sl = line.stockonsale
  File "/usr/lib/python3/dist-packages/sqlalchemy/orm/attributes.py", line 481, in __get__
    return self.impl.get(state, dict_)
  File "/usr/lib/python3/dist-packages/sqlalchemy/orm/attributes.py", line 941, in get
    value = self._fire_loader_callables(state, key, passive)
  File "/usr/lib/python3/dist-packages/sqlalchemy/orm/attributes.py", line 977, in _fire_loader_callables
    return self.callable_(state, passive)
  File "/usr/lib/python3/dist-packages/sqlalchemy/orm/strategies.py", line 862, in _load_for_state
    raise orm_exc.DetachedInstanceError(
sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <StockLine at 0x7f9e195794b0> is not bound to a Session; lazy load operation of attribute 'stockonsale' cannot proceed (Background on this error at: https://sqlalche.me/e/14/bhk3)