Mercurial > hgweb > health
changeset 1946:4f14279661d8
health_inpatient : Complete task #13632: Add hospitalization discharge reason
| author | Luis Falcon <falcon@gnu.org> |
|---|---|
| date | Mon, 25 May 2015 12:57:32 +0100 |
| parents | 290fa9d96b07 |
| children | a4df78e9f6c1 |
| files | tryton/health_inpatient/health_inpatient.py tryton/health_inpatient/view/gnuhealth_inpatient_registration.xml |
| diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_inpatient/health_inpatient.py +++ b/tryton/health_inpatient/health_inpatient.py @@ -121,6 +121,16 @@ states={'invisible': Not(Equal(Eval('state'), 'done'))}, help="Health Professional that discharged the patient") + discharge_reason = fields.Selection([ + ('home','Home / Selfcare'), + ('transfer','Transferred to another institution'), + ('death','Death'), + ('against_advice','Left against medical advice')], + 'Discharge Reason', + states={'invisible': Not(Equal(Eval('state'), 'done')), + 'required': Equal(Eval('state'), 'done')}, + help="Reason for patient discharge") + institution = fields.Many2One('gnuhealth.institution', 'Institution') @staticmethod @@ -261,7 +271,7 @@ @classmethod def write(cls, registrations, vals): # Don't allow to write the record if the evaluation has been done - if registrations[0].state == 'done': + if registrations[0].state == 'done' and registrations[0].discharge_reason: cls.raise_user_error( "This hospitalization is at state Done\n" "You can no longer modify it.")
--- a/tryton/health_inpatient/view/gnuhealth_inpatient_registration.xml +++ b/tryton/health_inpatient/view/gnuhealth_inpatient_registration.xml @@ -42,10 +42,12 @@ <field name="state" readonly="1"/> <button name="confirmed" string="Confirm" help="Confirm Registration / Make the reservation" icon="icon-ok"/> </group> - <group colspan="2" id="group_registration_holder3"> + <group colspan="2" col="6" id="group_registration_holder3"> <button name="cancel" help="Cancel Registration" string="Cancel" icon="icon-cancel" confirm="Cancel the patient registration process ?"/> <button name="admission" help="Patient Admission" string="Admission" icon="icon-ok" confirm="Admit the patient in the health institution and assign the bed"/> <button name="discharge" help="Discharge Patient" string="Discharge" icon="icon-home" confirm="You are about to SIGN the discharge the patient from the health institution. This record will become READ ONLY "/> + <label name="discharge_reason"/> + <field name="discharge_reason"/> <field name="discharged_by"/> </group> </group>
