conv_bal
watcha.h@almacom.co.th 2015-01-14 20:36:23 +07:00
parent d1a45db132
commit 3ab94a7f6e
20 changed files with 78 additions and 26 deletions

View File

@ -1,5 +1,6 @@
<form model="clinic.branch" show_company="1">
<field name="name"/>
<field name="code"/>
<field name="parent_id"/>
<field name="company_id"/>
</form>

View File

@ -1,5 +1,6 @@
<list model="clinic.branch">
<field name="name"/>
<field name="code"/>
<field name="parent_id"/>
<field name="company_id"/>
</list>

View File

@ -7,10 +7,12 @@
<item string="To Draft" method="to_draft" states="validated" />
</button>
</head>
<field name="cycle_id" required="1"/>
<field name="date"/>
<group from_layout="stacked">
<field name="cycle_id" span="3" required="1"/>
<field name="date" span="3" required="1"/>
<field name="branch_id" span="3" required="1"/>
<field name="company_id" invisible="1"/>
</group>
<tabs>
<tab string="Nurses">
<field name="nurses" nolabel="1">

View File

@ -1,5 +1,6 @@
<list model="clinic.cycle.item" colors='{"#9f9":[["state","=","validated"]]}'>
<field name="cycle_id"/>
<field name="date"/>
<field name="branch_id"/>
<field name="state"/>
</list>

View File

@ -1,7 +1,8 @@
<form model="clinic.department" show_company="1">
<field name="name"/>
<!--<field name="code"/>-->
<field name="code"/>
<field name="parent_id"/>
<field name="pick_out_journal_id"/>
<field name="company_id" invisible="1"/>
<field name="branch_id" invisible="1"/>
</form>

View File

@ -1,9 +1,9 @@
<menu string="Clinic" perm="clinic">
<item string="Dashboard" action="clinic_board"/>
<item string="Staffs" perm="clinic_staff">
<item string="Staffs" action="clinic_staff"/>
<item string="Doctors" action="clinic_staff" action_options="tab_no=2"/>
<item string="Nurses" action="clinic_staff" action_options="tab_no=3"/>
<item string="Staffs" action="clinic_staff" action_options="tab_no=0"/>
<item string="Doctors" action="clinic_staff" action_options="tab_no=3"/>
<item string="Nurses" action="clinic_staff" action_options="tab_no=4"/>
<divider/>
<header string="ROTATION"/>
<item string="Staff Rotation" action="clinic_staff_rotate"/>
@ -51,7 +51,7 @@
<item string="Discontinue Patient" action="clinic_report_discontinue_patient"/>
</item>
<item string="Settings" perm="clinic_settings">
<item string="Branches" action="clinic_branch"/>
<item string="Branches" action="clinic_branch" perm="clinic_branch"/>
<item string="Departments" action="clinic_department"/>
<item string="Hospitals" action="clinic_hospital"/>
<item string="Nationalities" action="clinic_nation"/>

View File

@ -22,6 +22,7 @@
</list>
</field>
<field name="company_id" invisible="1"/>
<field name="branch_id" invisible="1"/>
</group>
</tab>
<tab string="Planning">

View File

@ -8,7 +8,7 @@
<field name="name"/>
<field name="available"/>
<field name="sequence"/>
<field name="branch_id"/>
<field name="branch_id" invisible="1"/>
<field name="note"/>
<field name="company_id" invisible="1"/>
<related>

View File

@ -3,7 +3,7 @@
<field name="date"/>
<field name="patient_id"/>
<field name="image" preview="1"/>
<!--<field name="sequence"/>-->
<field name="branch_id"/>
<field name="note"/>
<field name="state"/>
</list>

View File

@ -8,6 +8,7 @@
<field name="number"/>
<field name="type" required="1"/>
<field name="name"/>
<field name="branch_id" required="1"/>
<field name="name_eng"/>
<field name="nick_name"/>
<field name="department_id"/>
@ -22,7 +23,6 @@
<field name="nation_id"/>
<field name="categ_id" domain="[['type','=',type]]"/>
<field name="state"/>
<field name="branch_id"/>
</group>
<group span="6" columns="1">
<field name="image"/>

View File

@ -15,7 +15,7 @@
<field name="time_start" onchange="onchange_datefrom"/>
<field name="cycle_id" onchange="onchange_cycle" required="1"/>
<field name="department_id"/>
<field name="branch_id"/>
<field name="branch_id" required="1"/>
</group>
<group span="6" columns="1">
<field name="patient_id" onchange="onchange_patient"/>

View File

@ -7,6 +7,7 @@ class Branch(Model):
_key=['name']
_fields={
"name": fields.Char("Name",required=True,search=True),
"code": fields.Char("Code",required=True,search=True),
"parent_id": fields.Many2One("clinic.branch","Parent"),
"company_id": fields.Many2One("company","Company"),
}

View File

@ -38,23 +38,30 @@ class CycleItem(Model):
'user_id': fields.Many2One("base.user","Validator"),
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
'company_id': fields.Many2One("company", "Company"),
'branch_id': fields.Many2One("clinic.branch", "Branch"),
}
def _get_vark(self,context={}):
st=get_model("clinic.setting").browse(1)
return st.var_k or 0
def _get_branch(self,context={}):
b_ids=get_model('clinic.branch').search([])
if b_ids:
return b_ids[0]
_defaults={
'state': 'draft',
'company_id': lambda *a: get_active_company(),
'date': lambda *a: time.strftime("%Y-%m-%d"),
'user_id': lambda *a: get_active_user(),
'var_k': _get_vark,
'branch_id': _get_branch,
}
_order="date desc"
_sql_constraints=[
("cycle_item_uniq","unique (cycle_id,date,company_id)","Cycle item should be unique"),
("cycle_item_uniq","unique (cycle_id,date,company_id,branch_id)","Cycle item should be unique"),
]
def get_cycle_daily(self,date):

View File

@ -1,4 +1,4 @@
from netforce.model import Model, fields
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
class Department(Model):
@ -11,11 +11,18 @@ class Department(Model):
"code": fields.Char("Code",search=True),
"parent_id": fields.Many2One("clinic.department", "Parent"),
'company_id': fields.Many2One("company","Company"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
"pick_out_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True),
}
def _get_branch(self,context={}):
b_ids=get_model('clinic.branch').search([])
if b_ids:
return b_ids[0]
_defaults={
'company_id': lambda *a: get_active_company(),
'branch_id': _get_branch,
}
Department.register()

View File

@ -100,7 +100,7 @@ class Patient(Model):
'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"),
'department_id': fields.Many2One("clinic.department","Department"),
'cycle_id': fields.Many2One("clinic.cycle","Last Cycle",function="_get_last_cycle"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'branch_id': fields.Many2One("clinic.branch","Branch",search=True),
}
def _get_number(self,context={}):
@ -134,10 +134,16 @@ class Patient(Model):
break
return ptype_id
def _get_branch(self,context={}):
b_ids=get_model('clinic.branch').search([])
if b_ids:
return b_ids[0]
_defaults={
"number": _get_number,
"reg_date": lambda *a: time.strftime("%Y-%m-%d"),
"company_id": lambda *a: get_active_company(),
'branch_id': _get_branch,
'card_type': 'identification',
'type_id': _get_type,
"active" : True,

View File

@ -44,6 +44,7 @@ class Schedule(Model):
'date': fields.Date("Date",required=True,search=True),
'lines': fields.One2Many("clinic.schedule.line","schedule_id","Lines"),
'company_id': fields.Many2One("company","Company"),
'branch_id': fields.Many2One("clinic.branch","Branch",required=True, search=True),
'state': fields.Selection([['draft','Draft'],['confirmed', 'Confirmed']],'State',search=True),
'user_id': fields.Many2One("base.user","Confirm By"),
}
@ -52,9 +53,15 @@ class Schedule(Model):
datenow=datetime.now().strftime("%Y-%m-%d")
return datenow
def _get_branch(self,context={}):
b_ids=get_model("clinic.branch").search([])
if b_ids:
return b_ids[0]
_defaults={
'user_id': lambda *a: get_active_user(),
"company_id": lambda *a: get_active_company(),
'branch_id': _get_branch,
'date': _get_date,
'time_start': lambda *a: datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
'time_stop': lambda *a: (datetime.now()+timedelta(seconds=3600)).strftime("%Y-%m-%d %H:%M:%S"),
@ -64,7 +71,7 @@ class Schedule(Model):
_order="date desc"
_sql_constraints=[
('schedule_uniq','unique (date,company_id)','Date should be unique'),
('schedule_uniq','unique (date,company_id,branch_id)','Date should be unique'),
]
def confirm(self,ids,context={}):

View File

@ -4,6 +4,7 @@ from netforce.access import get_active_company, get_active_user
class SickBed(Model):
_name="clinic.sickbed"
_string="Sickbed"
_key=['name','branch_id']
def _get_all(self,ids,context={}):
res={}
@ -38,7 +39,7 @@ class SickBed(Model):
'branch_id': fields.Many2One("clinic.branch","Branch",required=True, search=True),
}
def _get_sickbed(self,context={}):
def _get_branch(self,context={}):
user_id=get_active_user()
staffs=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
branch_id=None
@ -53,7 +54,7 @@ class SickBed(Model):
"company_id": lambda *a: get_active_company(),
'sequence': 0,
'state': 'available',
'branch_id': _get_sickbed,
'branch_id': _get_branch,
}
_order="sequence"

View File

@ -116,7 +116,7 @@ class Staff(Model):
"hd_case_staffs": fields.One2Many("clinic.hd.case.staff","staff_id","HD Cases"),
"hd_cases": fields.Many2Many("clinic.hd.case","HD Cases",function="_get_hdcase"), # not need to use (it's slow to load)
"cycle_item_nurses": fields.One2Many("clinic.cycle.item.nurse","nurse_id","Cycle Items"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
}
def _get_number(self,context={}):

View File

@ -196,9 +196,11 @@ class Visit(Model):
date=vals['time_start'][0:10]
cycle=obj.cycle_id
branch=obj.branch_id
dom=[]
dom.append(['date','=',date])
dom.append(['cycle_id','=',cycle.id])
dom.append(['branch_id','=',branch.id])
item_obj=get_model('clinic.cycle.item')
item_ids=item_obj.search(dom)
@ -213,6 +215,7 @@ class Visit(Model):
item_vals={
'cycle_id': cycle.id,
'branch_id': branch.id,
'date': date,
'nurses': [],
}

View File

@ -1,10 +1,23 @@
sharing setting
- filter by branch
- patient
- staff
- visit
- hd case
- cycle item
- sickbed
- patient -> ok
- staff -> ok
- nurse ยังไม่มีรายชื่อสาขาที่เขาเลือก
- doctor ยังไม่ match ก้ับคนไข้
- visit -> ok
- hd case -> ok
- cycle item -> ok
- department -> ok
- sickbed -> ok
- schedule ->
- dialyser
- add popup to new dialyser
- running number
user:
- update hd case
link:
clinic.rddialysis.co.th
test.rddialysis.co.th