From 4fa63302e187db275530681602a73f695f0ceec0 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Thu, 11 Feb 2016 14:07:42 +0700 Subject: [PATCH] should enter product if have fee charge --- netforce_clinic/layouts/clinic_hd_case_form.xml | 5 ++--- netforce_clinic/migrations/__init__.py | 2 +- netforce_clinic/models/hd_case.py | 14 +++++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml index 6587a9b..6e361dd 100644 --- a/netforce_clinic/layouts/clinic_hd_case_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_form.xml @@ -64,7 +64,7 @@ - + @@ -100,9 +100,8 @@ - + - diff --git a/netforce_clinic/migrations/__init__.py b/netforce_clinic/migrations/__init__.py index 2bc41ae..3619ae7 100644 --- a/netforce_clinic/migrations/__init__.py +++ b/netforce_clinic/migrations/__init__.py @@ -6,4 +6,4 @@ #from . import del_gi #from . import restore_picking #from . import rename_dbl_hdcase_number -from . import reset_hdcase_number +#from . import reset_hdcase_number diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index d4532e9..9d4d1b5 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -1150,10 +1150,22 @@ class HDCase(Model): def done(self,ids,context={}): obj=self.browse(ids)[0] if obj.patient_type_id.code=='SSO': + cond1=False + cond2=False for line in obj.lines: prod=line.product_id + categ=line.product_categ_id + # force to enter unit price if not line.price and prod: - raise Exception("Can not complete HDCase because price of product %s is missing!"%(prod.name)) + raise Exception("Missing unit price for product [%s] %s!"%(prod.code,prod.name)) + elif not prod and categ.code=='EPO': + cond2=True + if categ.code=='FEE' and line.price: + cond1=True + # if fee and not enter product then hdcase should not finish + if cond1 and cond2: + raise Exception("%s is missing product"%(categ.name)) + count=0 for sline in obj.staffs: if sline.staff_id: