-
-
Notifications
You must be signed in to change notification settings - Fork 669
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 units #4854
Part units #4854
Conversation
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.
Would it make sense to introduce a unit 'each' or 'piece'/'pc' for a quantity of 1? I have seen that in other PLMs/ERPs
Yep, that makes sense. There's an easy entry point as I've already defined a hook for creating a custom UnitRegistry |
- Also allow ordering by part units - Allow filtering to show parts which have defined units
- Convert to native part units - Handle empty units value - Add unit tests
- Required to ensure that the "pack_size_native" is up to date
- Allow reverse migration
- Handle case where no currencies are provided - Handle case where base currency is not in provided options
- Check that units fields are updated correctly
- each / piece - dozen / hundred / thousand - Add unit testing also
- Replace with "pack_quantity" or "pack_quantity_native" as appropriate
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.
On a general note: Should we consider squashing migrations with the next major release? These migrations that require 3 steps are culminating.
"""Calculate the base unit quantiy for a given quantity.""" | ||
|
||
q = Decimal(quantity) * Decimal(self.pack_quantity_native) | ||
q = round(q, 10).normalize() |
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.
Question: Should this rounding be noted in the docs?
@SchrodingersGat have you seen that there are tests that are not run in the coverage? |
No, which tests are not runnign? |
The migration tests do not seem to run fully anymore, coverage changed here |
I think it should be fine |
Closes #4829
This PR changes the "units" field for a part to be a physical unit (e.g. "m")
Additionally, supplier parts can be specified in compatible units (e.g "feet"), and converted to base units as appropriate
TODO
pack_size
variable