[tryton-debian-vcs] tryton-modules-health-inpatient branch debian updated. debian/3.0.3-1-2-g4435182

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Mon Dec 12 15:28:42 UTC 2016


The following commit has been merged in the debian branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-health-inpatient.git;a=commitdiff;h=debian/3.0.3-1-2-g4435182

commit 44351826fc7800a0da8e16ece655ffc515cf147b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Dec 12 16:03:39 2016 +0100

    Releasing debian version 3.0.5-1.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/debian/changelog b/debian/changelog
index b6ca0e5..639bd79 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+tryton-modules-health-inpatient (3.0.5-1) unstable; urgency=medium
+
+  * Merging upstream version 3.0.5.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Mon, 12 Dec 2016 16:03:39 +0100
+
 tryton-modules-health-inpatient (3.0.3-1) unstable; urgency=medium
 
   * Merging upstream version 3.0.3.
commit 1aa5cf4ab4f950408bf04adbb95f2f25fd87d296
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Dec 12 16:03:39 2016 +0100

    Merging upstream version 3.0.5.

diff --git a/PKG-INFO b/PKG-INFO
index d9f207b..0e56c93 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_health_inpatient
-Version: 3.0.3
+Version: 3.0.5
 Summary: GNU Health Hospitalization Module
 Home-page: http://health.gnu.org/
 Author: GNU Solidario
diff --git a/health_inpatient.py b/health_inpatient.py
index 5bebb9c..32ab293 100644
--- a/health_inpatient.py
+++ b/health_inpatient.py
@@ -28,6 +28,7 @@ from sql import Literal, Table
 from trytond.pool import Pool
 from trytond.pyson import Eval, Not, Bool, And, Equal, Or
 from trytond import backend
+import pytz
 
 
 __all__ = ['InpatientSequences', 'DietTherapeutic','InpatientRegistration', 
@@ -206,7 +207,8 @@ class InpatientRegistration(ModelSQL, ModelView):
                 'bed_is_not_available': 'Bed is not available',
                 'discharge_reason_needed': 'Admission and Discharge reasons \n'
                 'as well as Discharge Dx are needed',
-                'destination_bed_unavailable': 'Destination bed unavailable'})
+                'destination_bed_unavailable': 'Destination bed unavailable',
+                'need_timezone':'You need to set up the company timezone'})
         cls._buttons.update({
                 'confirmed': {
                     'invisible': And(Not(Equal(Eval('state'), 'free')),
@@ -297,12 +299,28 @@ class InpatientRegistration(ModelSQL, ModelView):
         registration_id = registrations[0]
         Bed = Pool().get('gnuhealth.hospital.bed')
 
-        if (registration_id.hospitalization_date.date() !=
-            datetime.today().date()):
-            cls.raise_user_error("The Admission date must be today")
-        else:
-            cls.write(registrations, {'state': 'hospitalized'})
-            Bed.write([registration_id.bed], {'state': 'occupied'})
+        Company = Pool().get('company.company')
+
+        timezone = None
+        company_id = Transaction().context.get('company')
+        if company_id:
+            company = Company(company_id)
+            if company.timezone:
+                timezone = pytz.timezone(company.timezone)
+                
+                dt = datetime.today()
+                dt_local = datetime.astimezone(dt.replace(tzinfo=pytz.utc),
+                 timezone)        
+
+                if (registration_id.hospitalization_date.date() !=
+                    dt_local.date()):
+                    cls.raise_user_error("The Admission date must be today")
+                else:
+                    cls.write(registrations, {'state': 'hospitalized'})
+                    Bed.write([registration_id.bed], {'state': 'occupied'})
+
+            else:
+               cls.raise_user_error('need_timezone')
 
     @classmethod
     def create(cls, vlist):
diff --git a/tryton.cfg b/tryton.cfg
index af7c241..79b0970 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.0.3
+version=3.0.5
 depends:
     health
     health_lifestyle
diff --git a/trytond_health_inpatient.egg-info/PKG-INFO b/trytond_health_inpatient.egg-info/PKG-INFO
index a4214f9..3bd74b0 100644
--- a/trytond_health_inpatient.egg-info/PKG-INFO
+++ b/trytond_health_inpatient.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-health-inpatient
-Version: 3.0.3
+Version: 3.0.5
 Summary: GNU Health Hospitalization Module
 Home-page: http://health.gnu.org/
 Author: GNU Solidario
diff --git a/trytond_health_inpatient.egg-info/requires.txt b/trytond_health_inpatient.egg-info/requires.txt
index 7f76603..187888b 100644
--- a/trytond_health_inpatient.egg-info/requires.txt
+++ b/trytond_health_inpatient.egg-info/requires.txt
@@ -1,3 +1,3 @@
-trytond_health == 3.0.3
-trytond_health_lifestyle == 3.0.3
+trytond_health == 3.0.5
+trytond_health_lifestyle == 3.0.5
 trytond >= 3.8, < 3.9
-- 
tryton-modules-health-inpatient



More information about the tryton-debian-vcs mailing list