From bce643eec64badcac9441b25cd1b29e2b2cd9369 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 4 Mar 2015 11:54:55 +0700 Subject: [PATCH] receipt pdf --- .../layouts/clinic_hd_case_form.xml | 3 +- netforce_clinic/layouts/clinic_shop_form.xml | 4 ++- netforce_clinic/models/hd_case.py | 17 ++------- netforce_clinic/models/setting.py | 36 +++++++++++++++++++ netforce_clinic/models/shop.py | 12 ++----- netforce_clinic/todo.txt | 8 ++++- 6 files changed, 52 insertions(+), 28 deletions(-) diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml index 29ab6cc..6433f71 100644 --- a/netforce_clinic/layouts/clinic_hd_case_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_form.xml @@ -2,7 +2,8 @@ diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index faaf38d..874024f 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -1019,6 +1019,8 @@ class HDCase(Model): settings=get_model('settings').browse(1) pages=[] for obj in self.browse(ids): + if not obj.payments: + raise Exception("Receipt not found!") for payment in obj.payments: context['payment_id']=payment.id data=self.get_report_payment_data(context=context) @@ -1372,19 +1374,4 @@ class HDCase(Model): } } - def print_receipt(self,ids,context={}): - obj=self.browse(ids)[0] - payment_id=None - for payment in obj.payments: - payment_id=payment.id - if not payment_id: - raise Exception("Receipt not found!") - return { - 'next': { - 'name': 'report_clinic_payment_form', - 'refer_id': obj.id, - 'payment_id': payment_id, - }, - } - HDCase.register() diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 0f1a3bb..d3190b2 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -122,6 +122,42 @@ class ClinicSetting(Model): return def run_script(self,ids,context={}): + user_id=get_active_user() + if user_id !=1: + print("Only admin!!") + return + print("Done!") + return + + def update_staff_department(self,ids,context={}): + user_id=get_active_user() + if user_id !=1: + print("Only admin!!") + return + b={} + for dpt in get_model("clinic.department").search_browse([]): + branch=dpt.branch_id + if not branch.id in b: + b[branch.id]=[] + b[branch.id].append(dpt.id) + + for staff in get_model("clinic.staff").search_browse([]): + if not staff.departments: + dpt=staff.department_id + branch=staff.branch_id + dpt_ids=[] + if dpt: + dpt_ids.append(dpt.id) + elif branch: + dpt_ids=b.get(branch.id) + staff.write({ + 'departments': [('set',dpt_ids)], + }) + print(staff.name) + print("Done!") + return + + def udpate_staff_level(self,ids,context={}): user_id=get_active_user() if user_id !=1: print("Only admin!!") diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py index 6907e25..ad0569f 100644 --- a/netforce_clinic/models/shop.py +++ b/netforce_clinic/models/shop.py @@ -482,7 +482,7 @@ class Shop(Model): }, } - def get_bill(self,context={}): + def get_page(self,context={}): if not context.get('refer_id'): return {} shop_id=int(context['refer_id']) @@ -569,7 +569,7 @@ class Shop(Model): pages=[] for obj in get_model('clinic.shop').browse(ids): context['refer_id']=obj.id - data=get_model('clinic.shop').get_bill(context=context) + data=get_model('clinic.shop').get_page(context=context) pages.append(data) if pages: pages[-1]["is_last_page"]=True @@ -578,14 +578,6 @@ class Shop(Model): "logo": get_file_path(settings.logo), } - def print_bill(self,ids,context={}): - return { - 'next': { - 'refer_id': ids[0], - 'name': 'clinic_cust_print', - } - } - def pay(self,ids,context={}): res={} obj=self.browse(ids)[0] diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 199d469..62ae521 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,10 +1,16 @@ todo: - report k. boy (sub detail) -> ok + - need to update level of nurse (Chanon) - staff rotation - update level for staff - add script to - - multi department access + - multi department access *** - merge staff same name but different department + - doctor นายแพทย์ ทวีชัย + - ** udpate server (run click me) + - ** update accounting + - bug + - wht (david) =============================== - compute labor cost