Mercurial > hgweb > health
changeset 2221:4eabcf6cbf1b
task #13769: Flexible name on party (person). Add initial PersonName model and views
| author | Luis Falcon <falcon@gnu.org> |
|---|---|
| date | Thu, 10 Dec 2015 20:02:04 +0000 |
| parents | 49e72f94c6e9 |
| children | e8f1272f461f |
| files | tryton/health/__init__.py tryton/health/health.py tryton/health/health_view.xml tryton/health/view/gnuhealth_person_name_form.xml tryton/health/view/gnuhealth_person_name_tree.xml tryton/health/view/party_form.xml |
| diffstat | 6 files changed, 99 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health/__init__.py +++ b/tryton/health/__init__.py @@ -28,6 +28,7 @@ def register(): Pool.register( + PersonName, OperationalArea, OperationalSector, DomiciliaryUnit,
--- a/tryton/health/health.py +++ b/tryton/health/health.py @@ -41,8 +41,8 @@ import pytz __all__ = [ - 'OperationalArea', 'OperationalSector', 'Occupation', 'Ethnicity', - 'DomiciliaryUnit','BirthCertificate','DeathCertificate', + 'PersonName','OperationalArea', 'OperationalSector', 'Occupation', + 'Ethnicity','DomiciliaryUnit','BirthCertificate','DeathCertificate', 'PartyPatient', 'PartyAddress','DrugDoseUnits', 'MedicationFrequency', 'DrugForm', 'DrugRoute', 'MedicalSpecialty', 'HealthInstitution', 'HealthInstitutionSpecialties', @@ -106,6 +106,42 @@ return None +class PersonName(ModelSQL, ModelView): + 'Person Name' + __name__ = 'gnuhealth.person_name' + + """ We are using the concept of HumanName on HL7 FHIR + http://www.hl7.org/implement/standards/fhir/datatypes.html#HumanName + """ + + party = fields.Many2One('party.party','Person', + domain=[('is_person', '=', True)], help="Related party (person)") + + use = fields.Selection([ + (None, ''), + ('official', 'Official'), + ('usual', 'Usual'), + ('nickname', 'Nickname'), + ('maiden', 'Maiden'), + ('anonymous', 'Anonymous'), + ('temp', 'Temp'), + ('old', 'old'), + ], 'Use', sort=False, required=True) + family = fields.Char('Family', + help="Family / Surname.") + given = fields.Char('Given', + help="Given / First name. May include middle name") + prefix = fields.Selection([ + (None, ''), + ('mr', 'Mr'), + ('mrs', 'Mrs'), + ('miss', 'Miss'), + ('dr', 'Dr'), + ], 'Prefix', sort=False) + suffix = fields.Char('Suffix') + date_from = fields.Date('From') + date_to = fields.Date('To') + class DomiciliaryUnit(ModelSQL, ModelView): 'Domiciliary Unit' __name__ = 'gnuhealth.du' @@ -256,6 +292,15 @@ return compute_age_from_dates(self.dob, self.deceased, self.dod, self.sex, name) + person_names = fields.One2Many('gnuhealth.person_name','party', + 'Person Names', + states={'invisible': Not(Bool(Eval('is_person')))}) + + name_representation = fields.Char('Name format', + states={'invisible': Not(Bool(Eval('is_person')))}, + help="Name represenation format, separating the elements with commas \ + eg : P,F,G would show Prefix, First, and Given Name") + activation_date = fields.Date( 'Activation date', help='Date of activation of the party')
--- a/tryton/health/health_view.xml +++ b/tryton/health/health_view.xml @@ -111,6 +111,20 @@ parent="gnuhealth_conf_misc" sequence="80" icon="gnuhealth-open"/> +<!-- Person Names --> + + <record model="ir.ui.view" id="gnuhealth_person_name_view"> + <field name="model">gnuhealth.person_name</field> + <field name="type">form</field> + <field name="name">gnuhealth_person_name_form</field> + </record> + + <record model="ir.ui.view" id="gnuhealth_person_name_tree"> + <field name="model">gnuhealth.person_name</field> + <field name="type">tree</field> + <field name="name">gnuhealth_person_name_tree</field> + </record> + <!-- Medication Frequencies --> <record model="ir.ui.view" id="gnuhealth_dosage_view">
new file mode 100644 --- /dev/null +++ b/tryton/health/view/gnuhealth_person_name_form.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<form string="Person Names"> + <label name="use"/> + <field name="use"/> + <newline/> + <label name="family"/> + <field name="family"/> + <label name="given"/> + <field name="given"/> + <label name="prefix"/> + <field name="prefix"/> + <label name="suffix"/> + <field name="suffix"/> + <newline/> + <label name="date_from"/> + <field name="date_to"/> +</form>
new file mode 100644 --- /dev/null +++ b/tryton/health/view/gnuhealth_person_name_tree.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<tree editable="top" string="Person Names"> + <field name="use" expand="1"/> + <field name="prefix" expand="1"/> + <field name="given" expand="1"/> + <field name="family" expand="1"/> + <field name="suffix" expand="1"/> +</tree>
--- a/tryton/health/view/party_form.xml +++ b/tryton/health/view/party_form.xml @@ -84,4 +84,16 @@ <xpath expr="/form/field[@name="code"]" position="replace"> <field name="ref"/> </xpath> + + <!-- Add the person names on the party identifier section page --> + + <xpath expr="//field[@name="identifiers"]" position="after"> + <newline/> + <field name="person_names" colspan="4"/> + <newline/> + <label name="name_representation"/> + <field name="name_representation"/> + + </xpath> + </data>
