fix show button claim exp after paid
parent
396d50a9ef
commit
5b8712f1a2
|
@ -2,7 +2,7 @@
|
||||||
<field name="string">Staffs</field>
|
<field name="string">Staffs</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="model">clinic.staff</field>
|
<field name="model">clinic.staff</field>
|
||||||
<field name="tabs">[["All",[]],["Archived",[["active","=",false]]],["Staff",[["type","=","staff"]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]]</field>
|
<field name="tabs">[["All",[]],["Archived",[["active","=",false]]],["Staffs",[["type","=","staff"]]],["Doctors",[["type","=","doctor"]]],["Nurses",[["type","=","nurse"]]]]</field>
|
||||||
<field name="modes">list,page,form</field>
|
<field name="modes">list,page,form</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
<field name="limit">25</field>
|
<field name="limit">25</field>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<field name="model">clinic.staff.rotation</field>
|
<field name="model">clinic.staff.rotation</field>
|
||||||
<field name="tabs">[
|
<field name="tabs">[
|
||||||
["All",[]],
|
["All",[]],
|
||||||
["Nurse",[["type","=","nurse"]]],
|
["Nurses",[["type","=","nurse"]]],
|
||||||
["Doctor",[["type","=","doctor"]]],
|
["Doctors",[["type","=","doctor"]]],
|
||||||
["Draft",[["state","=","draft"]]],
|
["Draft",[["state","=","draft"]]],
|
||||||
["Approved",[["state","=","approved"]]]
|
["Approved",[["state","=","approved"]]]
|
||||||
]</field>
|
]</field>
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
<head>
|
<head>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="Copy"/>
|
<!--<item string="Copy" method="copy"/>-->
|
||||||
|
<item string="New Staff Rotation" action="clinic_staff_rotate" action_options="form"/>
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
</head>
|
</head>
|
||||||
<field name="type" required="1"/>
|
<field name="type" required="1"/>
|
||||||
<field name="staff_id" domain='[["type","=",type]]' required="1"/>
|
<field name="staff_id" domain='[["type","=",type]]' required="1"/>
|
||||||
<field name="level_id"/>
|
<field name="level_id" attrs='{"required":[["type","=","nurse"]]}'/>
|
||||||
<field name="categ_id"/>
|
<field name="categ_id" attrs='{"required":[["type","=","nurse"]]}'/>
|
||||||
<field name="hire_date"/>
|
<field name="hire_date"/>
|
||||||
<field name="resign_date"/>
|
<!--<field name="resign_date"/>-->
|
||||||
<field name="wage"/>
|
<field name="wage"/>
|
||||||
<field name="max_cycle"/>
|
<field name="max_cycle"/>
|
||||||
<field name="ot_per_cycle"/>
|
<field name="ot_per_cycle"/>
|
||||||
|
|
|
@ -131,6 +131,40 @@ class HDCase(Model):
|
||||||
set_active_user(user_id)
|
set_active_user(user_id)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def _get_req_fee(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
total_amt=0
|
||||||
|
rmb_amt=0
|
||||||
|
for line in obj.lines:
|
||||||
|
amt=line.amount or 0
|
||||||
|
if line.reimbursable=='yes':
|
||||||
|
rmb_amt+=amt
|
||||||
|
total_amt+=amt
|
||||||
|
pm_amt=0
|
||||||
|
for pline in obj.payment_lines:
|
||||||
|
pm_amt+=pline.amount or 0
|
||||||
|
due_amt=total_amt-pm_amt-rmb_amt
|
||||||
|
paid=0
|
||||||
|
if due_amt>0:
|
||||||
|
paid=1
|
||||||
|
res[obj.id]=paid
|
||||||
|
return res
|
||||||
|
|
||||||
|
def _get_hct_msg(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
msg=""
|
||||||
|
hct=obj.hct or 0
|
||||||
|
if(hct<=36):
|
||||||
|
msg="สามารถเบิกค่ายาสูงสุดไม่เกิน 1,125บาท ต่อ สัปดาห์"
|
||||||
|
elif(hct>36 and hct<=39):
|
||||||
|
msg="สามารถเบิกค่ายาสูงสุดไม่เกิน 750บาท ต่อ สัปดาห์"
|
||||||
|
elif(hct> 39):
|
||||||
|
msg="ไม่สามารถเบิกค่ายาฉีดได้ทุกตัว"
|
||||||
|
res[obj.id]=msg
|
||||||
|
return res
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"number": fields.Char("Number",required=True,search=True),
|
"number": fields.Char("Number",required=True,search=True),
|
||||||
"epo": fields.Char("EPO",function="_get_expense",function_multi=True),
|
"epo": fields.Char("EPO",function="_get_expense",function_multi=True),
|
||||||
|
@ -161,7 +195,7 @@ class HDCase(Model):
|
||||||
"bid_flow_rate": fields.Integer("BFR (ml/min)"),
|
"bid_flow_rate": fields.Integer("BFR (ml/min)"),
|
||||||
"ultrafittration": fields.Float("Ultrafiltration (kg.)"),
|
"ultrafittration": fields.Float("Ultrafiltration (kg.)"),
|
||||||
"hct": fields.Integer("Hct"),
|
"hct": fields.Integer("Hct"),
|
||||||
"hct_msg" : fields.Char(""),
|
"hct_msg" : fields.Char("",function="_get_hct_msg",store=True),
|
||||||
'hct_include': fields.Boolean("HCT Include", function="_get_store", function_multi=True,store=True),
|
'hct_include': fields.Boolean("HCT Include", function="_get_store", function_multi=True,store=True),
|
||||||
'type_code': fields.Char("Product Code", function="_get_store", function_multi=True,store=True),
|
'type_code': fields.Char("Product Code", function="_get_store", function_multi=True,store=True),
|
||||||
"state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),("completed","Finish Treatment"),('paid','Paid'),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),("completed","Finish Treatment"),('paid','Paid'),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",required=True),
|
||||||
|
@ -195,7 +229,7 @@ class HDCase(Model):
|
||||||
'nu': fields.Char("N/U"),
|
'nu': fields.Char("N/U"),
|
||||||
"invoice_policy": fields.Selection([("fee","Only Fee"),("fee_mdc","Fee & Medicine")],"Government pay for:"),
|
"invoice_policy": fields.Selection([("fee","Only Fee"),("fee_mdc","Fee & Medicine")],"Government pay for:"),
|
||||||
"invoice_option": fields.Selection([("fee_mdc_plus","Combine Fee & Medicine"),("fee_mdc_split","Split Fee & Medicine")],"Invoice:"),
|
"invoice_option": fields.Selection([("fee_mdc_plus","Combine Fee & Medicine"),("fee_mdc_split","Split Fee & Medicine")],"Invoice:"),
|
||||||
'req_fee': fields.Integer("Request Expense"),
|
'req_fee': fields.Integer("Request Expense",function="_get_req_fee"),
|
||||||
'hd_case_id': fields.Many2One("clinic.hd.case","HD",function="_get_all",function_multi=True), # XXX
|
'hd_case_id': fields.Many2One("clinic.hd.case","HD",function="_get_all",function_multi=True), # XXX
|
||||||
'company_id': fields.Many2One("company","Company"),
|
'company_id': fields.Many2One("company","Company"),
|
||||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||||
|
@ -1364,62 +1398,6 @@ class HDCase(Model):
|
||||||
patient.write({
|
patient.write({
|
||||||
'vascular_acc': vals['vascular_acc']
|
'vascular_acc': vals['vascular_acc']
|
||||||
})
|
})
|
||||||
|
|
||||||
############ to show pay button ###########
|
|
||||||
total_amt=0
|
|
||||||
due_amt=0
|
|
||||||
if 'lines' in vals.keys():
|
|
||||||
for line in vals['lines']:
|
|
||||||
mode=line[0]
|
|
||||||
amt=0
|
|
||||||
rmb='no'
|
|
||||||
if mode=='create':
|
|
||||||
line_vals=line[1]
|
|
||||||
amt=line_vals.get("amount",0)
|
|
||||||
elif mode=='delete':
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
mode=line[0]
|
|
||||||
if mode=='create':
|
|
||||||
prod_id=line[1]['product_id']
|
|
||||||
prod=get_model("product").browse(prod_id)
|
|
||||||
line['uom_id']=prod.uom_id.id
|
|
||||||
continue
|
|
||||||
line_id=line[1][0]
|
|
||||||
line_vals=line[2]
|
|
||||||
rmb=line_vals.get("reimbursable","no")
|
|
||||||
line=get_model('clinic.hd.case.line').browse(line_id)
|
|
||||||
amt=line.amount or 0
|
|
||||||
total_amt+=amt
|
|
||||||
if rmb=='no':
|
|
||||||
due_amt+=amt
|
|
||||||
else:
|
|
||||||
for line in obj.lines:
|
|
||||||
amt=line.amount or 0
|
|
||||||
total_amt+=amt
|
|
||||||
if line.reimbursable=='no':
|
|
||||||
due_amt+=amt
|
|
||||||
pay_amt=0
|
|
||||||
if 'payment_lines' in vals.keys():
|
|
||||||
for line in vals['payment_lines']:
|
|
||||||
mode=line[0]
|
|
||||||
if mode=='create':
|
|
||||||
line_vals=line[1]
|
|
||||||
else:
|
|
||||||
line_vals=line[2]
|
|
||||||
pay_amt+=line_vals.get("amount",0)
|
|
||||||
for pline in obj.payment_lines:
|
|
||||||
pay_amt+=pline.amount or 0
|
|
||||||
due_amt-=pay_amt
|
|
||||||
|
|
||||||
vals['req_fee']=0
|
|
||||||
if due_amt<=0:
|
|
||||||
vals['req_fee']=0
|
|
||||||
elif due_amt>0:
|
|
||||||
vals['req_fee']=1
|
|
||||||
|
|
||||||
#################################################3
|
|
||||||
|
|
||||||
if 'sickbed_id' in vals.keys():
|
if 'sickbed_id' in vals.keys():
|
||||||
user_id=get_active_user()
|
user_id=get_active_user()
|
||||||
set_active_user(1)
|
set_active_user(1)
|
||||||
|
|
|
@ -45,9 +45,16 @@ class HDCasePayment(Model):
|
||||||
hd_case.post_invoices()
|
hd_case.post_invoices()
|
||||||
if obj.pay_amount:
|
if obj.pay_amount:
|
||||||
hd_case.make_payment(context=context)
|
hd_case.make_payment(context=context)
|
||||||
|
hd_case.do_expense()
|
||||||
|
|
||||||
|
inv_remain_amount=0
|
||||||
|
for inv in hd_case.invoices:
|
||||||
|
inv_remain_amount+=(inv.amount_subtotal-inv.amount_paid)
|
||||||
if obj.complete:
|
if obj.complete:
|
||||||
hd_case.create_cycle_item()
|
hd_case.create_cycle_item()
|
||||||
if obj.pay_amount==obj.to_pay:
|
#due_amount -> only not reimbursable
|
||||||
|
total=hd_case.due_amount-obj.to_pay
|
||||||
|
if total<=0 and inv_remain_amount<=0:
|
||||||
vals={
|
vals={
|
||||||
'state': 'paid',
|
'state': 'paid',
|
||||||
}
|
}
|
||||||
|
@ -56,7 +63,6 @@ class HDCasePayment(Model):
|
||||||
'state': 'waiting_payment',
|
'state': 'waiting_payment',
|
||||||
}
|
}
|
||||||
hd_case.write(vals)
|
hd_case.write(vals)
|
||||||
hd_case.do_expense()
|
|
||||||
obj.write({
|
obj.write({
|
||||||
'pay_amount': hd_case.amount,
|
'pay_amount': hd_case.amount,
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,13 +14,14 @@ class PatientType(Model):
|
||||||
'hct_include': fields.Boolean("HCT Include"),
|
'hct_include': fields.Boolean("HCT Include"),
|
||||||
'main_product': fields.Boolean("Use Main Product for Create GI"),
|
'main_product': fields.Boolean("Use Main Product for Create GI"),
|
||||||
'company_id': fields.Many2One("company","Company"),
|
'company_id': fields.Many2One("company","Company"),
|
||||||
'color': fields.Char("Color"),
|
#'color': fields.Char("Color"),
|
||||||
|
'color': fields.Selection([['default','Default'],['danger','Danger'],['info','Info'],['warning','Warning'],['primary','Primary']],"Color"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
'defaults': False,
|
'defaults': False,
|
||||||
'company_id': lambda *a: get_active_company(),
|
'company_id': lambda *a: get_active_company(),
|
||||||
|
'color': 'default',
|
||||||
}
|
}
|
||||||
|
|
||||||
def new_contact(self,ids,context={}):
|
def new_contact(self,ids,context={}):
|
||||||
|
|
|
@ -150,10 +150,18 @@ class ClinicSetting(Model):
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
|
|
||||||
for rt in get_model("clinic.staff.rotation").search_browse([]):
|
dom=[
|
||||||
rt.write({
|
['type','=','doctor'],
|
||||||
'note': ' ',
|
]
|
||||||
|
for st in get_model("clinic.staff").search_browse(dom):
|
||||||
|
dpt_ids=[]
|
||||||
|
for b in get_model("clinic.branch").browse([]):
|
||||||
|
for dpt in b.departments:
|
||||||
|
dpt_ids.append(dpt.id)
|
||||||
|
st.write({
|
||||||
|
'departments': [('set',dpt_ids)],
|
||||||
})
|
})
|
||||||
|
print('dpt_ids ', dpt_ids)
|
||||||
print("Done!")
|
print("Done!")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue