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"> <form model="clinic.branch" show_company="1">
<field name="name"/> <field name="name"/>
<field name="code"/>
<field name="parent_id"/> <field name="parent_id"/>
<field name="company_id"/> <field name="company_id"/>
</form> </form>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,23 +38,30 @@ class CycleItem(Model):
'user_id': fields.Many2One("base.user","Validator"), 'user_id': fields.Many2One("base.user","Validator"),
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"), "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
'company_id': fields.Many2One("company", "Company"), 'company_id': fields.Many2One("company", "Company"),
'branch_id': fields.Many2One("clinic.branch", "Branch"),
} }
def _get_vark(self,context={}): def _get_vark(self,context={}):
st=get_model("clinic.setting").browse(1) st=get_model("clinic.setting").browse(1)
return st.var_k or 0 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={ _defaults={
'state': 'draft', 'state': 'draft',
'company_id': lambda *a: get_active_company(), 'company_id': lambda *a: get_active_company(),
'date': lambda *a: time.strftime("%Y-%m-%d"), 'date': lambda *a: time.strftime("%Y-%m-%d"),
'user_id': lambda *a: get_active_user(), 'user_id': lambda *a: get_active_user(),
'var_k': _get_vark, 'var_k': _get_vark,
'branch_id': _get_branch,
} }
_order="date desc" _order="date desc"
_sql_constraints=[ _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): 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 from netforce.access import get_active_company
class Department(Model): class Department(Model):
@ -11,11 +11,18 @@ class Department(Model):
"code": fields.Char("Code",search=True), "code": fields.Char("Code",search=True),
"parent_id": fields.Many2One("clinic.department", "Parent"), "parent_id": fields.Many2One("clinic.department", "Parent"),
'company_id': fields.Many2One("company","Company"), '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), "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={ _defaults={
'company_id': lambda *a: get_active_company(), 'company_id': lambda *a: get_active_company(),
'branch_id': _get_branch,
} }
Department.register() Department.register()

View File

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

View File

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

View File

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

View File

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

View File

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