* Add database model for defining custom units - Database model - DRF serializer - API endpoints * Add validation hook * Custom check for the 'definition' field * Add settings page for custom units - Table of units - Create / edit / delete buttons * Allow "unit" field to be empty - Not actually required for custom unit definition * Load custom unit definitions into global registry * Docs: add core concepts page(s) * Add some back links * Update docs * Add unit test for custom unit conversion * More unit testing * remove print statements * Add missing table rule
1.8 KiB
title
title |
---|
Physical Units |
Physical Units
Support for real-world "physical" units of measure is implemented using the pint Python library. This library provides the following core functions:
- Ensures consistent use of real units for your inventory management
- Convert between compatible units of measure from suppliers
- Enforce use of compatible units when creating part parameters
- Enable custom units as required
Unit Support
Physical units are supported by the following InvenTree subsystems:
Part
The unit of measure field for the Part model uses real-world units.
Supplier Part
The supplier part model uses real-world units to convert between supplier part quantities and internal stock quantities. Unit conversion rules ensure that only compatible unit types can be supplied
Part Parameter
The part parameter template model can specify units of measure, and part parameters can be specified against these templates with compatible units
Custom Units
Out of the box, the Pint library provides a wide range of units for use. However, it may not be sufficient for a given application. In such cases, custom units can be easily defined to meet custom requirements.
Custom units can be defined to provide a new physical quantity, link existing units together, or simply provide an alias for an existing unit.
!!! tip "More Info" For further information, refer to the pint documentation regarding custom unit definition
Create Custom Units
To view, edit and create custom units, locate the Physical Units tab in the settings panel.