From 3ebf0d47de40bd0bb11c830a5df36d2082fc0b04 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 1 Jun 2016 10:17:32 +0700 Subject: [PATCH] can not access patient depend on deparment --- netforce_clinic/models/create_invoice_payment.py | 1 + netforce_clinic/models/report_cycle_setting.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/netforce_clinic/models/create_invoice_payment.py b/netforce_clinic/models/create_invoice_payment.py index 1dd284c..5a2542b 100644 --- a/netforce_clinic/models/create_invoice_payment.py +++ b/netforce_clinic/models/create_invoice_payment.py @@ -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, diff --git a/netforce_clinic/models/report_cycle_setting.py b/netforce_clinic/models/report_cycle_setting.py index 1929938..60da558 100644 --- a/netforce_clinic/models/report_cycle_setting.py +++ b/netforce_clinic/models/report_cycle_setting.py @@ -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,