Skip to content

Commit

Permalink
Format stock quantity of zero using plural form of unit name
Browse files Browse the repository at this point in the history
  • Loading branch information
sde1000 committed Jun 25, 2024
1 parent 42f112c commit 61875ea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions quicktill/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,8 @@ def format_stock_qty(self, qty):
if abs(qty) < self.base_units_per_stock_unit and qty != 0:
return f"{self._fq(qty)} {self.name}"
single = abs(qty) - self.base_units_per_stock_unit < 0.05
if qty == 0.0:
single = False
n = self.stock_unit_name if single else self.stock_unit_name_plural
return f"{self._fq(qty / self.base_units_per_stock_unit)} {n}"

Expand Down

0 comments on commit 61875ea

Please sign in to comment.