[FIX] report nurse: prevent permission

fix1
SPP 2018-06-07 17:12:37 +07:00
parent 02184b877b
commit b1869c3b3b
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import time
from calendar import monthrange from calendar import monthrange
from netforce.model import Model,fields,get_model from netforce.model import Model,fields,get_model
from netforce.access import get_active_company from netforce.access import get_active_company, get_active_user, set_active_user
from . import utils from . import utils
@ -76,6 +76,8 @@ class ReportDiscontinuePatient(Model):
records=get_model('clinic.patient.move').search_browse(dom) records=get_model('clinic.patient.move').search_browse(dom)
lines=[] lines=[]
no=1 no=1
user_id=get_active_user()
set_active_user(1)
for record in records: for record in records:
if record.patient_id.branch_id.id!=branch_id: if record.patient_id.branch_id.id!=branch_id:
continue continue
@ -91,6 +93,7 @@ class ReportDiscontinuePatient(Model):
'resign_date': record.date[:10] or '', 'resign_date': record.date[:10] or '',
}) })
no+=1 no+=1
set_active_user(user_id)
month_str=utils.MONTHS['th_TH'][int(month)] month_str=utils.MONTHS['th_TH'][int(month)]
start=int(time_start[8:10]) start=int(time_start[8:10])
stop=int(time_stop[8:10]) stop=int(time_stop[8:10])

View File

@ -2,7 +2,7 @@ import time
from calendar import monthrange from calendar import monthrange
from netforce.model import Model,fields,get_model from netforce.model import Model,fields,get_model
from netforce.access import get_active_company, get_active_user from netforce.access import get_active_company, get_active_user, set_active_user
from . import utils from . import utils
@ -75,6 +75,8 @@ class ReportRecentPatient(Model):
records=get_model('clinic.patient.move').search_browse(dom) records=get_model('clinic.patient.move').search_browse(dom)
lines=[] lines=[]
no=1 no=1
user_id=get_active_user()
set_active_user(1)
for record in records: for record in records:
if record.patient_id.branch_id.id!=branch_id: if record.patient_id.branch_id.id!=branch_id:
continue continue
@ -90,6 +92,7 @@ class ReportRecentPatient(Model):
'reg_date': record.date[:10], 'reg_date': record.date[:10],
}) })
no+=1 no+=1
set_active_user(user_id)
month_str=utils.MONTHS['th_TH'][int(month)] month_str=utils.MONTHS['th_TH'][int(month)]
start=int(time_start[8:10]) start=int(time_start[8:10])