Problem/Motivation

Asset inventory tracking was added in #2912091: Farm Inventory. This added the ability to enable inventory management on a per-asset-type basis. To start, only Animal assets allowed inventory to be tracked. The use-case was to allow animal head counts to be increased/decreased via Logs. Since the initial "animal head count" use-case was fairly simple, and the inventory for all animal assets would use the same unit ("animals"), we didn't need the ability to specify units more specifically. It was implied.

As we think about enabling inventory tracking on other asset types (ie: Seed, Feed, etc), it will become necessary to allow users to specify the unit of measurement for each asset's inventory.

For example, you may want to track some of your seed in ounces, and some in lbs, and some in individual seeds.

Proposed resolution

Each asset should be able to define an inventory unit of measurement, which will be a reference to the existing "Unit" taxonomy. The inventory unit will be at the asset-level, so each asset's inventory can only be measured in one unit. If we need to expand this in the future to be able to track multiple unit's per asset, that will be possible (by moving the unit reference from the asset to the inventory field collection itself), although it is more complicated in other ways so will require further thought and discussion.

Remaining tasks

  • Add an inventory units field (field_farm_inventory_unit) to asset types.
  • ...

User interface changes

A new field type called "Inventory Unit" will be available, which can be added to asset types to enable defining a unit for each asset's inventory. This will be a taxonomy term reference field for referencing units in the "Farm Units" taxonomy. Asset types that use inventory will have a new Inventory fieldset in their form, which has this "Inventory Unit" field within it, so each asset can define a different unit of measurement.

API changes

  • ...

Data model changes

  • ...

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Might also want to consider moving the "Farm Quantity Units" taxonomy to new farm_unit module so that farm_inventory doesn't need to depend on farm_quantity. Or maybe that's not a bad thing. Something to think about...

m.stenta’s picture

m.stenta’s picture

This issue needs to be updated. Thoughts have been evolving... see this recent thread: https://github.com/farmOS/farmOS/issues/357

m.stenta’s picture

Status: Active » Closed (outdated)

Closing this because farmOS 2.x handles inventory tracking on all assets, with flexible measure+unit handling.

See comments in #2991394: Move inventory fields to quantity measurements starting here: https://www.drupal.org/project/farm/issues/2991394#comment-14037595