diff --git a/inventree_kicad/KiCadLibraryPlugin.py b/inventree_kicad/KiCadLibraryPlugin.py index 4d8a4bd..25cc4e3 100644 --- a/inventree_kicad/KiCadLibraryPlugin.py +++ b/inventree_kicad/KiCadLibraryPlugin.py @@ -66,8 +66,8 @@ class KiCadLibraryPlugin(UrlsMixin, AppMixin, SettingsMixin, SettingsContentMixi }, 'KICAD_ENABLE_STOCK_COUNT_FORMAT': { 'name': _('Display Format for Stock Count'), - 'description': _('This will be displayed after the part\'s name in KiCad (left column).'), - 'default': ">> In Stock: %s" + 'description': _('This will be displayed after the part\'s description in KiCad (right column). Note: {1} contains the Stock information, {0} the description of the part.'), + 'default': "[Stock: {1}] >> {0}" }, 'DEFAULT_FOR_MISSING_SYMBOL': { 'name': _('Backup KiCad Symbol'), diff --git a/inventree_kicad/serializers.py b/inventree_kicad/serializers.py index e432f65..a786185 100644 --- a/inventree_kicad/serializers.py +++ b/inventree_kicad/serializers.py @@ -410,9 +410,9 @@ def __init__(self, *args, **kwargs): id = serializers.CharField(source='pk', read_only=True) - name = serializers.SerializerMethodField('get_name') + description = serializers.SerializerMethodField('get_description') - def get_name(self, part): + def get_description(self, part): """Custom name function. This will allow users to display stock information @@ -420,7 +420,7 @@ def get_name(self, part): """ if str2bool(self.plugin.get_setting('KICAD_ENABLE_STOCK_COUNT', False)): - return f'{part.name} {self.plugin.get_setting("KICAD_ENABLE_STOCK_COUNT_FORMAT", "(%)") % (decimal2string(part.get_stock_count()))}' + return self.plugin.get_setting("KICAD_ENABLE_STOCK_COUNT_FORMAT", "[Stock: {1}] >> {0}").format(part.description, decimal2string(part.get_stock_count())) return part.name diff --git a/inventree_kicad/version.py b/inventree_kicad/version.py index 2797394..c46d881 100644 --- a/inventree_kicad/version.py +++ b/inventree_kicad/version.py @@ -1 +1 @@ -KICAD_PLUGIN_VERSION = "1.3.20" +KICAD_PLUGIN_VERSION = "1.3.21"