visit board
parent
225e980bd7
commit
3a13aa1919
|
@ -10,6 +10,7 @@
|
|||
<field name="sequence"/>
|
||||
<field name="department_id"/>
|
||||
<field name="note"/>
|
||||
<field name="active"/>
|
||||
<field name="branch_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<related>
|
||||
|
|
|
@ -38,6 +38,7 @@ class SickBed(Model):
|
|||
'note': fields.Text("Note"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch",required=True, search=True),
|
||||
'department_id': fields.Many2One("clinic.department","Department",required=True, search=True),
|
||||
'active': fields.Boolean("Active"),
|
||||
}
|
||||
|
||||
def _get_branch(self,context={}):
|
||||
|
@ -56,6 +57,7 @@ class SickBed(Model):
|
|||
'sequence': 0,
|
||||
'state': 'available',
|
||||
'branch_id': _get_branch,
|
||||
'active': True,
|
||||
}
|
||||
|
||||
_order="branch_id,department_id,sequence,name"
|
||||
|
|
|
@ -4,7 +4,7 @@ from calendar import monthrange
|
|||
from datetime import datetime, timedelta
|
||||
#from calendar import monthrange
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company
|
||||
from netforce.access import get_active_company, get_active_user
|
||||
|
||||
from . import utils
|
||||
|
||||
|
@ -25,6 +25,7 @@ class VisitBoard(Model):
|
|||
_string="Visit Board"
|
||||
_transient=True
|
||||
_name_field="date"
|
||||
|
||||
_fields={
|
||||
"date": fields.Date("Month", required=False),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
|
@ -36,10 +37,28 @@ class VisitBoard(Model):
|
|||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
}
|
||||
|
||||
def _get_branch(self,context={}):
|
||||
user_id=get_active_user()
|
||||
sts=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
||||
branch_id=None
|
||||
if sts:
|
||||
branch_id=sts[0].branch_id.id
|
||||
return branch_id
|
||||
|
||||
def _get_deparment(self,context={}):
|
||||
user_id=get_active_user()
|
||||
sts=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
||||
dpt_id=None
|
||||
if sts:
|
||||
dpt_id=sts[0].department_id.id
|
||||
return dpt_id
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'date_from': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'date_to': lambda *a: (datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d"),
|
||||
'department_id': _get_deparment,
|
||||
'branch_id': _get_branch,
|
||||
}
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
|
@ -52,6 +71,12 @@ class VisitBoard(Model):
|
|||
doctor_id=None
|
||||
department_id=None
|
||||
branch_id=None
|
||||
|
||||
user_id=get_active_user()
|
||||
sts=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
||||
if sts:
|
||||
department_id=sts[0].department_id.id
|
||||
branch_id=sts[0].branch_id.id
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
date_from=obj.date_from
|
||||
|
|
Loading…
Reference in New Issue