changeset 4881:0b41467801b4

task #16030: Create HELP command accessible from the HMIS Client. Initial Data model and views
author Luis Falcon <falcon@gnuhealth.org>
date Mon, 17 Jan 2022 14:33:05 +0000
parents f2719cf57a20
children f835794d6e4b
files tryton/health/__init__.py tryton/health/health.py tryton/health/health_view.xml tryton/health/icons/help.svg tryton/health/view/gnuhealth_help_form.xml tryton/health/view/gnuhealth_help_tree.xml
diffstat 6 files changed, 157 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health/__init__.py
+++ b/tryton/health/__init__.py
@@ -98,6 +98,7 @@
         health.PageOfLife,
         health.Commands,
         health.Modules,
+        health.Help,
         wizard.wizard_check_immunization_status.CheckImmunizationStatusInit,
         sequences.GnuHealthSequences,
         sequences.PatientSequence,
--- a/tryton/health/health.py
+++ b/tryton/health/health.py
@@ -89,7 +89,7 @@
     'PatientVaccination', 'PatientEvaluation',
     'Directions', 'SecondaryCondition', 'DiagnosticHypothesis',
     'SignsAndSymptoms', 'PatientECG', 'ProductTemplate', 'PageOfLife',
-    'Commands', 'Modules']
+    'Commands', 'Modules', 'Help']
 
 
 class DomiciliaryUnit(ModelSQL, ModelView):
@@ -5427,3 +5427,32 @@
 
     # Add the module description field
     description = fields.Char("Description")
+
+
+class Help(ModelSQL, ModelView):
+    'GNU Health Help'
+    __name__ = 'gnuhealth.help'
+
+    ''' This model contains the documentation for the
+        GNU Health Health and Hospital Management System.
+        It can be invoked from the command line or by
+        menu (Help).
+    '''
+
+    name = fields.Char("Code", required=True, help="Unique help code")
+    description = fields.Char(
+        "Description", 
+        help="Short description", required=True)
+    category = fields.Char("Category")
+    package = fields.Many2One("ir.module", "Package")
+    keywords = fields.Char("Keywords")
+    documentation = fields.Text("Documentation")
+
+    @classmethod
+    def __setup__(cls):
+        super(Help, cls).__setup__()
+        t = cls.__table__()
+        cls._sql_constraints = [
+            ('code_unique', Unique(t, t.name),
+             'The help code already exists')
+        ]
--- a/tryton/health/health_view.xml
+++ b/tryton/health/health_view.xml
@@ -97,6 +97,12 @@
             <field name="path">icons/federation.svg</field>
         </record>
 
+<!-- Create the GNU HEALTH Help icon -->
+        <record model="ir.ui.icon" id="gnuhealth_help_icon">
+            <field name="name">health-help</field>
+            <field name="path">icons/help.svg</field>
+        </record>
+
 <!-- Replace default Tryton module icons -->
 
         <!-- Party -->
@@ -206,16 +212,6 @@
             id="gnuhealth_pol" parent="gnuhealth_bol"/>
 
 
-
-
-
-
-
-
-
-
-
-
 <!-- Medication Frequencies -->
 
         <record model="ir.ui.view" id="gnuhealth_dosage_view">
@@ -2198,5 +2194,40 @@
             id="gnuhealth_conf_federation_country_config" sequence="10"
             parent="gnuhealth_conf_federation"/>
 
+<!-- Help documentation -->
+
+        <record model="ir.ui.view" id="gnuhealth_help_view">
+            <field name="model">gnuhealth.help</field>
+            <field name="type">form</field>
+            <field name="name">gnuhealth_help_form</field>
+        </record>
+
+        <record model="ir.ui.view" id="gnuhealth_help_tree">
+            <field name="model">gnuhealth.help</field>
+            <field name="type">tree</field>
+            <field name="name">gnuhealth_help_tree</field>
+        </record>
+
+        <record model="ir.action.act_window" id="gnuhealth_action_help">
+            <field name="name">Help and Documentation</field>
+            <field name="res_model">gnuhealth.help</field>
+        </record>
+
+        <record model="ir.action.act_window.view" id="act_help_list_view">
+            <field name="sequence" eval="10"/>
+            <field name="view" ref="gnuhealth_help_tree"/>
+            <field name="act_window" ref="gnuhealth_action_help"/>
+        </record>
+        <record model="ir.action.act_window.view" id="act_help_form_view">
+            <field name="sequence" eval="20"/>
+            <field name="view" ref="gnuhealth_help_view"/>
+            <field name="act_window" ref="gnuhealth_action_help"/>
+        </record>
+
+        <!-- Place  the menu entrey as the last item, 
+             after the configuration menu (999) -->
+        <menuitem action="gnuhealth_action_help" icon="health-help"
+            id="gnuhealth_help" sequence="1000" parent="gnuhealth_menu"/>
+
     </data>
 </tryton>
new file mode 100644
--- /dev/null
+++ b/tryton/health/icons/help.svg
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 97 97" style="enable-background:new 0 0 97 97;" xml:space="preserve">
+<g id="Capa_1">
+</g>
+<g id="Capa_2">
+	<g>
+		<g>
+			<g>
+				<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="35.0103" y1="62.0723" x2="62.6624" y2="34.4203">
+					<stop  offset="0" style="stop-color:#036973"/>
+					<stop  offset="1" style="stop-color:#32A5AE"/>
+				</linearGradient>
+				<path style="fill:url(#SVGID_1_);" d="M21.107,8.606c7.958-5.504,17.581-8.576,27.254-8.605
+					c9.002-0.071,18.013,2.432,25.655,7.214c8.792,5.429,15.767,13.753,19.573,23.383c3.723,9.3,4.406,19.777,2.011,29.501
+					c-2.369,9.811-7.964,18.778-15.622,25.307c-6.162,5.294-13.669,9.009-21.626,10.603c-9.63,1.953-19.899,1.019-28.894-3.004
+					c-0.593-0.223-1.202-0.669-1.856-0.42C21.736,94.067,15.864,95.525,9.994,97c1.006-5.197,2.072-10.377,3.097-15.567
+					c-1.18-1.436-2.43-2.817-3.526-4.317C3.784,69.413,0.4,59.955,0,50.318v-3.004c0.184-5.633,1.28-11.244,3.371-16.476
+					C6.904,21.874,13.188,14.052,21.107,8.606z"/>
+				<path style="fill:#028189;" d="M48.736,2c8.497,0,17.098,2.454,24.23,6.918c8.449,5.217,15.113,13.178,18.767,22.425
+					c3.549,8.867,4.233,18.911,1.924,28.289c-2.252,9.328-7.57,17.941-14.981,24.259c-5.968,5.127-13.132,8.64-20.721,10.16
+					c-3.086,0.626-6.25,0.943-9.403,0.943c-6.379,0-12.699-1.319-18.277-3.813c-0.037-0.017-0.074-0.032-0.112-0.046
+					c-0.094-0.035-0.187-0.08-0.283-0.124c-0.43-0.198-1.081-0.498-1.876-0.498c-0.334,0-0.662,0.052-0.977,0.156
+					c-3.421,0.864-6.844,1.72-10.268,2.576c-1.399,0.35-2.798,0.7-4.197,1.05c0.41-2.072,0.826-4.144,1.233-6.17
+					c0.422-2.101,0.844-4.202,1.259-6.304c0.116-0.587-0.037-1.195-0.417-1.657c-0.377-0.459-0.762-0.913-1.146-1.367
+					c-0.823-0.972-1.601-1.89-2.326-2.881C5.643,68.559,2.389,59.455,2,50.276v-2.929c0.185-5.566,1.271-10.871,3.232-15.775
+					c3.354-8.51,9.394-16.081,17.013-21.32c7.652-5.292,16.929-8.222,26.132-8.25L48.734,2H48.736 M48.734,0
+					c-0.124,0-0.249,0-0.373,0.001c-9.672,0.029-19.296,3.101-27.254,8.605C13.188,14.052,6.904,21.874,3.371,30.838
+					C1.28,36.07,0.184,41.681,0,47.314v3.004c0.4,9.636,3.784,19.095,9.566,26.798c1.096,1.5,2.346,2.881,3.526,4.317
+					C12.067,86.623,11,91.803,9.994,97c5.869-1.475,11.741-2.933,17.607-4.414c0.136-0.052,0.27-0.073,0.402-0.073
+					c0.505,0,0.985,0.317,1.455,0.494c5.988,2.678,12.54,3.987,19.093,3.987c3.291,0,6.582-0.33,9.801-0.983
+					c7.958-1.594,15.464-5.31,21.626-10.603C87.636,78.878,93.231,69.911,95.6,60.1c2.395-9.724,1.711-20.201-2.011-29.501
+					c-3.806-9.63-10.781-17.954-19.573-23.383C66.48,2.499,57.612,0,48.734,0L48.734,0z"/>
+			</g>
+		</g>
+	</g>
+	<g>
+		<path style="fill:#FFFFFF;" d="M68.65,30.183c-0.804-4.256-2.976-8.209-6.116-11.136c-3.707-3.497-8.747-5.504-13.825-5.504
+			c-0.129,0-0.259,0.001-0.388,0.004c-5.304,0.071-10.481,2.32-14.197,6.168c-3.68,3.74-5.798,8.927-5.805,14.226l-0.001,0.997
+			l0.997,0.004c0.875,0.004,1.75,0.005,2.624,0.005c1.542,0,3.084-0.004,4.626-0.008l2.415-0.006l1.002-0.002l-0.004-1.002
+			c-0.014-3.591,2.438-7.039,5.83-8.198c0.892-0.331,1.819-0.495,2.78-0.495c2.975,0,5.864,1.575,7.36,4.013
+			c2.296,3.443,1.643,8.416-1.435,11.117l-0.024,0.021l-0.023,0.022c-0.746,0.743-1.722,1.211-2.756,1.707
+			c-0.796,0.381-1.619,0.776-2.384,1.32c-2.999,2.045-5.216,5.323-6.064,8.984c-0.508,2.358-0.463,4.731-0.421,7.026
+			c0.022,1.173,0.044,2.386-0.01,3.556l-0.049,1.046h1.048h9.669h0.995l0.005-0.995c0.005-0.93,0.002-1.861-0.001-2.791
+			c-0.004-1.42-0.009-2.888,0.017-4.327c0.029-1.412,0.858-2.719,2.016-3.174c4.385-1.862,7.969-5.155,10.116-9.284
+			C68.774,39.486,69.486,34.762,68.65,30.183z M31.94,33.947c-0.866,0-1.733-0.001-2.599-0.005c3.213,0.013,6.425-0.003,9.638-0.01
+			C36.632,33.938,34.286,33.947,31.94,33.947z M48.342,14.547c0.123-0.002,0.245-0.004,0.368-0.004c0.266,0,0.531,0.028,0.797,0.039
+			C49.119,14.565,48.731,14.539,48.342,14.547z M53.518,55.919c-0.021,1.188-0.022,2.377-0.019,3.565
+			C53.496,58.296,53.497,57.107,53.518,55.919c0.013-0.641,0.16-1.287,0.425-1.876C53.678,54.632,53.531,55.277,53.518,55.919z
+			 M61.852,19.779c-0.445-0.42-0.912-0.817-1.396-1.191C60.94,18.962,61.407,19.359,61.852,19.779
+			c0.374,0.349,0.734,0.713,1.078,1.091C62.586,20.492,62.227,20.128,61.852,19.779z"/>
+		<path style="fill:#FFFFFF;" d="M54.505,82.445c-0.027-2.719-0.017-5.484-0.008-8.159l0.005-1.533l0.003-1.003h-1.003h-9.669h-1v1
+			v9.701v1.003l1.003-0.003l1.528-0.005c1.377-0.005,2.754-0.01,4.13-0.01c1.333,0,2.666,0.004,4,0.018l1.02,0.01L54.505,82.445z"/>
+	</g>
+	<rect x="0" style="fill-rule:evenodd;clip-rule:evenodd;fill:none;" width="97" height="97"/>
+</g>
+</svg>
new file mode 100644
--- /dev/null
+++ b/tryton/health/view/gnuhealth_help_form.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<form>
+    <group id="help_header" colspan="4" col="6">
+        <label name="name"/>
+        <field name="name"/>
+        <newline/>
+        <label name="description"/>
+        <field name="description" colspan="5"/>
+        <newline/>
+        <label name="package"/>
+        <field name="package"/>
+        <label name="category"/>
+        <field name="category"/>
+        <label name="keywords"/>
+        <field name="keywords"/>
+    </group>
+    <newline/>
+    <separator string="Documentation" id="separator_documentation" colspan="4"/>
+    <field name="documentation"/>
+</form>
new file mode 100644
--- /dev/null
+++ b/tryton/health/view/gnuhealth_help_tree.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<tree>
+    <field name="name" expand="1"/>
+    <field name="description" expand="1"/>
+    <field name="package"/>
+    <field name="category"/>
+    <field name="keywords"/>
+</tree>