@staticmethod
    def case_appointment_onvalidation(form):

        formvars = form.vars

        date = formvars.get("date")
        status = formvars.get("status")

        if date and str(status) == "4" and \
           date > current.request.utcnow.date():

            form.errors["status"] = current.T("Appointments with future dates can not be marked as completed")

    # -------------------------------------------------------------------------
Validate appointment form
dataset/ETHPy150Open sahana/eden/modules/s3db/dvr.py/DVRCaseAppointmentModel.case_appointment_onvalidation