lock
parent
15e6f3d834
commit
2b0a6bbecd
|
@ -11,25 +11,27 @@
|
|||
<field name="cycle_id" required="1"/>
|
||||
<field name="date"/>
|
||||
<tabs>
|
||||
<!--
|
||||
<tab string="HDCase">
|
||||
<field name="hd_cases" nolabel="1" count="5">
|
||||
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_payment"]],"#70DB93":[["state","=","paid"]]}'>
|
||||
<field name="sickbed_id" domain="[['available','=',true]]" span="2"/>
|
||||
<field name="patient_id" span="2"/>
|
||||
<!--<field name="time_start" span="2"/>-->
|
||||
<field name="time_start" span="2"/>
|
||||
<field name="wt_start" span="2"/>
|
||||
<field name="bp_start" span="2"/>
|
||||
<field name="membrane_type" span="2"/>
|
||||
<field name="vascular_acc" span="2"/>
|
||||
<field name="bid_flow_rate" span="2"/>
|
||||
<field name="ultrafittration" span="2"/>
|
||||
<!--<field name="time_stop" span="2"/>-->
|
||||
<field name="time_stop" span="2"/>
|
||||
<field name="wt_stop" span="2"/>
|
||||
<field name="bp_stop" span="2"/>
|
||||
<field name="hd_case_id" span="2"/>
|
||||
</list>
|
||||
</field>
|
||||
</tab>
|
||||
-->
|
||||
<tab string="Nurses">
|
||||
<field name="nurses" nolabel="1">
|
||||
<list>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<item string="To Draft" method="to_draft" states="completed,cancelled"/>
|
||||
</button>
|
||||
</head>
|
||||
<group form_layout="stacked">
|
||||
<group form_layout="stacked" attrs='{"readonly":[["state","=","completed"]]}'>
|
||||
<field name="number" span="2"/>
|
||||
<field name="sickbed_id" domain="[['available','=',true]]" required="1" span="2"/>
|
||||
<field name="patient_id" span="2" onchange="onchange_patient"/>
|
||||
|
@ -19,7 +19,7 @@
|
|||
</group>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
<group form_layout="form">
|
||||
<group form_layout="form" attrs='{"readonly":[["state","=","completed"]]}'>
|
||||
<field name="time_start" span="2"/>
|
||||
<field name="time_stop" span="2"/>
|
||||
<field name="duration" span="2"/>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<field name="membrane_type" span="2" />
|
||||
<field name="bid_flow_rate" span="2"/>
|
||||
<field name="ultrafittration" span="2"/>
|
||||
<field name="dialyzers" nolabel="1">
|
||||
<field name="dialyzers" nolabel="1" attrs='{"readonly":[["state","=","completed"]]}'>
|
||||
<list>
|
||||
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
|
||||
<field name="dialyzer_type" span="2"/>
|
||||
|
@ -52,9 +52,10 @@
|
|||
<group span="12" form_layout="stacked">
|
||||
<field name="lines" count="3" nolabel="1">
|
||||
<list>
|
||||
<field name="type" onchange="onchange_type"/>
|
||||
<field name="product_id" onchange="onchange_product"/>
|
||||
<field name="product_categ_id" onchange="onchange_line"/>
|
||||
<field name="description"/>
|
||||
<field name="reimbursable" onchange="onchange_line"/>
|
||||
<field name="qty" onchange="onchange_line"/>
|
||||
<field name="uom_id"/>
|
||||
<field name="price" onchange="onchange_line"/>
|
||||
|
@ -70,10 +71,9 @@
|
|||
</group>
|
||||
</group>
|
||||
<group span="4" columns="1">
|
||||
<field name="total"/>
|
||||
<field name="fee_amount"/>
|
||||
<field name="mdc_amount"/>
|
||||
<field name="srv_amount"/>
|
||||
<field name="total_amount"/>
|
||||
<field name="rmb_amount"/>
|
||||
<field name="due_amount"/>
|
||||
<field name="payment_lines" nolabel="1">
|
||||
<template>
|
||||
{{#each context.data}}
|
||||
|
@ -88,14 +88,13 @@
|
|||
{{/each}}
|
||||
</template>
|
||||
</field>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Doctors">
|
||||
<field name="staffs" nolabel="1">
|
||||
<list>
|
||||
<field name="type"/>
|
||||
<field name="staff_id" domain="[['type','=',type]]"/>
|
||||
<!--<field name="type" invisible="1"/>-->
|
||||
<field name="staff_id" domain="[['type','=','doctor']]"/>
|
||||
<field name="priop"/>
|
||||
<field name="note"/>
|
||||
</list>
|
||||
|
@ -109,15 +108,15 @@
|
|||
<field name="note" nolabel="1"/>
|
||||
</tab>
|
||||
<tab string="Other">
|
||||
<field name="nurse_id" span="3"/>
|
||||
<field name="fee_partner_id" span="3" domain="[['type','=','org']]"/>
|
||||
<field name="nurse_id" span="4"/>
|
||||
<field name="fee_partner_id" span="4" domain="[['type','=','org']]"/>
|
||||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
<button string="Start" type="success" icon="arrow-right" method="do_treatment" states="draft,waiting_treatment"/>
|
||||
<button string="Done" type="success" icon="ok" method="done" states="in_progress"/>
|
||||
<button string="Discontinue" type="danger" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/>
|
||||
<button string="Request Fee" type="default" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible": [["req_fee","=",0]]}'/>
|
||||
<button string="Claim Expenses" type="default" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible": [["req_fee","=",1]]}'/>
|
||||
<button string="Pay" type="success" icon="ok" method="pay" states="completed" attrs='{"invisible": [["req_fee","=",1]]}'/>
|
||||
</foot>
|
||||
<related>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<inherit model="product.categ" inherit="prod_categ_form">
|
||||
<field name="image" position="after">
|
||||
<field name="expense"/>
|
||||
</field>
|
||||
</inherit>
|
|
@ -0,0 +1,5 @@
|
|||
<inherit model="product.categ" inherit="prod_categ_list">
|
||||
<field name="parent_id" position="after">
|
||||
<field name="expense"/>
|
||||
</field>
|
||||
</inherit>
|
|
@ -81,3 +81,4 @@ from . import labor_cost_staff
|
|||
from . import labor_cost_entry
|
||||
from . import labor_cost_entry_line
|
||||
from . import sickbed
|
||||
from . import product_categ
|
||||
|
|
|
@ -32,33 +32,21 @@ class HDCase(Model):
|
|||
def _get_all(self,ids,context={}):
|
||||
vals={}
|
||||
for obj in self.browse(ids):
|
||||
total=0
|
||||
total_amt=0
|
||||
rmb_amt=0
|
||||
due_amt=0
|
||||
fee_amt=0
|
||||
mdc_amt=0
|
||||
srv_amt=0
|
||||
for line in obj.lines:
|
||||
if line.type=='fee':
|
||||
fee_amt+=line.amount or 0.0
|
||||
elif line.type=='medicine':
|
||||
mdc_amt+=line.amount or 0.0
|
||||
elif line.type=='service':
|
||||
srv_amt+=line.amount or 0.0
|
||||
total+=line.amount or 0.0
|
||||
if obj.invoice_policy=='fee':
|
||||
due_amt=total-fee_amt
|
||||
elif obj.invoice_policy=='fee_mdc':
|
||||
due_amt=total-(fee_amt+mdc_amt)
|
||||
if line.reimbursable:
|
||||
rmb_amt+=line.amount or 0.0
|
||||
else:
|
||||
due_amt=total
|
||||
due_amt+=line.amount or 0.0
|
||||
total_amt+=line.amount or 0.0
|
||||
for line in obj.payment_lines:
|
||||
due_amt-=line.amount or 0.0
|
||||
vals[obj.id]={
|
||||
"total": total,
|
||||
"amount": due_amt,
|
||||
'fee_amount': fee_amt,
|
||||
'mdc_amount': mdc_amt,
|
||||
'srv_amount': srv_amt,
|
||||
"total_amount": total_amt,
|
||||
"due_amount": due_amt,
|
||||
'rmb_amount': rmb_amt,
|
||||
'hd_case_id': obj.id,
|
||||
}
|
||||
return vals
|
||||
|
@ -105,11 +93,9 @@ class HDCase(Model):
|
|||
"expenes": fields.One2Many("clinic.hd.case.expense","hd_case_id","Expenses"),
|
||||
'visit_id': fields.Many2One("clinic.visit", "Visit"),
|
||||
'duration': fields.Integer("Duration (Hours)",function="_get_duration"),
|
||||
"total": fields.Float("Total",function="_get_all",readonly=True,function_multi=True),
|
||||
"fee_amount": fields.Float("Fee",function="_get_all",readonly=True,function_multi=True),
|
||||
"mdc_amount": fields.Float("Medicine",function="_get_all",readonly=True,function_multi=True),
|
||||
"srv_amount": fields.Float("Service",function="_get_all",readonly=True,function_multi=True),
|
||||
"amount": fields.Float("Due Amount",function="_get_all",readonly=True,function_multi=True),
|
||||
"total_amount": fields.Float("Total",function="_get_all",readonly=True,function_multi=True),
|
||||
"rmb_amount": fields.Float("Reimbursable",function="_get_all",readonly=True,function_multi=True),
|
||||
"due_amount": fields.Float("Due Amount",function="_get_all",readonly=True,function_multi=True),
|
||||
'fee_partner_id': fields.Many2One("partner","Contact Fee"),
|
||||
'fee_paid': fields.Boolean("Fee Paid"),
|
||||
'note': fields.Text("Note"),
|
||||
|
@ -250,6 +236,7 @@ class HDCase(Model):
|
|||
prod=get_model("product").browse(product_id)
|
||||
line['uom_id']=prod.uom_id.id
|
||||
line['description']=prod.name
|
||||
line['product_categ_id']=prod.categ_id.id
|
||||
qty=1
|
||||
price=prod.sale_price or 0.0
|
||||
amt=qty*price
|
||||
|
@ -267,48 +254,21 @@ class HDCase(Model):
|
|||
data['pay_amount']=0
|
||||
return data
|
||||
|
||||
def onchange_type(self,context={}):
|
||||
data=self.onchange_policy(context)
|
||||
return data
|
||||
|
||||
def onchange_policy(self,context={}):
|
||||
data=context['data']
|
||||
data=self.update_amount(context)
|
||||
return data
|
||||
|
||||
def update_amount(self,context={}):
|
||||
data=context['data']
|
||||
inv_pol=data['invoice_policy']
|
||||
total=0.0
|
||||
fee=0.0
|
||||
mdc=0.0
|
||||
srv=0.0
|
||||
due_amt=0.0
|
||||
rmb_amt=0.0
|
||||
for line in data['lines']:
|
||||
amt=line['amount'] or 0.0
|
||||
total+=amt
|
||||
ltype=line['type']
|
||||
if ltype=='fee':
|
||||
fee+=amt
|
||||
elif ltype=='medicine':
|
||||
mdc+=amt
|
||||
elif ltype=='service':
|
||||
srv+=amt
|
||||
elif ltype=='others':
|
||||
pass
|
||||
if inv_pol=='fee':
|
||||
due_amt=total-fee
|
||||
data['invoice_option']=''
|
||||
elif inv_pol=='fee_mdc':
|
||||
due_amt=total-fee-mdc
|
||||
data['invoice_option']='fee_mdc_split'
|
||||
reimbursable=line['reimbursable']
|
||||
if reimbursable=='yes':
|
||||
rmb_amt+=amt
|
||||
else:
|
||||
due_amt=total
|
||||
data['total']=total
|
||||
data['fee_amount']=fee
|
||||
data['mdc_amount']=mdc
|
||||
data['srv_amount']=srv
|
||||
data['amount']=due_amt
|
||||
due_amt+=amt
|
||||
print("xx ", rmb_amt, due_amt)
|
||||
data['rmb_amount']=rmb_amt
|
||||
data['due_amount']=due_amt
|
||||
data['total_amount']=due_amt+rmb_amt
|
||||
return data
|
||||
|
||||
def make_payment(self,ids,context={}):
|
||||
|
@ -630,6 +590,8 @@ class HDCase(Model):
|
|||
return True
|
||||
|
||||
def do_expense(self,ids,context={}):
|
||||
return
|
||||
#TODO
|
||||
for obj in self.browse(ids):
|
||||
# clear old expense
|
||||
for exp in obj.expenes:
|
||||
|
|
|
@ -11,10 +11,13 @@ class Hdcaseline(Model):
|
|||
"price":fields.Float("Price"),
|
||||
"amount":fields.Float("Amount"),
|
||||
"type": fields.Selection([("fee","Fee"),('medicine','Medicine'),('service','Service'),("others","Others")],"Type",required=True),
|
||||
"product_categ_id": fields.Many2One("product.categ","Category",domain=[['expense','=',True]]),
|
||||
'reimbursable': fields.Selection([['yes','Yes'],['no','No']],"Reimbursable"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'type': 'others',
|
||||
'reimbursable': False,
|
||||
}
|
||||
|
||||
Hdcaseline.register()
|
||||
|
|
|
@ -5,15 +5,15 @@ class HdCaseStaff(Model):
|
|||
_name_field="staff_id"
|
||||
_fields={
|
||||
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
|
||||
"staff_id": fields.Many2One("clinic.staff","Staff",search=True),
|
||||
"staff_id": fields.Many2One("clinic.staff","Doctor",search=True),
|
||||
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True),
|
||||
"priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"),
|
||||
'note': fields.Char("Note"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'type': 'nurse',
|
||||
'priop': 'other',
|
||||
'type': 'doctor',
|
||||
'priop': 'second',
|
||||
}
|
||||
|
||||
HdCaseStaff.register()
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
from netforce.model import Model, fields
|
||||
|
||||
class ProductCateg(Model):
|
||||
_inherit="product.categ"
|
||||
_fields={
|
||||
'expense': fields.Boolean("Expense"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'expense': False,
|
||||
}
|
||||
|
||||
ProductCateg.register()
|
|
@ -1,35 +1,3 @@
|
|||
=====
|
||||
cycle item
|
||||
- list's nurse
|
||||
- list hd case + U
|
||||
- xxx
|
||||
- change datetime
|
||||
|
||||
visit:
|
||||
- confirm
|
||||
- copy data to hdcase -> cycle item
|
||||
=====
|
||||
- design
|
||||
1. create cycle item
|
||||
|
||||
=====
|
||||
|
||||
|
||||
==== after midnight, create payment
|
||||
|
||||
|
||||
|
||||
====
|
||||
if patient not do visit before treatment , how to do?
|
||||
==
|
||||
import payment
|
||||
======
|
||||
import payment
|
||||
step:
|
||||
1. check matching
|
||||
2. prepare file to import
|
||||
3. import
|
||||
- find import
|
||||
-
|
||||
- change day schedue relate
|
||||
======
|
||||
categ_id
|
||||
product_id
|
||||
ca
|
||||
|
|
Loading…
Reference in New Issue