staff rotation not update

conv_bal
watcha.h 2015-03-19 13:08:29 +07:00
parent f63090ae62
commit 1135d7171e
6 changed files with 36 additions and 2 deletions

View File

@ -7,6 +7,7 @@
</button>
<button string="Options" dropdown="1">
<item string="New Dialyzer" action="clinic_hd_case_dlz" states="draft,in_progress,waiting_treatment"/>
<item string="Drop Dialyzer" method="drop_dlz" confirm="Are you sure?" states="completed"/>
<item string="To Draft" method="to_draft" states="paid,waiting_payment,completed,cancelled"/>
</button>
</head>

View File

@ -1,4 +1,8 @@
<list model="clinic.staff.rotation">
<head>
<button string="To Draft" method="to_draft" type="default"/>
<button string="Approve" method="approve" type="success"/>
</head>
<field name="hire_date"/>
<field name="staff_id"/>
<field name="type"/>

View File

@ -1488,4 +1488,24 @@ class HDCase(Model):
}
}
def drop_dlz(self,ids,context={}):
obj=self.browse(ids)[0]
for dline in obj.dialyzers:
use_time=dline.use_time or 0
dlz=dline.dialyzer_id
if dlz.state=='drop':
raise Exception("%s is drop!"%dlz.number)
dlz.write({
'use_time': use_time,
})
dlz.drop(context=context)
return {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': obj.id,
},
'flash': '%s is droped'%dlz.number,
}
HDCase.register()

View File

@ -150,6 +150,13 @@ class ClinicSetting(Model):
print("Only admin!!")
return
for rt in get_model("clinic.staff.rotation").search_browse([]):
rt.write({
'note': ' ',
})
print("Done!")
return
files=['Patients_Data_LS1.csv','Patients_Data_LS2.csv','Patients_Data_LS3.csv']
self.update_patient_file(files)
print("Done!")

View File

@ -38,7 +38,7 @@ class Staff(Model):
ot_per_cycle=0
level_id=None
categ_id=None
for rotate in obj.rotations:
for rotate in sorted(obj.rotations,key=lambda x: x.hire_date or ""):
if rotate.state=='approved':
level_id=rotate.level_id.id
wage=rotate.wage

View File

@ -24,7 +24,7 @@ class StaffRotation(Model):
"level_id": fields.Many2One("clinic.staff.level","Level", search=True),
"hire_date": fields.Date("Date", search=True),
"resign_date": fields.Date("Resign Date", search=True),
"wage": fields.Float("Wage"),
"wage": fields.Float("Salary"),
"max_cycle": fields.Integer("Max Cycle"),
"ot_per_cycle": fields.Float("OT/Cycle"),
"note": fields.Text("Note"),
@ -51,6 +51,8 @@ class StaffRotation(Model):
def approve(self,ids,context={}):
for obj in self.browse(ids):
if obj.state=='approved':
continue
obj.write({
'state': 'approved',
})