def get_by_id(tallySheetId, tallySheetVersionId):
    tallySheet = TallySheet.get_by_id(tallySheetId=tallySheetId)
    if tallySheet is None:
        raise NotFoundException("Tally sheet not found. (tallySheetId=%d)" % tallySheetId)

    result = get_tally_sheet_version_class(tallySheet.tallySheetCode).Model.query.filter(
        Model.tallySheetVersionId == tallySheetVersionId,
        Model.tallySheetId == tallySheetId
    ).one_or_none()

    return result
def get_by_id(tallySheetId, tallySheetVersionId):
    tallySheet = TallySheet.get_by_id(tallySheetId=tallySheetId)
    if tallySheet is None:
        raise NotFoundException(
            message="Tally sheet not found. (tallySheetId=%d)" % tallySheetId,
            code=MESSAGE_CODE_TALLY_SHEET_NOT_FOUND)

    tallySheetVersion = get_tally_sheet_version_class(
        tallySheet.tallySheetCode).Model.query.filter(
            Model.tallySheetVersionId == tallySheetVersionId,
            Model.tallySheetId == tallySheetId).one_or_none()

    return tallySheetVersion
Пример #3
0
    def create_empty_version(self):
        tallySheetVersion = get_tally_sheet_version_class(self.tallySheetCode).Model(
            tallySheetId=self.tallySheetId
        )

        return tallySheetVersion