Merge branch 'master' of dev.netforce.com:netforce-customized/clinic
commit
1a537a1649
|
@ -2,7 +2,7 @@
|
|||
<field name="string">Staffs</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.staff</field>
|
||||
<field name="tabs">[["All",[]],["Archived",[["active","=",false]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]]</field>
|
||||
<field name="tabs">[["All",[]],["Archived",[["active","=",false]]],["Staff",[["type","=","staff"]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]]</field>
|
||||
<field name="modes">list,page,form</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
<field name="limit">25</field>
|
||||
|
|
|
@ -50,23 +50,8 @@
|
|||
</tab>
|
||||
</tabs>
|
||||
<related>
|
||||
<field name="documents"/>
|
||||
<field name="addresses"/>
|
||||
<!--
|
||||
<field name="cycles" nolabel="1">
|
||||
<list>
|
||||
<field name="cycle_id"/>
|
||||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
</list>
|
||||
<form>
|
||||
<field name="cycle_id"/>
|
||||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
</form>
|
||||
</field>
|
||||
-->
|
||||
|
||||
<field name="documents"/>
|
||||
<field name="rotations" nolabel="1">
|
||||
<list>
|
||||
<field name="level_id" domain="[['type','=',parent.type]]"/>
|
||||
|
@ -79,8 +64,22 @@
|
|||
<field name="note"/>
|
||||
</list>
|
||||
</field>
|
||||
<field name="hd_cases"/>
|
||||
<field name="cycle_item_nurses">
|
||||
<field name="hd_case_staffs" attrs='{"invisible":[["type","=","nurse"]]}'>
|
||||
<list colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_payment"]],"#70DB93":[["state","=","paid"]]}'>
|
||||
<field name="hd_case_id"/>
|
||||
<field name="date"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="patient_type_id"/>
|
||||
<field name="sickbed_id"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
<form>
|
||||
<field name="hd_case_id"/>
|
||||
</form>
|
||||
</field>
|
||||
<field name="cycle_item_nurses" attrs='{"invisible":[["type","=","doctor"]]}'>
|
||||
<list>
|
||||
<field name="cycle_item_id"/>
|
||||
</list>
|
||||
|
|
|
@ -914,10 +914,10 @@ class HDCase(Model):
|
|||
return vals
|
||||
# staff
|
||||
patient=get_model("clinic.patient").browse(patient_id)
|
||||
doctor=patient.doctor_id
|
||||
if doctor:
|
||||
if not vals.get('staffs'):
|
||||
vals['staffs']=[]
|
||||
if not vals.get('staffs'):
|
||||
doctor=patient.doctor_id
|
||||
if doctor:
|
||||
vals['staffs'].append(('create',{
|
||||
'staff_id': doctor.id,
|
||||
'type': 'doctor',
|
||||
|
|
|
@ -3,12 +3,36 @@ from netforce.model import Model, fields
|
|||
class HDCaseStaff(Model):
|
||||
_name="clinic.hd.case.staff"
|
||||
_name_field="staff_id"
|
||||
|
||||
def _get_all(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
hd_case=obj.hd_case_id
|
||||
patient=hd_case.patient_id
|
||||
res[obj.id]={
|
||||
'sickbed_id': hd_case.sickbed_id.id,
|
||||
'patient_id': patient.id,
|
||||
'patient_type_id': patient.type_id.id,
|
||||
'cycle_id': hd_case.cycle_id.id,
|
||||
'date': hd_case.date,
|
||||
'department_id': hd_case.department_id.id,
|
||||
'state': hd_case.state,
|
||||
}
|
||||
return res
|
||||
|
||||
_fields={
|
||||
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",required=True,on_delete="cascade"),
|
||||
"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"),
|
||||
'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True),
|
||||
'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True),
|
||||
'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type",function="_get_all",function_multi=True),
|
||||
'cycle_id': fields.Many2One("clinic.cycle","Cycle",function="_get_all",function_multi=True),
|
||||
'department_id': fields.Many2One("clinic.department","Department",function="_get_all",function_multi=True),
|
||||
'date': fields.Date("Date",function="_get_all",function_multi=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",function="_get_all",function_multi=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
|
|
@ -55,9 +55,18 @@ class Staff(Model):
|
|||
return res
|
||||
|
||||
def _get_hdcase(self,ids,context={}):
|
||||
# problem slow to load
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
res[obj.id]=[1]
|
||||
hids=[]
|
||||
if obj.type=='doctor':
|
||||
hids=get_model("clinic.hd.case.staff").search([['staff_id','=',obj.id]])
|
||||
elif obj.type=='nurse':
|
||||
item_ids=[item['cycle_item_id'][0] for item in get_model("clinic.cycle.item.nurse").search_read([['nurse_id','=',obj.id]],['cycle_item_id'])]
|
||||
for item in get_model("clinic.cycle.item").browse(item_ids):
|
||||
for hdcase in item.hd_cases:
|
||||
hids.append(hdcase.id)
|
||||
res[obj.id]=hids
|
||||
return res
|
||||
|
||||
_fields={
|
||||
|
@ -106,7 +115,7 @@ class Staff(Model):
|
|||
'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
"hd_case_staffs": fields.One2Many("clinic.hd.case.staff","staff_id","HD Cases"),
|
||||
"hd_cases": fields.Many2Many("clinic.hd.case","HD Cases",function="_get_hdcase"),
|
||||
"hd_cases": fields.Many2Many("clinic.hd.case","HD Cases",function="_get_hdcase"), # not need to use (it's slow to load)
|
||||
"cycle_item_nurses": fields.One2Many("clinic.cycle.item.nurse","nurse_id","Cycle Items"),
|
||||
}
|
||||
|
||||
|
|
|
@ -175,6 +175,12 @@ class Visit(Model):
|
|||
dialyzer=self.get_dlz(obj.id)
|
||||
vals['dialyzers'].append(('create',dialyzer))
|
||||
|
||||
vals['staffs'].append(('create',{
|
||||
'staff_id': obj.doctor_id.id,
|
||||
'type': 'doctor',
|
||||
'priop': 'owner',
|
||||
}))
|
||||
|
||||
# use exist hd_case (in case set to draft)
|
||||
hd_case_id=None
|
||||
if obj.hd_cases:
|
||||
|
|
|
@ -1,17 +1 @@
|
|||
=====
|
||||
- visit
|
||||
- color
|
||||
- generate
|
||||
nurses too much copy
|
||||
- access right
|
||||
- diffrent user branch
|
||||
=====
|
||||
create button reset at setting
|
||||
- backup master data
|
||||
- patient
|
||||
- staff/nurse/doctor
|
||||
- account
|
||||
- journal
|
||||
- product
|
||||
---
|
||||
|
||||
onclick hd case on staff
|
||||
|
|
Loading…
Reference in New Issue