changeset 4995:cff3f4768c9d

health, genetics, services: use core module get_institution
author Luis Falcon <falcon@gnuhealth.org>
date Thu, 20 Jan 2022 18:50:58 +0000
parents c937e6bcad63
children 5e87bf22779f
files tryton/health/health.py tryton/health_genetics/health_genetics.py tryton/health_services/health_services.py
diffstat 3 files changed, 7 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health/health.py
+++ b/tryton/health/health.py
@@ -3180,9 +3180,7 @@
 
     @staticmethod
     def default_institution():
-        HealthInst = Pool().get('gnuhealth.institution')
-        institution = HealthInst.get_institution()
-        return institution
+        return get_institution()
 
     @classmethod
     def __setup__(cls):
@@ -3952,9 +3950,7 @@
 
     @staticmethod
     def default_institution():
-        HealthInst = Pool().get('gnuhealth.institution')
-        institution = HealthInst.get_institution()
-        return institution
+        return get_institution()
 
     @staticmethod
     def default_healthprof():
@@ -5441,7 +5437,7 @@
 
     name = fields.Char("Code", required=True, help="Unique help code")
     description = fields.Char(
-        "Description", 
+        "Description",
         help="Short description", required=True)
     category = fields.Char("Category")
     package = fields.Many2One("ir.module", "Package")
--- a/tryton/health_genetics/health_genetics.py
+++ b/tryton/health_genetics/health_genetics.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 ##############################################################################
 #
 #    GNU Health: The Free Health and Hospital Information System
@@ -24,7 +23,7 @@
 from trytond.pyson import Eval
 from trytond.pool import Pool
 from uuid import uuid4
-
+from trytond.modules.health.core import get_institution
 
 __all__ = ['DiseaseGene', 'ProteinDisease', 'GeneVariant',
            'GeneVariantPhenotype',
@@ -312,9 +311,7 @@
 
     @staticmethod
     def default_institution():
-        HealthInst = Pool().get('gnuhealth.institution')
-        institution = HealthInst.get_institution()
-        return institution
+        return get_institution()
 
     @classmethod
     def create_genetics_pol(cls, genetic_info):
--- a/tryton/health_services/health_services.py
+++ b/tryton/health_services/health_services.py
@@ -31,6 +31,7 @@
 from trytond.tools.multivalue import migrate_property
 from trytond.i18n import gettext
 from trytond.pyson import Id
+from trytond.modules.health.core import get_institution
 
 from .exceptions import (
     ServiceAlreadyInvoiced, NoServiceAssociated, NoProductAssociated,
@@ -96,9 +97,7 @@
 
     @staticmethod
     def default_institution():
-        HealthInst = Pool().get('gnuhealth.institution')
-        institution = HealthInst.get_institution()
-        return institution
+        return get_institution()
 
     @classmethod
     @ModelView.button
@@ -248,11 +247,6 @@
 
     product = fields.Many2One('product.product', 'Product')
 
-    """
-    @staticmethod
-    def default_product():
-        return get_institution()
-    """
 
     @classmethod
     def __setup__(cls):