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

SalesOrder migration unit test #8814

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

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed order Related to purchase orders / sales orders backport Apply this label to a PR to enable auto-backport action migration Data or schema migrations full-run Always do a full QC CI run backport-to-0.17.x Backport these changes to the 0.17.x branch labels Jan 1, 2025
@SchrodingersGat SchrodingersGat added this to the 1.0.0 milestone Jan 1, 2025
Copy link

netlify bot commented Jan 1, 2025

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

Name Link
🔨 Latest commit b0070d6
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/677b54c864d689000712627d
😎 Deploy Preview https://deploy-preview-8814--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: 100 (no change from production)
SEO: 78 (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
Copy link
Member Author

@matmair no closer to working out why this is happening but I can recreate the issue clearly with this migration unit test.

By instrumenting the _do_insert method in django/db/models/base.py:1056 as follows:

    print("_do_insert:", manager)
    for f in fields:
        print("-", f)

I am getting the following:

_do_insert: order.SalesOrder._base_manager
- order.SalesOrder.reference
- order.SalesOrder.description
- order.SalesOrder.link
- order.SalesOrder.creation_date
- order.SalesOrder.status
- order.SalesOrder.notes
- order.SalesOrder.customer_reference
- order.SalesOrder.created_by
- order.SalesOrder.customer
- order.SalesOrder.shipment_date
- order.SalesOrder.shipped_by
- order.SalesOrder.target_date
- order.SalesOrder.responsible
- order.SalesOrder.reference_int
- order.SalesOrder.metadata
- order.SalesOrder.total_price_currency
- order.SalesOrder.total_price
- order.SalesOrder.contact
- order.SalesOrder.barcode_data
- order.SalesOrder.barcode_hash
- order.SalesOrder.project_code
- order.SalesOrder.order_currency
- order.SalesOrder.address
- order.SalesOrder.status_custom_key
- order.SalesOrder.status_custom_key

Clearly the 'status_custom_key' is being added twice (but seemingly only during the data migration)?

Copy link

codecov bot commented Jan 1, 2025

Codecov Report

Attention: Patch coverage is 61.11111% with 7 lines in your changes missing coverage. Please review.

Project coverage is 85.21%. Comparing base (ce617b7) to head (b0070d6).

Files with missing lines Patch % Lines
src/backend/InvenTree/order/test_migrations.py 58.82% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8814      +/-   ##
==========================================
+ Coverage   85.16%   85.21%   +0.05%     
==========================================
  Files        1178     1177       -1     
  Lines       51810    51715      -95     
  Branches     2092     2092              
==========================================
- Hits        44124    44070      -54     
+ Misses       7152     7115      -37     
+ Partials      534      530       -4     
Flag Coverage Δ
backend 86.95% <33.33%> (-0.03%) ⬇️
migrations 43.05% <61.11%> (+0.15%) ⬆️
pui 68.96% <ø> (-0.43%) ⬇️

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.

@matmair
Copy link
Member

matmair commented Jan 2, 2025

Very intresting that this only fails on postgres

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Apply this label to a PR to enable auto-backport action backport-to-0.17.x Backport these changes to the 0.17.x branch bug Identifies a bug which needs to be addressed full-run Always do a full QC CI run migration Data or schema migrations order Related to purchase orders / sales orders
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants