conv_bal
watcha.h@almacom.co.th 2014-12-20 01:19:19 +07:00
parent 439c0d8f4c
commit 5dab76ee4f
10 changed files with 44 additions and 35 deletions

View File

@ -12,9 +12,9 @@
<field name="date"/>
<tabs>
<tab string="HDCase">
<field name="hd_cases" nolabel="1">
<list>
<field name="sickbed_id" span="2"/>
<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="wt_start" span="2"/>
@ -26,6 +26,7 @@
<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>
@ -44,10 +45,8 @@
<button string="Validate" type="success" method="validate" icon="ok" size="small" states="draft" />
</tab>
</tabs>
<foot>
<!--<button string="Validate" type="success" method="validate" icon="ok" states="draft" />-->
</foot>
<related>
<field name="visits"/>
<field name="comments"/>
</related>
</form>

View File

@ -8,18 +8,15 @@
<group span="6" columns="1">
<field name="number"/>
<field name="ref"/>
<field name="patient_id"/>
<field name="patient_id" required="1"/>
<field name="date"/>
<field name="member_type"/>
<field name="bid_flow_rate"/>
<field name="ultrafittration"/>
<field name="exp_date"/>
</group>
<group span="6" columns="1">
<field name="product_id"/>
<field name="dialyzer_type"/>
<field name="use_time" readonly="1"/>
<field name="max_use_time"/>
<field name="exp_date"/>
<field name="description"/>
</group>
<foot>

View File

@ -8,7 +8,7 @@
</head>
<group form_layout="stacked">
<field name="number" span="2"/>
<field name="sickbed_id" span="2" required="1"/>
<field name="sickbed_id" domain="[['available','=',True]]" span="2"/>
<field name="patient_id" span="2" onchange="onchange_patient"/>
<field name="patient_type_id" span="2"/>
<field name="cycle_id" span="2" required="1" onchange="onchange_cycle"/>

View File

@ -1,7 +1,8 @@
<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="number"/>
<field name="sickbed_id" span="2"/>
<field name="date"/>
<field name="patient_id"/>
<field name="sickbed_id"/>
<field name="cycle_id"/>
<field name="department_id"/>
<field name="doctor_id"/>

View File

@ -36,6 +36,7 @@ class CycleItem(Model):
'company_id': fields.Many2One("company", "Company"),
"state": fields.Selection([("draft","Draft"),("validated","Validated")],"Status",required=True),
'user_id': fields.Many2One("base.user","Validator"),
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
}
def _get_vark(self,context={}):

View File

@ -18,10 +18,7 @@ class Dialyzer(Model):
"use_time": fields.Integer("Use Time"),
"max_use_time": fields.Integer("Max Use Time"),
"exp_date": fields.Date("Expiry Date",search=True),
"member_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
"bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)",search=True),
"ultrafittration": fields.Float("Ultrafittration Kg.",search=True),
"state": fields.Selection([("new","New"),("active","Active"),("drop","Drop"),("expire","Expire"),('cancelled','Cancelled')],"Status"),
"comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company"),
@ -86,8 +83,8 @@ class Dialyzer(Model):
id=ids[0]
obj=self.browse(id)
patient=obj.patient_id
if not patient:
raise Exception("Patient is required")
#if not patient:
#raise Exception("Patient is required")
partner=patient.partner_id
if not partner:
raise Exception("Contact not for this patient")

View File

@ -190,7 +190,7 @@ class GenVisit(Model):
'cycle_id': cycle.id,
'time_start': ttime_start,
'time_stop': ttime_stop,
'state': 'draft',
'state': 'pending',
}
visit_vals.append(vals)
count+=7
@ -200,7 +200,7 @@ class GenVisit(Model):
dom.append(['time_stop','<=','%s %s'%(tmp.strftime(FMT_DATE)[0:10],' 23:59:59')])
dom.append(['patient_id', '=', patient_id])
dom.append(['cycle_id', '=', obj.cycle_id.id]) #XXX
dom.append(['state','=','draft'])
dom.append(['state','=','pending'])
vids=visit_obj.search(dom)
visit_obj.delete(vids)
key='%s/%s'%(vals['cycle_id'], vals['time_start'])
@ -209,7 +209,7 @@ class GenVisit(Model):
'cycle_id': obj.cycle_id.id,
'time_start': ttime_start,
'time_stop': ttime_stop,
'state':'draft',
'state':'pending',
}
start_date=tmp
user_id=get_active_user()
@ -292,10 +292,11 @@ class GenVisit(Model):
dom=[]
dom.append(['time_start','>=','%s %s'%(obj.date_from[0:10],' 00:00:00')])
dom.append(['time_stop','<=','%s %s'%(date_to2[0:10],' 23:59:59')])
dom.append(['state','=','draft'])
dom.append(['state','=','pending'])
vids=visit_obj.search(dom)
visit_obj.delete(vids)
schedule_obj=get_model("clinic.schedule")
dom[-1][2]='draft' #XXX
schedules=schedule_obj.search_browse(dom)
schedule_ids=[]
for sch in schedules:
@ -336,7 +337,7 @@ class GenVisit(Model):
dom.append(['time_start','>=','%s'%time_start])
dom.append(['time_stop','<=','%s'%time_stop])
dom.append(['patient_id','=','%s'%patient_id])
dom.append(['state','=','draft'])
dom.append(['state','=','pending'])
count+=7
vids=visit_obj.search(dom)
if vids:
@ -350,7 +351,7 @@ class GenVisit(Model):
dom.append(['time_start','>=','%s'%time_start])
dom.append(['time_stop','<=','%s'%time_stop])
dom.append(['patient_id','=','%s'%patient_id])
dom.append(['state','=','draft'])
dom.append(['state','=','pending'])
vids=visit_obj.search(dom)
if vids:
visit_ids.append(vids[0])

View File

@ -29,7 +29,7 @@ class HDCase(Model):
res[obj.id]=obj.amount
return res
def _get_total(self,ids,context={}):
def _get_all(self,ids,context={}):
vals={}
for obj in self.browse(ids):
total=0
@ -59,6 +59,7 @@ class HDCase(Model):
'fee_amount': fee_amt,
'mdc_amount': mdc_amt,
'srv_amount': srv_amt,
'hd_case_id': obj.id,
}
return vals
@ -80,16 +81,16 @@ class HDCase(Model):
"patient_type_id": fields.Many2One("clinic.patient.type", "Type",function="_get_patient_type"),
"nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]),
"department_id": fields.Many2One("clinic.department", "Department",search=True),
"wt_start": fields.Float("Start Wt (Kg)"),
"wt_stop": fields.Float("Stop Wt (Kg)"),
"wt_start": fields.Float("Start Wt (kg.)"),
"wt_stop": fields.Float("Finish Wt (kg.)"),
"bp_start": fields.Char("Start BP"),
"bp_stop": fields.Char("Stop BP"),
"bp_stop": fields.Char("Finish BP"),
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Member Type"),
"hd_acc": fields.Selection([("o","O"),("i","I")],"HD Acc"),
"hd_mode": fields.Selection([("chronic","Chronic"),("acute","Acute")],"HD Moode"),
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
"bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)"),
"ultrafittration": fields.Float("Ultrafittration Kg."),
"ultrafittration": fields.Float("Ultrafittration (kg.)"),
"hct": fields.Integer("Hct",required=True),
"hct_msg" : fields.Char(""),
"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),
@ -104,11 +105,11 @@ 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_total",readonly=True,function_multi=True),
"fee_amount": fields.Float("Fee",function="_get_total",readonly=True,function_multi=True),
"mdc_amount": fields.Float("Medicine",function="_get_total",readonly=True,function_multi=True),
"srv_amount": fields.Float("Service",function="_get_total",readonly=True,function_multi=True),
"amount": fields.Float("Due Amount",function="_get_total",readonly=True,function_multi=True),
"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),
'fee_partner_id': fields.Many2One("partner","Contact Fee"),
'fee_paid': fields.Boolean("Fee Paid"),
'note': fields.Text("Note"),
@ -127,6 +128,7 @@ class HDCase(Model):
"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:"),
'req_fee': fields.Integer("Request Expense"),
'hd_case_id': fields.Many2One("clinic.hd.case","HD",function="_get_all",function_multi=True), # XXX
}
def _get_number(self,context={}):
@ -560,6 +562,9 @@ class HDCase(Model):
#TODO should find dlz when confirm visit
if not obj.dialyzers:
raise Exception("Please input dialyzer!")
obj.sickbed_id.write({
'available': False,
})
vals={
'state': 'in_progress',
}
@ -772,6 +777,9 @@ class HDCase(Model):
obj.write({
'state': 'completed',
})
obj.sickbed_id.write({
'available': False,
})
return {
'next': {
'name': 'clinic_hd_case',

View File

@ -310,7 +310,7 @@ class Visit(Model):
def delete(self,ids,context={}):
for obj in self.browse(ids):
if obj.state!='draft':
if obj.state not in ('draft','pending'):
raise Exception("Can not delete visit %s because state is not draft!"%obj.number)
super().delete(ids,context=context)

View File

@ -2,7 +2,12 @@
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