Skip to content

Report printing refactor - #7074

Merged
SchrodingersGat merged 210 commits into
inventree:masterfrom
SchrodingersGat:pui-reports
May 22, 2024
Merged

SchrodingersGat merged 210 commits into
inventree:masterfrom
SchrodingersGat:pui-reports

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Apr 21, 2024 •

Copy link
Copy Markdown
Member

This PR presents a major refactoring of how we handle report templates. In particular, a lot of model duplication and API endpoint duplication is removed. This is a precursor to supporting reports in the new interface, and potentially expanding the functionality of the reporting framework into the future.

Note that this is a breaking change as we are removing a number of models, and also deleting a number of existing API endpoints

Related Issues

Features / Updates

  • Create new generic ReportTemplate database model
  • Migrate all existing report template tables into this new one
  • Reduce many report API endpoints to a single generic set

TODO

  • Refactor label printing models / API in a similar fashion
  • Commonize the "report context" data across labels / reports
  • Allow template table(s) to be filtered by "model type"
  • Update unit testing
  • Add playwright testing for report and label printing via web interface
  • Update documentation
  • Pull "context" data directly into the documentation from the codebase
  • Test that all CUI report printing functionality continues to function correctly
  • Test that all CUI label printing functionality continues to function correctly
  • Implement report printing in new PUI interface
  • Implement label printing in new PUI interface
  • refactor template editor in PUI to use new API
  • Update python bindings to support new API endpoints - New printing api inventree-python#226
  • Update python bindings again now that we have changed the plugin API - Update unit tests inventree-python#229
  • Update app to support new API endpoints - Label printing fix inventree-app#489
  • Update app again now that we have changed the plugin API - Print label key inventree-app#491
  • Refactor "include_installed" option for stock report
  • Refactor generate_filename method - ensure it works for reports and labels
  • Get label printing working again (label size is not observed)
  • Automatically add "default" label templates on launch
  • Automatically add "detault" report templates on launch
  • Ensure that both builtin "label printing" plugins still work
  • Reimplement / refactor API endpoints for "printing" labels and reports with proper serializers
  • Ensure backwards compatibility with existing label printer plugins
  • Perform full migration run to ensure old labels and templates are migrated correctly
  • Move templating db model mixin into report.mixins

@SchrodingersGat SchrodingersGat added enhancement This is an suggested enhancement or new feature plugin Plugin ecosystem report Report/Label generation api Relates to the API breaking Indicates a major update or change which breaks compatibility labels Apr 21, 2024
@SchrodingersGat SchrodingersGat added this to the 0.15.0 milestone Apr 21, 2024
@netlify

netlify Bot commented Apr 21, 2024 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 07ca9a1
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/664c91cbc22a470008493ca6
😎 Deploy Preview https://deploy-preview-7074--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: 99 (🔴 down 1 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 marked this pull request as draft April 21, 2024 14:04
@matmair

matmair commented Apr 21, 2024 •

Copy link
Copy Markdown
Member

Looks promising! I am still convinced that reports and labels should be the same thing but we have to start somewhere.

@codecov

codecov Bot commented Apr 21, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 78.76712% with 217 lines in your changes missing coverage. Please review.

Project coverage is 83.21%. Comparing base (921bf91) to head (07ca9a1).
Report is 320 commits behind head on master.

Files Patch % Lines
src/backend/InvenTree/report/api.py 76.56% 45 Missing ⚠️
...nTree/report/migrations/0026_auto_20240422_1301.py 50.87% 28 Missing ⚠️
...nTree/report/migrations/0023_auto_20240421_0455.py 44.44% 20 Missing ⚠️
...rontend/src/components/buttons/PrintingActions.tsx 58.69% 18 Missing and 1 partial ⚠️
src/backend/InvenTree/report/models.py 88.81% 16 Missing ⚠️
src/backend/InvenTree/report/apps.py 75.00% 12 Missing ⚠️
...mponents/editors/TemplateEditor/TemplateEditor.tsx 0.00% 11 Missing ⚠️
...s/editors/TemplateEditor/PdfPreview/PdfPreview.tsx 0.00% 8 Missing ⚠️
src/frontend/src/tables/settings/TemplateTable.tsx 63.63% 7 Missing and 1 partial ⚠️
src/backend/InvenTree/stock/models.py 68.42% 6 Missing ⚠️
... and 24 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7074      +/-   ##
==========================================
- Coverage   84.07%   83.21%   -0.87%     
==========================================
  Files        1056     1069      +13     
  Lines       46440    46854     +414     
  Branches     1334     1376      +42     
==========================================
- Hits        39046    38989      -57     
- Misses       7055     7508     +453     
- Partials      339      357      +18     
Flag Coverage Δ
backend 85.18% <82.10%> (-0.25%) ⬇️
pui 65.00% <60.25%> (-0.04%) ⬇️

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.

@SchrodingersGat

Copy link
Copy Markdown
Member Author

@wolflu05 @matmair last remaining hurdle is the failing playwright test. The test runs successfully but gets stuck on "teardown". Any ideas? Really struggling on this one.

@SchrodingersGat

Copy link
Copy Markdown
Member Author

@matmair @wolflu05 thanks for your help on this one. Merging in now, we have some time before 0.16.0 to work out any issues which may rise from such a significant diff.

@SchrodingersGat
SchrodingersGat merged commit aa39582 into inventree:master May 22, 2024
@SchrodingersGat
SchrodingersGat deleted the pui-reports branch May 22, 2024 00:17
@matmair

matmair commented May 22, 2024

Copy link
Copy Markdown
Member

Should we maybe open a follow up issue with all the future ideas for this area that were voiced here?

@SchrodingersGat

Copy link
Copy Markdown
Member Author

Should we maybe open a follow up issue with all the future ideas for this area that were voiced here?

Yes I think that's a great idea

@tristanle22

Copy link
Copy Markdown
Contributor

Hello, any chance of this update being included in the near future releases, along with #9532?

@SchrodingersGat

Copy link
Copy Markdown
Member Author

@tristanle22 we are working hard on the final issues before our next release - not many to go now: https://github.com/inventree/InvenTree/milestone/17

All merged features will be available as part of that release.

@tristanle22

Copy link
Copy Markdown
Contributor

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility enhancement This is an suggested enhancement or new feature plugin Plugin ecosystem report Report/Label generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report Generation for new interface Refactor tables and API for reports and labels

4 participants