2014-11-27 06:04:20 +00:00
|
|
|
import time
|
|
|
|
|
2014-11-21 16:11:57 +00:00
|
|
|
from netforce.model import Model, fields
|
|
|
|
from netforce.access import get_active_company
|
|
|
|
|
2014-11-27 00:47:38 +00:00
|
|
|
class CycleMonthlyLine(Model):
|
|
|
|
_name="clinic.cycle.monthly.line"
|
|
|
|
_string="Cycle Monthly Line"
|
2014-11-21 16:11:57 +00:00
|
|
|
|
2014-11-27 15:14:31 +00:00
|
|
|
def _get_max_cycle(self,ids,context={}):
|
|
|
|
res={}
|
|
|
|
for obj in self.browse(ids):
|
|
|
|
staff=obj.staff_id
|
|
|
|
res[obj.id]=staff.max_cycle
|
|
|
|
return res
|
|
|
|
|
2014-11-21 16:11:57 +00:00
|
|
|
_fields={
|
2014-11-27 00:47:38 +00:00
|
|
|
"cycle_monthly_id": fields.Many2One("clinic.cycle.monthly","Cycle Monthly"),
|
2014-11-25 11:39:53 +00:00
|
|
|
'staff_id': fields.Many2One("clinic.staff", "Staff"),
|
|
|
|
'level_id': fields.Many2One("clinic.staff.level", "Level"),
|
2014-11-27 06:04:20 +00:00
|
|
|
'date': fields.Date("Date"),
|
2014-11-23 15:39:41 +00:00
|
|
|
'qty': fields.Integer("Qty"),
|
|
|
|
'rate': fields.Float("Rate"),
|
|
|
|
'amount': fields.Float("Amount"),
|
2014-11-21 16:11:57 +00:00
|
|
|
'company_id': fields.Many2One("company","Company"),
|
2014-11-25 11:39:53 +00:00
|
|
|
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Type",required=True),
|
2014-11-27 15:14:31 +00:00
|
|
|
'max_cycle': fields.Float('Max Cycle',function="_get_max_cycle"),
|
2014-11-21 16:11:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_defaults={
|
|
|
|
'company_id': lambda *a: get_active_company(),
|
2014-11-27 06:04:20 +00:00
|
|
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
2014-11-21 16:11:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-27 00:47:38 +00:00
|
|
|
CycleMonthlyLine.register()
|