changeset 4855:f40c97f17a08

task #16043: Migration to GNU Health 4.0: Migrate and cleanup health_services_lab
author Luis Falcon <falcon@gnuhealth.org>
date Thu, 13 Jan 2022 17:55:41 +0000
parents c3d6e5b9f728
children 007a3f719e29
files tryton/health_services_lab/__init__.py tryton/health_services_lab/health_services_lab.py tryton/health_services_lab/tryton.cfg tryton/health_services_lab/wizard/wizard_health_services.py
diffstat 4 files changed, 21 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health_services_lab/__init__.py
+++ b/tryton/health_services_lab/__init__.py
@@ -22,15 +22,15 @@
 ##############################################################################
 
 from trytond.pool import Pool
-from .health_services_lab import *
-from .wizard import *
+from . import health_services_lab
+from . import wizard
 
 
 def register():
     Pool.register(
-    PatientLabTestRequest,
-	RequestPatientLabTestStart,
+        health_services_lab.PatientLabTestRequest,
+        wizard.wizard_health_services.RequestPatientLabTestStart,
         module='health_services_lab', type_='model')
     Pool.register(
-        RequestPatientLabTest,
+        wizard.wizard_health_services.RequestPatientLabTest,
         module='health_services_lab', type_='wizard')
--- a/tryton/health_services_lab/health_services_lab.py
+++ b/tryton/health_services_lab/health_services_lab.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 ##############################################################################
 #
 #    GNU Health: The Free Health and Hospital Information System
@@ -21,8 +20,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
-import datetime
-from trytond.model import ModelView, ModelSQL, fields, ModelSingleton, Unique
+from trytond.model import ModelView, ModelSQL, fields
 from trytond.pyson import Eval, Equal
 from trytond.pool import Pool
 
@@ -30,18 +28,18 @@
 __all__ = ['PatientLabTestRequest']
 
 
+""" Add Lab order charges to service model """
 
-""" Add Lab order charges to service model """
 
 class PatientLabTestRequest(ModelSQL, ModelView):
     'Lab Order'
     __name__ = 'gnuhealth.patient.lab.test'
 
-
     service = fields.Many2One(
         'gnuhealth.health_service', 'Service',
-        domain=[('patient', '=', Eval('patient_id'))], depends=['patient'],
-        states = {'readonly': Equal(Eval('state'), 'done')},
+        domain=[('patient', '=', Eval('patient_id'))],
+        depends=['patient'],
+        states={'readonly': Equal(Eval('state'), 'done')},
         help="Service document associated to this Lab Request")
 
     @classmethod
@@ -53,7 +51,6 @@
             },
             })
 
-
     @classmethod
     @ModelView.button
     def update_service(cls, laborders):
@@ -77,12 +74,11 @@
             'qty': 1
             }]))
 
-            
         hservice.append(laborder.service)
-        
+
         description = "Services and Lab"
-        
-        service_data ['desc'] =  description
-        service_data ['service_line'] = service_lines
-                
+
+        service_data['desc'] = description
+        service_data['service_line'] = service_lines
+
         HealthService.write(hservice, service_data)
--- a/tryton/health_services_lab/tryton.cfg
+++ b/tryton/health_services_lab/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.8.0
+version=3.9.0
 depends:
     health_lab
     health_services
--- a/tryton/health_services_lab/wizard/wizard_health_services.py
+++ b/tryton/health_services_lab/wizard/wizard_health_services.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 ##############################################################################
 #
 #    GNU Health: The Free Health and Hospital Information System
@@ -21,11 +20,9 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
-import datetime
 from trytond.model import ModelView, fields
-from trytond.pyson import Eval, Not, Bool, PYSONEncoder, Equal, And, Or, If
-from trytond.wizard import Wizard, StateTransition, StateView, Button
-from trytond.transaction import Transaction
+from trytond.pyson import Eval, Equal
+from trytond.wizard import Wizard
 from trytond.pool import Pool
 
 
@@ -40,7 +37,7 @@
     service = fields.Many2One(
         'gnuhealth.health_service', 'Service',
         domain=[('patient', '=', Eval('patient'))], depends=['patient'],
-        states = {'readonly': Equal(Eval('state'), 'done')},
+        states={'readonly': Equal(Eval('state'), 'done')},
         help="Service document associated to this Lab Request")
 
 
@@ -65,10 +62,10 @@
                 lab_test['doctor_id'] = self.start.doctor.id
             lab_test['date'] = self.start.date
             lab_test['urgent'] = self.start.urgent
-            
+
             if self.start.service:
                 lab_test['service'] = self.start.service.id
-            
+
             lab_tests.append(lab_test)
 
         PatientLabTest.create(lab_tests)