can not access patient depend on deparment

stable
watcha.h 2016-06-01 10:17:32 +07:00
parent 661f25bf1a
commit 3ebf0d47de
2 changed files with 5 additions and 0 deletions

View File

@ -102,6 +102,7 @@ class CreateInvoicePayment(Model):
currency=settings.currency_id
if not currency:
raise Exception("Missing setting.currency")
#FIXME process only selected invoice
for inv in obj.invoices:
vals['invoice_lines'].append(('create',{
'invoice_id': inv.id,

View File

@ -1,4 +1,5 @@
from netforce.model import Model, fields, get_model
from netforce.access import set_active_user, get_active_user
class ReportCycleSetting(Model):
_name="clinic.report.cycle.setting"
@ -61,6 +62,8 @@ class ReportCycleSetting(Model):
if cycle_id:
dom.append(['cycle_id','=',cycle_id])
pcs=get_model("clinic.patient.cycle").search_browse(dom)
user_id=get_active_user()
set_active_user(1)
if not pcs:
# Create patient cycle with that department
for pt in get_model("clinic.patient").search_browse([['department_id','=',department_id]]):
@ -151,6 +154,7 @@ class ReportCycleSetting(Model):
nlines.append(line)
no+=1
set_active_user(user_id)
data={
'lines': nlines,
'department_id': department_id,