<form model="clinic.visit" attrs='{"readonly":[["state","in",["confirmed"]]]}' show_company="1">
    <head>
        <field name="state"/>
        <button string="Gen No." icon="check" type="primary" method="gen_no"/>
        <button string="Print" icon="print" action="report_visit_form"/>
        <button string="Options" dropdown="1">
            <item string="Copy" method="copy"/>
        </button>
    </head>
    <tabs>
        <tab string="General">
            <group span="6" columns="1">
                <field name="number"/>
                <field name="time_start" onchange="onchange_time"/>
                <field name="department_id"/>
                <field name="cycle_id" onchange="onchange_time" required="1"/>
            </group>
            <group span="6" columns="1">
                <field name="patient_id" onchange="onchange_patient"/>
                <field name="time_stop"/>
                <field name="doctor_id"/>
                <field name="visit_date"/>
            </group>
        </tab>
        <tab string="Validation">
            <field name="nurse_id"/>
        </tab>
    </tabs>
    <foot>
        <button string="Confirm" type="success" method="confirm" states="draft" />
        <button string="Discard" type="danger" method="cancel" states="draft" />
        <button string="To Draft" type="default" icon="repeat" method="to_draft" states="confirmed,cancelled" />
   </foot>
    <related>
        <field name="hd_cases" readonly="1"/>
        <field name="comments"/>
    </related>
</form>