Skip to content

Conversation

Reza98Sh
Copy link
Contributor

@Reza98Sh Reza98Sh commented Jun 12, 2025

This pull request implements the feature requested in #9303 by adding a dedicated delivery_address field to Purchase Orders.

Changes Implemented

Backend:

  • Created a new database migration (0110_purchaseorder_delivery_address.py) to apply the schema change.
  • Added a delivery_address ForeignKey field to the PurchaseOrder model, linking to company.Address.
  • Exposed the delivery_address field in the PurchaseOrderSerializer to make it available via the API.
  • Included delivery_address in the autocomplete_fields in PurchaseOrderAdmin for a better user experience in the admin panel.

Frontend:

  • Added the delivery_address field to the usePurchaseOrderFields hook, making it visible and editable in the Purchase Order forms.

Closes #9303

Copy link

netlify bot commented Jun 12, 2025

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

Name Link
🔨 Latest commit 080c5f6
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/687c9f559a3b5f00086f35ca
😎 Deploy Preview https://deploy-preview-9768--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: 97 (🟢 up 2 from production)
Accessibility: 81 (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 project configuration.

@Reza98Sh
Copy link
Contributor Author

If this method is not considered best practice, please let me know.
I am doing my best to improve it.

@matmair
Copy link
Contributor

matmair commented Jun 12, 2025

@Reza98Sh there is a conflict in the migrations; please delete the ones you added and regenerate them

Copy link
Contributor

@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.

Looks very good for a first PR

null=True,
verbose_name=_('Delivery Address'),
help_text=_('Delivery address for this order'),
related_name='+',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not practical for future use; please use a related name that makes sense when using the Adress model

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed it

@SchrodingersGat
Copy link
Member

An implementation question: where / how do the users define an address for "themself" which can be used here?

One approach might be to create a "company" object which is the "internal" company, which can then have one or more addresses associated with it?

Any other ideas?

@Reza98Sh Reza98Sh force-pushed the feature/issue9303 branch from f87e685 to a36d430 Compare June 13, 2025 10:06
@Reza98Sh
Copy link
Contributor Author

An implementation question: where / how do the users define an address for "themself" which can be used here?

One approach might be to create a "company" object which is the "internal" company, which can then have one or more addresses associated with it?

Any other ideas?

Sorry I haven't any serious experience with InvenTree but I think It's good if there is option to create address without define company

@Reza98Sh Reza98Sh requested a review from matmair June 13, 2025 10:25
@SchrodingersGat
Copy link
Member

@matmair thoughts on this? Does a set of "internal addresses" for "me" (which are not linked to a company object) make the most sense?

@matmair
Copy link
Contributor

matmair commented Jun 13, 2025

There is no real inherent connection between Addresses and Companies but the way the current data model works there are a few functions that would need rethinking.

Mainly:

  • shipping notes
  • primary addresses

Having (1 or more) internal companies as references would be nice for a few of the open EPICs.
My suggestion for now: creating a special "locked/protected" company that represents the org that owns the InvenTree instance and link the addresses there.

Copy link

codecov bot commented Jun 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.34%. Comparing base (b465900) to head (3980b67).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9768   +/-   ##
=======================================
  Coverage   86.34%   86.34%           
=======================================
  Files        1234     1235    +1     
  Lines       54239    54245    +6     
  Branches     2236     2236           
=======================================
+ Hits        46830    46839    +9     
+ Misses       6841     6838    -3     
  Partials      568      568           
Flag Coverage Δ
backend 88.26% <100.00%> (+<0.01%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[FR] Delivery Address on Purchase Orders
3 participants