diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml
index 03239c5..3408b5d 100644
--- a/netforce_clinic/layouts/clinic_hd_case_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_form.xml
@@ -3,7 +3,6 @@
@@ -100,7 +99,7 @@
-
+
@@ -120,8 +119,8 @@
-
+
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 7d9b480..ff0b5a7 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -249,13 +249,13 @@ class HDCase(Model):
payment_id=get_model("account.payment").create(vals,context={"type":"in"})
obj.write({
- #'pay_amount': remaining_amt-obj.pay_amount,
- #'pay_amount': 0, # reset
'payment_lines': [('create',{
'payment_id': payment_id,
'amount': pay_amount,
})],
})
+ payment=get_model('account.payment').browse(payment_id)
+ payment.post()
return {
'next': {
'name': 'clinic_hd_case',
@@ -453,9 +453,11 @@ class HDCase(Model):
for obj in self.browse(ids):
for dlz_line in obj.dialyzers:
dlz=dlz_line.dialyzer_id
- dlz.write({
- 'use_time': dlz_line.use_time,
- })
+ #XXX
+ if dlz_line.use_time > dlz.use_time:
+ dlz.write({
+ 'use_time': dlz_line.use_time,
+ })
return True
def complete(self,ids,context={}):
@@ -573,6 +575,7 @@ class HDCase(Model):
def done(self,ids,context={}):
obj=self.browse(ids)[0]
+ obj.update_usetime()
obj.write({
'state': 'waiting_payment',
})
diff --git a/netforce_clinic/models/hd_case_payment.py b/netforce_clinic/models/hd_case_payment.py
index 809a0bb..f24855a 100644
--- a/netforce_clinic/models/hd_case_payment.py
+++ b/netforce_clinic/models/hd_case_payment.py
@@ -9,7 +9,7 @@ class HDCasePayment(Model):
"pay_amount": fields.Float("Due Amount"),
"fee": fields.Float("Fee"),
"to_pay": fields.Float("To Pay"),
- "complete": fields.Boolean("Complete"),
+ "complete": fields.Boolean("Mark as full payment for Cash"),
}
def _get_hd_case_id(self,context={}):
@@ -43,43 +43,45 @@ class HDCasePayment(Model):
def cash(self,ids,context):
obj=self.browse(ids)[0]
+ hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
+ context['amount']=obj.pay_amount or 0.0
+ context['make_invoice']=False
+ hd_case.make_invoices(context=context) #XXX
+ hd_case.post_invoices()
if obj.pay_amount:
- hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
- context['amount']=obj.pay_amount or 0.0
- context['make_invoice']=False
- hd_case.make_invoices(context=context) #XXX
hd_case.make_payment(context=context)
- if obj.complete:
- hd_case.write({
- 'state': 'completed',
- })
- obj.write({
- 'pay_amount': hd_case.amount,
+ if obj.complete:
+ hd_case.write({
+ 'state': 'completed',
})
+ obj.write({
+ 'pay_amount': hd_case.amount,
+ })
return {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': hd_case.id,
},
- 'flash': 'Paid',
+ 'flash': '%s has been paid'%hd_case.number,
}
def credit(self,ids,context):
obj=self.browse(ids)[0]
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
hd_case.make_invoices()
- if obj.complete:
- hd_case.write({
- 'state': 'completed',
- })
+ hd_case.post_invoices()
+ #if obj.complete:
+ hd_case.write({
+ 'state': 'completed',
+ })
return {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': hd_case.id,
},
- 'flash': 'Paid',
+ 'flash': '%s has been paid'%hd_case.number,
}
def onchange_amount(self,context={}):
diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py
index 0e53b0f..585aad1 100644
--- a/netforce_clinic/models/visit.py
+++ b/netforce_clinic/models/visit.py
@@ -115,7 +115,6 @@ class Visit(Model):
'cycle_id' : obj.cycle_id.id,
'visit_id': obj.id,
'cycle_id': obj.cycle_id.id,
- 'fee_type': obj.patient_id.type,
'lines':[],
'dialyzers': [],
'state': 'draft',