diff --git a/inventree_supplier_panel/mouser.py b/inventree_supplier_panel/mouser.py index 358eabf..0b3abad 100644 --- a/inventree_supplier_panel/mouser.py +++ b/inventree_supplier_panel/mouser.py @@ -53,13 +53,15 @@ def get_mouser_partdata(self, sku, options): # ------------------------------- get_mouser_package -------------------------- # Extracts the available packages from the Mouser part data json def get_mouser_package(self, part_data): + + att_names = {'packaging': {'German': 'Verpackung', 'English': 'Packaging'}} package = '' try: attributes = part_data['ProductAttributes'] except Exception: return None for att in attributes: - if att['AttributeName'] == 'Verpackung': + if att['AttributeName'] == att_names['packaging'][self.get_setting('MOUSERLANGUAGE')]: package = package + att['AttributeValue'] + ', ' return (package) diff --git a/inventree_supplier_panel/supplier_panel.py b/inventree_supplier_panel/supplier_panel.py index ad3995c..69365a5 100644 --- a/inventree_supplier_panel/supplier_panel.py +++ b/inventree_supplier_panel/supplier_panel.py @@ -59,6 +59,13 @@ class SupplierCartPanel(PanelMixin, SettingsMixin, InvenTreePlugin, UrlsMixin): 'name': 'Mouser search API key', 'description': 'Place here your key for the Mouser search API', }, + 'MOUSERLANGUAGE': { + 'name': 'Mouser language', + 'description': 'The language that Mouser uses to answer your requests', + 'choices': [('English', 'Mouser answers in English'), + ('German', 'Mouser answers in German')], + 'default': 'German', + }, 'DIGIKEY_CLIENT_ID': { 'name': 'Digikey ID', 'description': 'Client ID for Digikey',