inventory: Fix SQL count

Replace sqlalchemy .count() by .scalar()