2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Adds 'status_text' functions to models (#3752)

- Convert status codes into text representation (translated)
- Useful for template rendering
This commit is contained in:
Oliver
2022-10-07 00:18:11 +11:00
committed by GitHub
parent cfff5ea264
commit d194aef79e
3 changed files with 20 additions and 0 deletions

View File

@ -670,6 +670,11 @@ class StockItem(InvenTreeBarcodeMixin, MetadataMixin, MPTTModel):
choices=StockStatus.items(),
validators=[MinValueValidator(0)])
@property
def status_text(self):
"""Return the text representation of the status field"""
return StockStatus.text(self.status)
notes = InvenTreeNotesField(help_text=_('Stock Item Notes'))
purchase_price = InvenTreeModelMoneyField(