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

Batch code generation #7000

Merged

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat commented Apr 11, 2024

This PR implements a solution for #6098, namely allowing batch codes to be generated via a POST request to an API endpoint.

Any data provided to the request is made available to plugins, so a custom plugin could theoretically use this information for the purpose of batch code generation.

This also provides a solution for #6364 (at least in the new react interface), by adding a new useGenerator hook function that makes use of this new API endpoint.

Related Issues

Tasks

  • Maybe make the endpoint "generic" - allowing for future expansion on a single endpoint?
  • Extending form functionality to the "build order" forms
  • Auto generating batch codes wherever they are needed in the forms interface
  • Add a similar endpoint for generating serial numbers

Further Work

Further work could extend on this by:

  • Add a similar endpoint for generating internal part numbers
  • Add a similar endpoint for generating order codes (purchase / sales / build / return)

generators for serial numbers and internal part numbers would hook into existing plugins, allowing these plugins to seamlessly inject data into the front-end forms dynamically

Copy link

netlify bot commented Apr 11, 2024

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 6ab30dd
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/664b4e9041b3bf000956f492
😎 Deploy Preview https://deploy-preview-7000--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 86 (no change from production)
Best Practices: 92 (no change from production)
SEO: 70 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@SchrodingersGat SchrodingersGat added enhancement This is an suggested enhancement or new feature user interface User interface plugin Plugin ecosystem api Relates to the API Platform UI Related to the React based User Interface labels Apr 11, 2024
@SchrodingersGat SchrodingersGat added this to the 0.15.0 milestone Apr 11, 2024
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 59.14634% with 67 lines in your changes missing coverage. Please review.

Project coverage is 84.03%. Comparing base (5cb61d5) to head (6ab30dd).
Report is 299 commits behind head on master.

Files Patch % Lines
src/backend/InvenTree/stock/generators.py 28.00% 36 Missing ⚠️
src/backend/InvenTree/stock/api.py 60.00% 8 Missing ⚠️
src/frontend/src/forms/StockForms.tsx 60.00% 6 Missing and 2 partials ⚠️
...ee/plugin/samples/integration/validation_sample.py 14.28% 6 Missing ⚠️
src/frontend/src/forms/PurchaseOrderForms.tsx 0.00% 4 Missing ⚠️
src/frontend/src/hooks/UseGenerator.tsx 88.00% 1 Missing and 2 partials ⚠️
src/frontend/src/forms/BuildForms.tsx 66.66% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #7000    +/-   ##
========================================
  Coverage   84.03%   84.03%            
========================================
  Files        1054     1056     +2     
  Lines       46297    46443   +146     
  Branches     1326     1334     +8     
========================================
+ Hits        38905    39030   +125     
- Misses       7063     7077    +14     
- Partials      329      336     +7     
Flag Coverage Δ
backend 85.42% <53.27%> (-0.09%) ⬇️
pui 64.80% <70.17%> (+0.70%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; it seems like the API schema changed though - could you bump the API version?

Copy link
Contributor

@wolflu05 wolflu05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/frontend/src/hooks/UseGenerator.tsx Outdated Show resolved Hide resolved
SchrodingersGat and others added 2 commits April 12, 2024 17:00
Co-authored-by: Lukas <76838159+wolflu05@users.noreply.github.com>
@SchrodingersGat SchrodingersGat modified the milestones: 0.15.0, 0.16.0 May 12, 2024
@SchrodingersGat
Copy link
Member Author

Bumping this to the next release cycle, still some work to do here.

@SchrodingersGat SchrodingersGat merged commit e93d9c4 into inventree:master May 20, 2024
26 of 28 checks passed
@SchrodingersGat SchrodingersGat deleted the batch-code-generation branch May 20, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Relates to the API enhancement This is an suggested enhancement or new feature Platform UI Related to the React based User Interface plugin Plugin ecosystem user interface User interface
Projects
None yet
3 participants