From cbd84a23f95b967dbbb2d7df14edf1aa31cbc7cc Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 21 Jan 2022 00:11:26 +0100 Subject: [PATCH] fix default empy dict --- InvenTree/InvenTree/helpers.py | 4 +++- InvenTree/stock/models.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/helpers.py b/InvenTree/InvenTree/helpers.py index 3032b328bd..6dad393349 100644 --- a/InvenTree/InvenTree/helpers.py +++ b/InvenTree/InvenTree/helpers.py @@ -315,7 +315,7 @@ def WrapWithQuotes(text, quote='"'): return text -def MakeBarcode(object_name, object_pk, object_data={}, **kwargs): +def MakeBarcode(object_name, object_pk, object_data=None, **kwargs): """ Generate a string for a barcode. Adds some global InvenTree parameters. Args: @@ -327,6 +327,8 @@ def MakeBarcode(object_name, object_pk, object_data={}, **kwargs): Returns: json string of the supplied data plus some other data """ + if object_data is None: + object_data = {} url = kwargs.get('url', False) brief = kwargs.get('brief', True) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 140bd9c8e3..8a68eb5940 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -1022,7 +1022,7 @@ class StockItem(MPTTModel): def has_tracking_info(self): return self.tracking_info_count > 0 - def add_tracking_entry(self, entry_type, user, deltas={}, notes='', **kwargs): + def add_tracking_entry(self, entry_type, user, deltas=None, notes='', **kwargs): """ Add a history tracking entry for this StockItem @@ -1033,6 +1033,8 @@ class StockItem(MPTTModel): notes - User notes associated with this tracking entry url - Optional URL associated with this tracking entry """ + if deltas is None: + deltas = {} # Has a location been specified? location = kwargs.get('location', None)