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
Part import #1588
Part import #1588
Conversation
@eeintech would you mind taking a look at this? I tried making the html-implementation a bit simpler. |
@matmair I pulled your branch and here are my thoughts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like those improvements, I'm wondering if we can get them into the more generic implementation of the FileManagementFormView
with associated templates so we can re-use them in all places with import option?
The environment in which I plan to use InvenTree has multiple teams. I do not want these teams - which will add a lot of parts - to use the admin. There are a lot of options which will confuse the user. We could but a permission-flag on that function.
That is something I am working on, is a result of how headers are configured and used.
I would like to keep it simple and only human-ready at first. manly see this feature used to import an extended BOM to quickly get stuff going and keep the barrier of entry low.
Absolutely, I just wanted you to check how I did it first and gauge if the way I went is something you approve of. I try to not mess with others features. |
I understand your use-case. However keep in mind that we don't use InvenTree for the same thing. So for me this function should be hidden somewhere, not in clear view. Staff users have access to InvenTree global settings so I would suggest to move it there, in the |
So a permission for parts-import would solve that? The normal users would not see the button but team leads for example would. Putting stuff into settings manly means people will be asking a lot where the function is in my experience. @SchrodingersGat do you prefer a position for this? |
I think that it makes sense to have it in the "parts settings" page - a little bit separate to the everyday views |
@SchrodingersGat I fixed all modal-dialog points you brought up, could you confirm if there is a bug with category-matching? |
@matmair I'll try to have another look at this ASAP - I don't want you to think I'm ignoring this but very busy ATM ! |
@matmair I've played around with this again and found a few more issues. I can enumerate these if you like. However after some more thinking I wonder if we are approaching this the wrong way. We already rely on the django-import-export library which does a LOT of the heavy lifting for us. It is very good at validation of fields, and the import workflow can be highly customized: https://django-import-export.readthedocs.io/en/latest/import_workflow.html I think that we should look at leveraging For example, the import screen in the admin interface is "most" of the way there already: I would argue that the error / warning messages provided here are already very good:
For the BOM importer example, we could potentially extend the functionality that exists in django-import-export to do things like:
The implementation here still seems rough around the edges, and I feel it still has quite a way to go in terms of data validation and edge cases (and I think this is where django-import-export excels). What are your thoughts? I am not sure yet if django-import-export can be operated from "outside" the admin context - this would be crucial I think? Another option, which might actually not be too bad, is to expand general use of the admin interface itself. For operations which are seldom used (bulk imports for example) perhaps we are much better served polishing the tools that are already there, instead of recreating the wheel. This PR already feels like we are basically re-inventing what's already present in the admin interface... Let me know what you think. @eeintech too I appreciate that this comes after a lot of work - sorry! |
@SchrodingersGat you are the maintainer - your call. I will respect that. import-export is really rigid about input-formatting and user-configurable imports could be a great value add - esp. in environments where you do not want / can't make users admins to use the admin-area import-functions or the user-base is not used to fixing a table in Excel. Does your comment regard all wizards or just part-imports? In the latter case I would try to cherry-pick the general improvements in this PR an make a new one without the part-import-stuff. |
@SchrodingersGat It's funny you brought that up, I did look into the Now for import operations altering directly the target table (import part directly alters the In summary I would propose to keep the |
@eeintech I would be happy to cherry-pick that stuff but will wait till there is a clear statment if the components even will be used |
True that django-import-export has some limitations. I am reluctant to have "two solutions" to the same problem if we can help it, but maybe we can't help it. I've just come across this project - https://github.com/wq/django-data-wizard - which may be another interesting option. I have not yet had time to fully look into it. I am just concerned that we are boxing ourselves into maintaining a complex data importer tool when (potentially) there's something out there that does most of the work for us (and has other people using and validating it too!) |
I have looked at many projects, packages, etc. before jumping into the purchase order importer wizard but have not came across |
@eeintech you're definitely right to be concerned about the maintenance issues of the library. I think that perhaps "rolling our own" is the best approach here after all. Given the complex interactions of the various models I think it is going to be easier to write something that takes the particular requirements into account... I've had a more thorough look around this evening and cannot find another library that looks "perfect"... @matmair can you please fix the conflicts that have crept in and I'll have another look |
@SchrodingersGat should we just merge the whole thing or split it up into feature branches? You mentioned several errors above so I think that could make merging and testing simpler. |
I think merge the whole thing. It's pretty close to being good. |
@eeintech @SchrodingersGat mind checking if I missed an issue / Bug? The merge was pretty simple but better check twice before merging. |
@matmair sorry looks like a conflict has snuck in - please address this and I'll have a final look |
Thanks @matmair for your great work here. Happy to merge this in now. Please submit a documentation PR when you have a chance. |
Adds reference to inventree/InvenTree#1588
Enables Import of parts building on the great additions of @eeintech in #1561.
Missing:
updating of parts? Maybe out of scope