@classmethod
    def latest(cls, case_id, section_id, product_id):
        relevant = cls.get_ordered_transactions_for_stock(case_id, section_id, product_id)
        try:
            return relevant.select_related()[0]
        except __HOLE__:
            return None
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/stock/models.py/StockTransaction.latest