2015-02-27 16:10:50 +00:00
|
|
|
import time
|
|
|
|
|
2014-11-05 05:06:43 +00:00
|
|
|
from netforce.model import Model, fields
|
2014-11-12 11:13:23 +00:00
|
|
|
from netforce.access import get_active_company
|
2014-11-05 05:06:43 +00:00
|
|
|
|
2014-11-25 15:22:50 +00:00
|
|
|
class StaffRotation(Model):
|
|
|
|
_name="clinic.staff.rotation"
|
|
|
|
_string="Staff Rotation"
|
2015-01-09 05:19:52 +00:00
|
|
|
_multi_company=True
|
2014-11-05 05:06:43 +00:00
|
|
|
|
|
|
|
_fields={
|
2015-02-27 16:10:50 +00:00
|
|
|
"type": fields.Selection([['staff','Staff'],["doctor","Doctor"],["nurse","Nurse"]],"Type",search=True),
|
2014-11-25 11:39:53 +00:00
|
|
|
"staff_id": fields.Many2One("clinic.staff","Staff", search=True),
|
2015-02-27 16:10:50 +00:00
|
|
|
'categ_id': fields.Many2One("clinic.staff.categ","Category",search=True),
|
|
|
|
"level_id": fields.Many2One("clinic.staff.level","Level", search=True),
|
2014-11-12 11:13:23 +00:00
|
|
|
"hire_date": fields.Date("Hire Date", search=True),
|
|
|
|
"resign_date": fields.Date("Resign Date", search=True),
|
2014-11-05 05:06:43 +00:00
|
|
|
"wage": fields.Float("Wage"),
|
2014-11-23 13:44:25 +00:00
|
|
|
"max_cycle": fields.Integer("Max Cycle"),
|
2015-02-27 16:10:50 +00:00
|
|
|
"ot_per_cycle": fields.Float("OT/Cycle"),
|
2014-11-05 05:06:43 +00:00
|
|
|
"note": fields.Text("Note"),
|
2014-11-12 11:13:23 +00:00
|
|
|
'company_id': fields.Many2One("company","Company"),
|
2015-02-27 16:10:50 +00:00
|
|
|
'state': fields.Selection([['draft','Draft'],['approved','Approved']],'State'),
|
2014-11-12 11:13:23 +00:00
|
|
|
}
|
2015-02-27 16:10:50 +00:00
|
|
|
|
2014-11-12 11:13:23 +00:00
|
|
|
_defaults={
|
|
|
|
"company_id": lambda *a: get_active_company(),
|
2015-02-27 16:10:50 +00:00
|
|
|
'hire_date': time.strftime("%Y-%m-%d"),
|
|
|
|
'state': 'draft',
|
|
|
|
'type': 'nurse',
|
2014-11-05 05:06:43 +00:00
|
|
|
}
|
|
|
|
|
2015-02-27 16:10:50 +00:00
|
|
|
def to_draft(self,ids,context={}):
|
|
|
|
for obj in self.browse(ids):
|
|
|
|
obj.write({
|
|
|
|
'state': 'draft',
|
|
|
|
})
|
|
|
|
|
|
|
|
def approve(self,ids,context={}):
|
|
|
|
for obj in self.browse(ids):
|
|
|
|
obj.write({
|
|
|
|
'state': 'approved',
|
|
|
|
})
|
|
|
|
|
2014-11-25 15:22:50 +00:00
|
|
|
StaffRotation.register()
|