-
-
Notifications
You must be signed in to change notification settings - Fork 835
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 pricing cache #3710
Part pricing cache #3710
Conversation
Currently this model does not "do" anything but will be used for caching pre-calculated pricing information
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.
Seems a bit verbose datastructure wise
Which fields would you cull? How do you see the caching functionality working here? |
…Tree into part-pricing-cache
- Updated model with new fields - Code for calculating BOM price - Code for calculating internal price - Code for calculating supplier price - Updated unit testing
- Adds helper function for formatting currency data - No longer pre-render "price strings" on the server
- Caching across mnultiple processes causes issues - Need to move to something like redis to solve this - Ref: inventree#3921
- Consistent naming
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.
@SchrodingersGat looks good from my side.
Still wondering if code duplication could be reduced with the different types of pricing (esp. in API urls, forms)
Not really sure if it solves #3553 fully |
@SchrodingersGat i think the idea was originally to make a toggle as we also had an FR to reduce the number of shown decimal places. |
- Take unit pricing / pack size into account
- Use unit pricing (take pack size into account)
This PR represents the first steps towards a major overhaul of pricing.
Currently, part pricing is too expensive to calculate "on the fly" and causes issues with viewing prices in a Bill of Materials, for example.
The major goal of this PR is to add a new database model which stores cached pricing information for a Part. This pricing information can be used in API requests for fast lookup against multiple parts.
Individual "quantity pricing" for a single part will still need to be calculated "on the fly" but for a single part should not be too expensive.
TODO
Schedule update when part is created / edited / deletedhas_complete_bom_pricing
methodFuture Work
get_price_info
methodget_bom_price_range
methodget_price_range
methodReferences