conv_bal
watcha.h 2015-03-02 14:27:39 +07:00
commit 605671e4f5
6 changed files with 32 additions and 12 deletions

View File

@ -3,10 +3,9 @@
<field name="view_cls">multi_view</field>
<field name="model">clinic.patient</field>
<field name="tabs">[
["All",[]],
["All",[["state","=","admit"]]],
["Archived",[["active","=","False"]]],
["Admit",[["state","=","admit"]]],
["Dispose",[["state","=","dispose"]]]]
["Disposed",[["state","=","dispose"]]]]
</field>
<field name="menu">clinic_menu</field>
<field name="limit">25</field>

View File

@ -19,6 +19,7 @@
<field name="categ_id"/>
<field name="branch_id" required="1"/>
<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/>
<field name="active" invisible="1"/>
<tabs>
<tab string="General">
<group span="6" columns="1">
@ -77,10 +78,13 @@
<field name="partner_id" domain='[["is_patient","=","true"]]'/>
</tab>
<tab string="Other">
<field name="state"/>
<field name="resign_date" attrs='{"required":[["state","=","resign"]]}'/>
<field name="hn_no"/>
<field name="note" attrs='{"required":[["state","=","resign"]]}'/>
<group layout_form="stacked">
<field name="dispose" span="3"/>
<field name="resign_date" attrs='{"required":[["dispose","=","true"]]}' span="4"/>
<field name="note" attrs='{"required":[["dispose","=","true"]]}' span="4"/>
<field name="state" invisible="1"/>
<field name="hn_no" invisible="1"/>
</group>
</tab>
</tabs>
<related>

View File

@ -13,6 +13,5 @@
<field name="branch_id"/>
<field name="department_id"/>
<field name="doctor_id"/>
<field name="state"/>
<!--<field name="image" preview='1'/>-->
</list>

View File

@ -118,7 +118,8 @@ class Patient(Model):
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
"partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
"active":fields.Boolean("Active", search=True),
"active":fields.Boolean("Active"),
"dispose":fields.Boolean("Dispose"),
'note': fields.Text("Note"),
'categ_id': fields.Many2One("clinic.patient.categ","Category"),
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
@ -185,6 +186,8 @@ class Patient(Model):
def check_idcard(self,idcard=''):
res=True
if idcard=='/':
return True
if idcard.isalpha():
res=False
elif len(idcard)!=13:
@ -242,6 +245,11 @@ class Patient(Model):
super().delete(ids)
def write(self,ids,vals,**kw):
if 'dispose' in vals.keys():
if vals['dispose']:
vals['state']='dispose'
else:
vals['state']='admit'
if 'card_no' in vals.keys():
self.check_idcard(vals['card_no'])
ctx={}
@ -393,5 +401,8 @@ class Patient(Model):
},'flash': 'New Dialyzer successfully',
}
def onchange_state(self,ids,context={}):
pass
Patient.register()

View File

@ -110,6 +110,14 @@ class ClinicSetting(Model):
if user_id !=1:
print("Only admin!!")
return
for cpt in get_model("clinic.patient.cycle").search_browse([]):
patient=cpt.patient_id
if patient.state!='admit':
print(patient.name)
cpt.delete()
print("Done!")
return
for pt in get_model("clinic.patient").search_browse([]):
pt.write({
'state': 'admit',

View File

@ -1,8 +1,7 @@
todo:
- set patient_id with domain state=='treatment'
- compute labor cost
- update level
- update level -> ok
- set patient_id with domain state=='admit' -> ok
convbal -> not yet (wait yui) -> ok but have to update memo