Skip to content

Commit

Permalink
Fix plugin pickeling (#5412)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolflu05 authored Aug 9, 2023
1 parent af14cef commit 1fe382e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions InvenTree/plugin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def get_plugin_meta(name):
# Save plugin
self.plugin: InvenTreePlugin = plugin

def __getstate__(self):
"""Customize pickeling behaviour."""
state = super().__getstate__()
state.pop("plugin", None) # plugin cannot be pickelt in some circumstances when used with drf views, remove it (#5408)
return state

def save(self, force_insert=False, force_update=False, *args, **kwargs):
"""Extend save method to reload plugins if the 'active' status changes."""
reload = kwargs.pop('no_reload', False) # check if no_reload flag is set
Expand Down

0 comments on commit 1fe382e

Please sign in to comment.