Fix Pack Qty on Mouser, Fix Error on current dev iteration #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue I'm seeing on my inventree setup where pack sizes from Mouser are commonly being set to 1. I know that the pack size should be relative to how many parts are on a reel, and this change addresses this by using the Standard Pack Qty attribute provided by the API.
In addition to this, I fixed two bugs I found while working on the development version.
The first one relates to the supplier revision, it may be a dirty fix but python errors out because it thinks it's trying to change a variable that's outside the scope of the function without the use of a global declaration. As we want the variable to be in the function scope, this change initializes that variable in the function scope before attempting to assign the supplier search result to it.
The second bug seems to be a localization issue when pulling package types from Mouser. I do not know if Mouser returns localized key names in their API, but I had noticed that the package type was looking for a German localized JSON key name, and it was returning blank for my setup. This might be something that needs to be redone using inventree's localization functions, but again, I do not know if Mouser returns JSON keys in different languages.