Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pack Qty on Mouser, Fix Error on current dev iteration #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MrARM
Copy link

@MrARM MrARM commented Dec 20, 2024

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.

@SergeoLacruz
Copy link
Owner

Thanks for the contribution. I spent hours on those localization things. Mouser ALWAYS sends back those German strings
to me as I am located here. Obviously they send an English string to you. I did not find a way to change that. The language
of the answer is even not mentioned in the answer. This cannot be fixed using the InvenTree language settings.
The only solution I see is to add a setting to the plugin to select the Mouser answer language. This is easy for German end English but what else...
I will have a look at the rest.

@SergeoLacruz
Copy link
Owner

We use the "Mult" value for pack size as this is the minimum quantity you can order from the supplier. This is usually one, sometimes more. The "Standard Pack Qty" is what the manufacturer delivers to the supplier and might by much larger.
When pack size in InvenTree is set to 250 you cannot order less in an InventTree order.
Digikey uses different SKU for a full reel.

@MrARM
Copy link
Author

MrARM commented Dec 23, 2024

We use the "Mult" value for pack size as this is the minimum quantity you can order from the supplier. This is usually one, sometimes more. The "Standard Pack Qty" is what the manufacturer delivers to the supplier and might by much larger. When pack size in InvenTree is set to 250 you cannot order less in an InventTree order. Digikey uses different SKU for a full reel.

I see. It could be integrated into an option to use one or the other. We are moving from an inventory system that used the reel sizes and we don't typically order cut tape, so that's the reasoning behind that. I'll work on getting those options built out.

@SergeoLacruz
Copy link
Owner

I think we definitely need an option for the Mouser answering language. Having die German string fixed on the source is a bad idea. We have the German and the English answer so far. We cannot bind this to the InvenTree language setting because you can use English setting in Germany.

@SergeoLacruz
Copy link
Owner

I added a setting that allows to set the answer language of Mouser. That solves at least one problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants