Mercurial > hgweb > health
changeset 3225:797737d12d6c
Task #15167: Remove provider access to config model, add unique constraints, add server to views, py3 super calls
| author | Chris Zimmerman <chris@teffalump.com> |
|---|---|
| date | Sat, 23 Feb 2019 20:45:47 -0800 |
| parents | 02a14bef0d6f |
| children | 7e2c77dac653 |
| files | tryton/health_orthanc/data/data.xml tryton/health_orthanc/health_orthanc.py tryton/health_orthanc/view/patient_form.xml tryton/health_orthanc/view/study_form.xml |
| diffstat | 4 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_orthanc/data/data.xml +++ b/tryton/health_orthanc/data/data.xml @@ -73,7 +73,7 @@ <record model="ir.model.access" id="orthanc_access_config_provider"> <field name="model" search="[('model', '=', 'gnuhealth.orthanc.config')]"/> <field name="group" ref="health.group_health_doctor"/> - <field name="perm_read" eval="True"/> + <field name="perm_read" eval="False"/> <field name="perm_write" eval="False"/> <field name="perm_create" eval="False"/> <field name="perm_delete" eval="False"/>
--- a/tryton/health_orthanc/health_orthanc.py +++ b/tryton/health_orthanc/health_orthanc.py @@ -69,7 +69,7 @@ @classmethod def __setup__(cls): - super(OrthancServerConfig, cls).__setup__() + super().__setup__() t = cls.__table__() cls._sql_constraints = [ ("label_unique", Unique(t, t.label), "The label must be unique.") @@ -203,6 +203,14 @@ ) server = fields.Many2One("gnuhealth.orthanc.config", "Server", readonly=True) + @classmethod + def __setup__(cls): + super().__setup__() + t = cls.__table__() + cls._sql_constraints = [ + ("uuid_unique", Unique(t, t.server, t.uuid), "UUID must be unique for a given server") + ] + @staticmethod def get_info_from_dicom(patients): """Extract information for writing to database""" @@ -295,6 +303,14 @@ req_phys = fields.Char("Requesting Physician", readonly=True) server = fields.Many2One("gnuhealth.orthanc.config", "Server", readonly=True) + @classmethod + def __setup__(cls): + super().__setup__() + t = cls.__table__() + cls._sql_constraints = [ + ("uuid_unique", Unique(t, t.server, t.uuid), "UUID must be unique for a given server") + ] + def get_rec_name(self, name): return ": ".join((self.ident or self.uuid, self.description or ""))
--- a/tryton/health_orthanc/view/patient_form.xml +++ b/tryton/health_orthanc/view/patient_form.xml @@ -12,6 +12,8 @@ <field name="ident"/> <label name="uuid"/> <field name="uuid"/> + <label name="server"/> + <field name="server"/> </page> <page string="Studies"> <field name="studies" mode="tree,form"/>
