conv_bal
watcha.h@almacom.co.th 2015-01-13 21:33:38 +07:00
parent 5dad637613
commit 3e8f408ab8
5 changed files with 26 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<action>
<field name="string">List Nurse</field>
<field name="string">Nurses</field>
<field name="view_cls">form_popup</field>
<field name="model">clinic.schedule.load.nurse</field>
<field name="target">_popup</field>

View File

@ -1,6 +1,7 @@
<form model="clinic.schedule.load.nurse">
<group form_layout="stacked">
<field name="categ_id" span="6" onchange="onchange_categ"/>
<field name="level_id" span="6" onchange="onchange_level"/>
<field name="schedule_id" invisible="1"/> <!-- need to push -->
<field name="lines" nolabel="1">
<list>

View File

@ -17,7 +17,7 @@
<item string="Dialyzers" action="clinic_dialyzer"/>
<divider/>
<header string="SETTINGS"/>
<item string="Type" action="clinic_patient_type"/>
<item string="Patient Types" action="clinic_patient_type"/>
<item string="Categories" action="clinic_patient_categ"/>
<item string="Cause Chronics" action="clinic_cause_chronic"/>
<item string="Comorbidities" action="clinic_comorbidity"/>

View File

@ -2,12 +2,9 @@
<head>
<field name="state"/>
<button string="Options" dropdown="1">
<!--<item string="Copy" method="copy"/>-->
<!--<item string="Copy By Duration" action="clinic_schedule_copy"/>-->
<item string="Copy" action="clinic_schedule_copy"/>
<item string="Copy Nurses To Schedule" action="clinic_load_nurses" states="draft"/>
<item string="Copy Nurses To Cycle Item" method="copy2cycle_item" states="draft"/>
<item string="Reset Nurse" method="clear" confirm="Are you sure to clear list of nurse?" states="draft"/>
<item string="Get Nurse" action="clinic_load_nurses" states="draft"/>
<item string="Reset Item" method="clear" confirm="Are you sure to remove all item?" states="draft"/>
<item string="To Draft" method="to_draft" states="confirmed"/>
</button>
</head>

View File

@ -7,6 +7,7 @@ class LoadNurse(Model):
_fields={
"schedule_id": fields.Many2One("clinic.schedule","Schedule",on_delete="cascade"),
'categ_id': fields.Many2One("clinic.staff.categ","Category", domain=[['type','=','nurse']]),
'level_id': fields.Many2One("clinic.staff.level","Level", domain=[['type','=','nurse']]),
"lines": fields.One2Many("clinic.schedule.load.nurse.line",'load_id', 'Lines'),
}
@ -22,7 +23,7 @@ class LoadNurse(Model):
if cycle_ids:
cycle_id=cycle_ids[0]
lines=[]
for nurse in get_model("clinic.staff").search_browse([['type','=','nurse']]):
for nurse in get_model("clinic.staff").search_browse([['type','=','nurse']], limit=5):
in_cycle_id=None
if nurse.cycle_id.id:
in_cycle_id=nurse.cycle_id.id
@ -56,7 +57,7 @@ class LoadNurse(Model):
lines.append({
'cycle_id': cycle.id,
'nurse_id': nurse.id,
'cycle_seq': cycle.sequence,
'cycle_seq': cycle.sequence or 0,
})
for line in schedule.lines:
@ -83,8 +84,26 @@ class LoadNurse(Model):
def onchange_categ(self,context={}):
data=context['data']
data['lines']=[]
categ_id=data['categ_id']
for nurse in get_model("clinic.staff").search([['type','=','nurse'],['categ_id','=',categ_id]]):
data['lines'].append(('create',{
'nurse_id': nurse.id}
))
print('data ', data)
return data
def onchange_level(self,context={}):
data=context['data']
data['lines']=[]
level_id=data['level_id']
for nurse in get_model("clinic.staff").search_browse([['type','=','nurse']]):
if level_id==nurse.level_id.id:
data['lines'].append({
'nurse_id': nurse.id,
'cycle_id': nurse.cycle_id.id,
})
return data
LoadNurse.register()