changeset 2120:8636a781d095

task #13791: Add patient condition shortcut and associate followup evaluations to existing conditions
author Luis Falcon <falcon@gnu.org>
date Thu, 29 Oct 2015 11:42:49 +0000
parents d48cc30f08f2
children 0a4351e058f3
files tryton/health/health.py tryton/health/health_view.xml tryton/health/view/gnuhealth_patient_form.xml
diffstat 3 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health/health.py
+++ b/tryton/health/health.py
@@ -2599,7 +2599,9 @@
 #    prescriptions = fields.One2Many('gnuhealth.prescription.order', 'name',
 #        'Prescriptions')
 
-    diseases = fields.One2Many('gnuhealth.patient.disease', 'name', 'Conditions')
+    diseases = fields.One2Many('gnuhealth.patient.disease', 'name',
+     'Conditions', readonly=True)
+     
     critical_summary = fields.Function(fields.Text(
         'Important health conditions related to this patient',
         help='Automated summary of patient important health conditions '
@@ -2796,9 +2798,9 @@
             table.drop_column('identification_code')
 
 
-# PATIENT DISESASES INFORMATION
+# PATIENT CONDITIONS INFORMATION
 class PatientDiseaseInfo(ModelSQL, ModelView):
-    'Patient Disease History'
+    'Patient Conditions History'
     __name__ = 'gnuhealth.patient.disease'
 
     name = fields.Many2One('gnuhealth.patient', 'Patient')
--- a/tryton/health/health_view.xml
+++ b/tryton/health/health_view.xml
@@ -1491,7 +1491,7 @@
             <field name="action" ref="act_ecg_view"/>
         </record>
 
-<!-- PATIENT DISEASES -->
+<!-- PATIENT CONDITIONS -->
 
         <record model="ir.ui.view" id="gnuhealth_patient_diseases_view_form">
             <field name="model">gnuhealth.patient.disease</field>
@@ -1505,6 +1505,20 @@
             <field name="name">gnuhealth_patient_diseases_tree</field>
         </record>
 
+<!-- Shortcut to the Patient conditions from the patient view -->
+        <record model="ir.action.act_window" id="act_condition_form1">
+            <field name="name">Conditions</field>
+            <field name="res_model">gnuhealth.patient.disease</field>
+            <field name="domain" eval="[('name', '=', Eval('active_id'))]" pyson="1"/>
+        </record>
+        <record model="ir.action.keyword"
+                id="act_open_condition_keyword1">
+            <field name="keyword">form_relate</field>
+            <field name="model">gnuhealth.patient,-1</field>
+            <field name="action" ref="act_condition_form1"/>
+        </record>
+
+
 
 <!-- PATIENT DATA -->
 
--- a/tryton/health/view/gnuhealth_patient_form.xml
+++ b/tryton/health/view/gnuhealth_patient_form.xml
@@ -90,10 +90,5 @@
         <page string="Conditions" id="patient_diseases">
             <field name="diseases" colspan="4"/>
         </page>
-        <!-- Patient Evaluations NOW as a shortcut
-        <page string="Evaluations" id="patient_evaluations">
-            <field name="evaluation_ids" colspan="4"/>
-        </page>
-        -->
     </notebook>
 </form>