improvement

conv_bal
watcha.h 2015-01-29 21:55:05 +07:00
parent 522aeb5ad5
commit 6d90e41fd4
13 changed files with 69 additions and 14 deletions

View File

@ -12,6 +12,7 @@
<field name="department_id" required="1"/>
<field name="date"/>
<field name="exp_date"/>
<field name="membrane_type"/>
</group>
<group span="6" columns="1">
<field name="product_id" onchange="onchange_product"/>

View File

@ -3,6 +3,7 @@
<field name="product_id" domain="[['categ_id.name','=','Dialyzer']]" span="6"/>
<field name="dialyzer_type" span="6"/>
<field name="max_use_time" span="6" required="1"/>
<field name="membrane_type" required="1" span="6"/>
<field name="exp_date" span="6"/>
<field name="note" span="6"/>
<foot>

View File

@ -39,12 +39,13 @@
<newline/>
<field name="bp_start" span="2"/>
<field name="bp_stop" span="2"/>
<field name="membrane_type" span="2" />
<!--<field name="membrane_type" span="2" />-->
<field name="bid_flow_rate" span="2"/>
<field name="ultrafittration" span="2"/>
<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="membrane_type" span="2"/>
<field name="dialyzer_type" span="2"/>
<field name="use_time"/>
<field name="max_use_time" readonly="1"/>

View File

@ -37,9 +37,10 @@
<field name="nation_id"/>
<field name="race_id"/>
<field name="grad_id"/>
<field name="phone"/>
<field name="weight"/>
<field name="height"/>
<field name="phone"/>
<field name="vascular_acc"/>
<field name="company_id" invisible="1"/>
</group>
</tab>

View File

@ -30,6 +30,7 @@ class Dialyzer(Model):
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",search=True),
"hd_cases": fields.One2Many("clinic.hd.case","dlz_id","HD Case"), #TODO funtion to get hd case
'department_id': fields.Many2One("clinic.department","Department",search=True),
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
}
def _get_number(self,context={}):

View File

@ -898,6 +898,7 @@ class HDCase(Model):
'department_id': obj.department_id.id,
'patient_id': obj.patient_id.id,
'visit_id': obj.visit_id.id,
"membrane_type": pop.membrane_type,
}
else:
dlz_vals=get_model("clinic.dialyzer").default_get()
@ -984,7 +985,6 @@ class HDCase(Model):
price=st_prod.price
qty=st_prod.qty
amt=st_prod.amount
#account_id=st_prod.account_id.id
account_id=st_prod.ar_credit_id.id
if not account_id:
account_id=prod.sale_account_id.id
@ -1028,6 +1028,11 @@ class HDCase(Model):
def create(self,vals,**kw):
patient_id=vals['patient_id']
if 'vascular_acc' in vals.keys():
patient=get_model("clinic.patient").browse(patient_id)
patient.write({
'vascular_acc': vals['vascular_acc']
})
vals=self.get_staff_line(vals,patient_id)
new_id=super().create(vals,**kw)
self.function_store([new_id])
@ -1035,6 +1040,16 @@ class HDCase(Model):
def write(self,ids,vals,**kw):
obj=self.browse(ids)[0]
# update vascular access
if 'vascular_acc' in vals.keys():
patient_id=obj.patient_id.id
if 'patient_id' in vals.keys():
patient_id=vals['patient_id']
patient=get_model("clinic.patient").browse(patient_id)
patient.write({
'vascular_acc': vals['vascular_acc']
})
############ to show pay button ###########
total_amt=0
due_amt=0

View File

@ -2,13 +2,24 @@ from netforce.model import Model, fields
class HDCaseDialyzerLine(Model):
_name="clinic.hd.case.dialyzer"
def _get_all(self,ids,context={}):
res={}
for obj in self.browse(ids):
dlz=obj.dialyzer_id
res[obj.id]={
'membrane_type': dlz.membrane_type,
}
return res
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Type"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialyzer",search=True),
"description": fields.Char("Description",search=True),
"use_time":fields.Integer("Use time"),
"max_use_time":fields.Integer("Max use time"),
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type",function="_get_all",function_multi=True),
}
HDCaseDialyzerLine.register()

View File

@ -11,6 +11,7 @@ class HDCasePopupDlz(Model):
"max_use_time": fields.Integer("Max Use Time"),
"exp_date": fields.Date("Expiry Date"),
"note": fields.Text("Note"),
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
}
def _get_hd_case_id(self,context={}):

View File

@ -101,6 +101,7 @@ class Patient(Model):
'cycle_id': fields.Many2One("clinic.cycle","Last Cycle",function="_get_last_cycle"),
'branch_id': fields.Many2One("clinic.branch","Branch",search=True),
'cycles': fields.One2Many("clinic.patient.cycle","patient_id", "Cycles"),
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
}
def _get_number(self,context={}):

View File

@ -100,14 +100,23 @@ class ClinicSetting(Model):
return True
def run_script(self,ids,context={}):
hids=get_model("clinic.hd.case").search([])
get_model('clinic.hd.case').function_store(hids)
obj=self.browse(ids)[0]
for prod in obj.products:
prod.write({
'type_code': prod.patient_type_id.code,
'ar_credit_id': prod.account_id.id,
})
for hdcase in get_model("clinic.hd.case").search_browse([]):
mt=hdcase.membrane_type
for dlz in hdcase.dialyzers:
dlz2=dlz.dialyzer_id
dlz2.write({
'membrane_type': mt,
})
for pt in get_model("clinic.patient").search_browse([]):
count=0
for hdcase in pt.hd_cases:
if count > 1:
break
if hdcase.vascular_acc:
pt.write({
'vascular_acc': hdcase.vascular_acc.id,
})
count+=1
print("Done! ")
def reset_last_import(self,ids,context={}):

View File

@ -161,6 +161,7 @@ class Visit(Model):
hd_case_obj=get_model("clinic.hd.case")
vals={
'patient_id': obj.patient_id.id,
'vascular_acc': obj.patient_id.vascular_acc.id,
'nurse_id': obj.nurse_id.id,
'department_id': obj.department_id.id,
'time_start': obj.time_start,

View File

@ -192,9 +192,9 @@ class VisitBoard(Model):
if visit.state=='cancelled':
visit_color='#dbdbdb',
if visit.number=='/':
number='*(Cancelled)'
number='*Cancelled'
else:
number+='(Cancelled)'
number+='*Cancelled'
line={

View File

@ -1,4 +1,16 @@
todo:
- patient
- link vascular access to patient profile and copy to hd case after confirm on visit -> ok
- can update date from hd case to patient
- new shop
- require membrane type
- hd case
- move membrane type to dialyzer
- make script to update membran type
- add option
- new shop
- related to hd case
-
- accounting
- invoice line -> account -> credit
- debit from hd case setting