fix default empy dict

This commit is contained in:
Matthias 2022-01-21 00:11:26 +01:00
parent b2eb4e131a
commit cbd84a23f9
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 6 additions and 2 deletions

View File

@ -315,7 +315,7 @@ def WrapWithQuotes(text, quote='"'):
return text 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. """ Generate a string for a barcode. Adds some global InvenTree parameters.
Args: Args:
@ -327,6 +327,8 @@ def MakeBarcode(object_name, object_pk, object_data={}, **kwargs):
Returns: Returns:
json string of the supplied data plus some other data json string of the supplied data plus some other data
""" """
if object_data is None:
object_data = {}
url = kwargs.get('url', False) url = kwargs.get('url', False)
brief = kwargs.get('brief', True) brief = kwargs.get('brief', True)

View File

@ -1022,7 +1022,7 @@ class StockItem(MPTTModel):
def has_tracking_info(self): def has_tracking_info(self):
return self.tracking_info_count > 0 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 Add a history tracking entry for this StockItem
@ -1033,6 +1033,8 @@ class StockItem(MPTTModel):
notes - User notes associated with this tracking entry notes - User notes associated with this tracking entry
url - Optional URL associated with this tracking entry url - Optional URL associated with this tracking entry
""" """
if deltas is None:
deltas = {}
# Has a location been specified? # Has a location been specified?
location = kwargs.get('location', None) location = kwargs.get('location', None)