diff --git a/netforce_clinic/layouts/clinic_setting.xml b/netforce_clinic/layouts/clinic_setting.xml
index e3b7d50..ba56b29 100644
--- a/netforce_clinic/layouts/clinic_setting.xml
+++ b/netforce_clinic/layouts/clinic_setting.xml
@@ -12,9 +12,10 @@
-
+
+
@@ -22,15 +23,17 @@
+
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 9addf7e..0f69133 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -36,7 +36,7 @@ class HDCase(Model):
rmb_amt=0
due_amt=0
for line in obj.lines:
- if line.reimbursable:
+ if line.reimbursable=='yes':
rmb_amt+=line.amount or 0.0
else:
due_amt+=line.amount or 0.0
@@ -853,7 +853,7 @@ class HDCase(Model):
return res
- def get_staff_fee(self,vals,patient_id=None):
+ def get_staff_line(self,vals,patient_id=None):
if not patient_id:
return vals
# staff
@@ -882,13 +882,15 @@ class HDCase(Model):
amt=st_prod.amount
if not amt:
amt=qty*price
+ categ=st_prod.product_categ_id
vals['lines'].append(('create',{
'product_id': prod.id,
'uom_id': st_prod.uom_id.id,
- 'type': st_prod.type,
+ 'product_categ_id': categ.id,
'description': st_prod.description,
'price': price,
'qty': qty,
+ 'reimbursable': st_prod.reimbursable,
'amount': amt,
}))
# XXX need to get default
@@ -916,18 +918,15 @@ class HDCase(Model):
def create(self,vals,**kw):
patient_id=vals['patient_id']
- vals=self.get_staff_fee(vals,patient_id)
- vals=self.get_invoice_policy(vals,patient_id)
+ vals=self.get_staff_line(vals,patient_id)
new_id=super().create(vals,**kw)
return new_id
def write(self,ids,vals,**kw):
- patient_id=vals.get('patient_id')
- vals=self.get_invoice_policy(vals,patient_id)
obj=self.browse(ids)[0]
+ super().write(ids,vals,**kw)
if not obj.amount:
vals['req_fee']=1 # to show button pay
- super().write(ids,vals,**kw)
def approve(self,ids,context={}):
obj=self.browse(ids)[0]
diff --git a/netforce_clinic/models/hd_case_line.py b/netforce_clinic/models/hd_case_line.py
index 41ffa05..8eb89e9 100644
--- a/netforce_clinic/models/hd_case_line.py
+++ b/netforce_clinic/models/hd_case_line.py
@@ -17,7 +17,7 @@ class Hdcaseline(Model):
_defaults={
'type': 'others',
- 'reimbursable': False,
+ 'reimbursable': 'no',
}
Hdcaseline.register()
diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py
index 9020e47..4348a6d 100644
--- a/netforce_clinic/models/setting.py
+++ b/netforce_clinic/models/setting.py
@@ -54,6 +54,9 @@ class ClinicSetting(Model):
line['description']=prod.name
price=prod.sale_price or 0.0
line['price']=price
+ categ=prod.categ_id
+ if categ:
+ line['product_categ_id']=categ.id
qty=1
amt=qty*price
line['amount']=amt
diff --git a/netforce_clinic/models/setting_product.py b/netforce_clinic/models/setting_product.py
index f998c4a..97ed5e1 100644
--- a/netforce_clinic/models/setting_product.py
+++ b/netforce_clinic/models/setting_product.py
@@ -6,8 +6,9 @@ class SettingProduct(Model):
_fields={
"setting_id": fields.Many2One("clinic.setting","Setting"),
- "type": fields.Selection([("fee","Fee"),('medicine','Medicine'),('service','Service'),("others","Others")],"Type",required=True),
"patient_type_id": fields.Many2One("clinic.patient.type","Patient Type"),
+ "product_categ_id": fields.Many2One("product.categ","Category",domain=[['expense','=',True]]),
+ 'reimbursable': fields.Selection([['yes','Yes'],['no','No']],"Reimbursable"),
'uom_id': fields.Many2One("uom","UOM", required=True),
"product_id": fields.Many2One("product","Product"),
'description': fields.Char("Description"),
@@ -17,12 +18,13 @@ class SettingProduct(Model):
}
_defaults={
- 'type': 'fee',
- 'patient_type': 'sc',
+ #'type': 'fee',
+ #'patient_type': 'sc',
'qty': 1,
+ 'reimbursable': 'no',
}
- _order="patient_type_id,type"
+ _order="patient_type_id"
SettingProduct.register()
diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py
index 810c1b9..57fecf1 100644
--- a/netforce_clinic/models/visit_board.py
+++ b/netforce_clinic/models/visit_board.py
@@ -138,6 +138,7 @@ class VisitBoard(Model):
number='*(ยกเลิก)'
else:
number+='(ยกเลิก)'
+ print('sickbed_id ', sickbed_id)
line={
'number': number,
'hn_name': hn_name,
@@ -194,7 +195,7 @@ class VisitBoard(Model):
line['cycle_name']=utils.date2thai(date,format='%(Td)s %(d)s %(Tm)s',lang="th_TH2"),
lines.insert(index,line)
dates.append(date)
- if count==total_qty and not obj.patient_id:
+ if count==total_qty and not patient_id:
index+=1
# footer
line=empty_line.copy()
diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs
index 335a9d5..c55a0a3 100644
--- a/netforce_clinic/templates/visit_board.hbs
+++ b/netforce_clinic/templates/visit_board.hbs
@@ -45,7 +45,11 @@
{{patient_name}} |
{{patient_type}} |
{{doctor_name}} |
- {{sickbed_name}} |
+ {{#if sickbed_id}}
+ {{sickbed_name}} |
+ {{else}}
+ {{sickbed_name}} |
+ {{/if}}
{{hd_case_number}} |
{{note}} |
{{/if}}