Add helpers to the Inventory model for reporting purpose
We need to help users conveniently fetch data with new helper methods. These helper methods are not getters, they follow reportXxxxYyyyy
notation.
Helpers:
- Pedigree of the accession. Accession_pedigree.description
- Country of origin. Accession_source.geography.country_code
- Crop name: Crop.name
- Inventory name. Accession_inv_name.plant_name. For this case, if the inventory doesn't have a name associated, the inventory_id to be used must be the system inventory of the accession. if the user wants a specific name, he must specify the category_code and plant_name_rank.
maybe, this diagram can help to see the relations.