def get_previous_transaction(self):
        siblings = StockTransaction.get_ordered_transactions_for_stock(
            self.case_id, self.section_id, self.product_id
        ).filter(report__date__lte=self.report.date).exclude(pk=self.pk)
        try:
            return siblings[0]
        except __HOLE__:
            return None
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/stock/models.py/StockTransaction.get_previous_transaction