replace personal to staff (need to migrate)
parent
c1e2142629
commit
700cc56e18
|
@ -1,7 +1,7 @@
|
|||
<action>
|
||||
<field name="string">Personals</field>
|
||||
<field name="string">Staffs</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.personal</field>
|
||||
<field name="model">clinic.staff</field>
|
||||
<field name="tabs">[["All",[]],["Archived",[["active","=",false]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]]</field>
|
||||
<field name="modes">list,page,form</field>
|
||||
<field name="menu">clinic_menu</field>
|
|
@ -1,7 +1,7 @@
|
|||
<action>
|
||||
<field name="string">Personal Levels</field>
|
||||
<field name="string">Staff Categories</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.personal.level</field>
|
||||
<field name="model">clinic.staff.categ</field>
|
||||
<field name="modes">list,page,form</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -1,7 +1,7 @@
|
|||
<action>
|
||||
<field name="string">Personal Categories</field>
|
||||
<field name="string">Staff Levels</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.personal.categ</field>
|
||||
<field name="model">clinic.staff.level</field>
|
||||
<field name="modes">list,page,form</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -1,6 +1,6 @@
|
|||
<action>
|
||||
<field name="string">Personal Moves</field>
|
||||
<field name="string">Staff Moves</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.personal.move</field>
|
||||
<field name="model">clinic.staff.move</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -12,7 +12,7 @@
|
|||
<field name="lines" nolabel="1">
|
||||
<list>
|
||||
<field name="cycle_id"/>
|
||||
<field name="personal_id"/>
|
||||
<field name="staff_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="type"/>
|
||||
<field name="qty" onchange="onchange_line"/>
|
||||
|
@ -21,7 +21,7 @@
|
|||
</list>
|
||||
<form>
|
||||
<field name="cycle_id"/>
|
||||
<field name="personal_id"/>
|
||||
<field name="staff_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="type"/>
|
||||
<field name="qty"/>
|
||||
|
|
|
@ -77,11 +77,11 @@
|
|||
<field name="amount"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Personals">
|
||||
<field name="personals" nolabel="1">
|
||||
<tab string="Staffs">
|
||||
<field name="staffs" nolabel="1">
|
||||
<list>
|
||||
<field name="type"/>
|
||||
<field name="personal_id" domain="[['type','=',type]]"/>
|
||||
<field name="staff_id" domain="[['type','=',type]]"/>
|
||||
<field name="priop"/>
|
||||
<field name="note"/>
|
||||
</list>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<menu string="Clinic">
|
||||
<item string="Dashboard" action="clinic_board"/>
|
||||
<item string="Personals">
|
||||
<item string="Personals" action="clinic_personal"/>
|
||||
<item string="Doctors" action="clinic_personal" action_options="tab_no=2"/>
|
||||
<item string="Nurses" action="clinic_personal" action_options="tab_no=3"/>
|
||||
<item string="Staffs">
|
||||
<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"/>
|
||||
<divider/>
|
||||
<header string="MOVEMENT"/>
|
||||
<item string="Movement" action="clinic_personal_move"/>
|
||||
<item string="Staff Movement" action="clinic_staff_move"/>
|
||||
<divider/>
|
||||
<header string="SETTINGS"/>
|
||||
<item string="Categories" action="clinic_personal_categ"/>
|
||||
<item string="Levels" action="clinic_personal_level"/>
|
||||
<item string="Categories" action="clinic_staff_categ"/>
|
||||
<item string="Levels" action="clinic_staff_level"/>
|
||||
</item>
|
||||
<item string="Patients">
|
||||
<item string="New Patient" action="clinic_patient" action_options="mode=form"/>
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<field name="date" span="3" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="3"/>
|
||||
<field name="date_to" span="3"/>
|
||||
<field name="personal_id" span="3"/>
|
||||
<field name="staff_id" span="3"/>
|
||||
<field name="type" span="3"/>
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<form model="clinic.personal.categ">
|
||||
<form model="clinic.staff.categ">
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="parent_id" domain="[['type','=',type]]"/>
|
|
@ -1,4 +1,4 @@
|
|||
<list model="clinic.personal.categ">
|
||||
<list model="clinic.staff.categ">
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="parent_id"/>
|
|
@ -1,4 +1,4 @@
|
|||
<form model="clinic.personal">
|
||||
<form model="clinic.staff">
|
||||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
|
@ -25,6 +25,7 @@
|
|||
<group span="6" columns="1">
|
||||
<field name="picture"/>
|
||||
<field name="user_id"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="email"/>
|
||||
<field name="mobile"/>
|
||||
<field name="phone"/>
|
|
@ -1,4 +1,4 @@
|
|||
<form model="clinic.personal.level">
|
||||
<form model="clinic.staff.level">
|
||||
<head>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="Copy" method="copy"/>
|
|
@ -1,7 +1,6 @@
|
|||
<list model="clinic.personal.level">
|
||||
<list model="clinic.staff.level">
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<!--<field name="formular"/>-->
|
||||
<field name="description"/>
|
||||
<field name="sequence"/>
|
||||
</list>
|
|
@ -1,4 +1,4 @@
|
|||
<list model="clinic.personal">
|
||||
<list model="clinic.staff">
|
||||
<field name="number"/>
|
||||
<field name="name"/>
|
||||
<field name="level_id"/>
|
|
@ -1,5 +1,5 @@
|
|||
<form model="clinic.personal.move">
|
||||
<field name="personal_id"/>
|
||||
<form model="clinic.staff.move">
|
||||
<field name="staff_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="from_company_id"/>
|
||||
<field name="to_company_id"/>
|
|
@ -1,5 +1,5 @@
|
|||
<list model="clinic.personal.move">
|
||||
<field name="personal_id"/>
|
||||
<list model="clinic.staff.move">
|
||||
<field name="staff_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="from_company_id"/>
|
||||
<field name="to_company_id"/>
|
|
@ -19,7 +19,7 @@ from . import visit
|
|||
from . import visit_board
|
||||
from . import hd_case
|
||||
from . import hd_case_line
|
||||
from . import hd_case_personal
|
||||
from . import hd_case_staff
|
||||
from . import hd_case_gmline
|
||||
from . import hd_case_discont
|
||||
from . import hd_case_payment
|
||||
|
@ -30,7 +30,6 @@ from . import import_payment
|
|||
from . import cycle
|
||||
from . import cycle_item
|
||||
from . import cycle_item_nurse
|
||||
from . import cycle_item_doctor
|
||||
from . import cycle_item_line
|
||||
from . import cycle_dialy
|
||||
from . import cycle_dialy_line
|
||||
|
@ -42,11 +41,11 @@ from . import import_data_sc
|
|||
from . import payment
|
||||
from . import account_payment
|
||||
from . import account_invoice
|
||||
from . import personal
|
||||
from . import personal_categ
|
||||
from . import personal_level
|
||||
from . import personal_move
|
||||
from . import personal_cycle
|
||||
from . import staff
|
||||
from . import staff_categ
|
||||
from . import staff_level
|
||||
from . import staff_move
|
||||
from . import staff_cycle
|
||||
from . import schedule
|
||||
from . import schedule_line
|
||||
from . import schedule_copy
|
||||
|
|
|
@ -5,7 +5,7 @@ class Address(Model):
|
|||
|
||||
_fields={
|
||||
"patient_id": fields.Many2One("clinic.patient","Patient"),
|
||||
"personal_id": fields.Many2One("clinic.personal","Personal"),
|
||||
"staff_id": fields.Many2One("clinic.staff","Staff"),
|
||||
}
|
||||
|
||||
Address.register()
|
||||
|
|
|
@ -8,13 +8,13 @@ class CycleDialyLine(Model):
|
|||
_fields={
|
||||
"cycle_dialy_id": fields.Many2One("clinic.cycle.dialy","Cycle Dialy"),
|
||||
'cycle_id': fields.Many2One("clinic.cycle", "Cycle"),
|
||||
'personal_id': fields.Many2One("clinic.personal", "Personal"),
|
||||
'level_id': fields.Many2One("clinic.personal.level", "Level"),
|
||||
'staff_id': fields.Many2One("clinic.staff", "Staff"),
|
||||
'level_id': fields.Many2One("clinic.staff.level", "Level"),
|
||||
'qty': fields.Integer("Qty"),
|
||||
'rate': fields.Float("Rate"),
|
||||
'amount': fields.Float("Amount"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("personal","Personal")],"Type",required=True),
|
||||
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Type",required=True),
|
||||
'date': fields.Date("Date"),
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ class CycleItem(Model):
|
|||
level=nr.level_id
|
||||
lines.append(('create',{
|
||||
'cycle_id': obj.cycle_id.id,
|
||||
'personal_id': nurse.id,
|
||||
'staff_id': nurse.id,
|
||||
'level_id': nurse.level_id.id,
|
||||
'rate': levels.get(level.id, 0.0),
|
||||
'type': 'nurse',
|
||||
|
@ -138,34 +138,34 @@ class CycleItem(Model):
|
|||
# cost's doctor
|
||||
st=get_model('clinic.setting').browse(1)
|
||||
cost_per_case=st.cost_per_case or 0
|
||||
personal_total={}
|
||||
staff_total={}
|
||||
for hd_case in obj.hd_cases:
|
||||
personals=hd_case.personals
|
||||
for ps in personals:
|
||||
personal=ps.personal_id
|
||||
if not personal:
|
||||
staffs=hd_case.staffs
|
||||
for ps in staffs:
|
||||
staff=ps.staff_id
|
||||
if not staff:
|
||||
continue
|
||||
base=personal.base
|
||||
base=staff.base
|
||||
if not base:
|
||||
base=cost_per_case
|
||||
if not personal_total.get(personal.id):
|
||||
personal_total[personal.id]={
|
||||
if not staff_total.get(staff.id):
|
||||
staff_total[staff.id]={
|
||||
'base': 0,
|
||||
'level_id': personal.level_id.id,
|
||||
'level_id': staff.level_id.id,
|
||||
'type': ps.type,
|
||||
'qty': 0,
|
||||
}
|
||||
personal_total[personal.id]['base']=base
|
||||
personal_total[personal.id]['qty']+=1
|
||||
staff_total[staff.id]['base']=base
|
||||
staff_total[staff.id]['qty']+=1
|
||||
|
||||
for doctor_id, value in personal_total.items():
|
||||
for doctor_id, value in staff_total.items():
|
||||
base=value['base']
|
||||
type=value['type']
|
||||
qty=value['qty']
|
||||
level_id=value['level_id']
|
||||
lines.append(('create',{
|
||||
'cycle_id': obj.cycle_id.id,
|
||||
'personal_id': doctor_id,
|
||||
'staff_id': doctor_id,
|
||||
'level_id': level_id,
|
||||
'rate': base,
|
||||
'qty': qty,
|
||||
|
@ -179,17 +179,17 @@ class CycleItem(Model):
|
|||
if obj.cycle_id.id==cycle.id: # only own cycle
|
||||
line.delete()
|
||||
|
||||
# group personal and cycle date
|
||||
# group staff and cycle date
|
||||
glines={}
|
||||
for line in lines:
|
||||
mode,vals=line
|
||||
cycle_id=vals['cycle_id']
|
||||
personal_id=vals['personal_id']
|
||||
staff_id=vals['staff_id']
|
||||
#amount=vals['amount'] or 0
|
||||
rate=vals['rate'] or 0
|
||||
qty=vals['qty'] or 0
|
||||
amount=qty*rate
|
||||
key=(cycle_id,personal_id)
|
||||
key=(cycle_id,staff_id)
|
||||
if not key in glines.keys():
|
||||
glines[key]={
|
||||
'amount': amount,
|
||||
|
@ -204,10 +204,10 @@ class CycleItem(Model):
|
|||
|
||||
lines=[]
|
||||
for key,vals in glines.items():
|
||||
cycle_id,personal_id=key
|
||||
cycle_id,staff_id=key
|
||||
line={
|
||||
'cycle_id': cycle_id,
|
||||
'personal_id': personal_id,
|
||||
'staff_id': staff_id,
|
||||
'date': obj.date,
|
||||
}
|
||||
line.update(vals)
|
||||
|
@ -247,7 +247,7 @@ class CycleItem(Model):
|
|||
line.delete()
|
||||
|
||||
levels={}
|
||||
for level_id in get_model('clinic.personal.level').search([['type','=','nurse']]):
|
||||
for level_id in get_model('clinic.staff.level').search([['type','=','nurse']]):
|
||||
vals={
|
||||
level_id: {
|
||||
'total': 0,
|
||||
|
@ -384,7 +384,7 @@ class CycleItem(Model):
|
|||
path=context["path"]
|
||||
line=get_data_path(data,path,parent=True)
|
||||
nurse_id=line['nurse_id']
|
||||
nurse=get_model('clinic.personal').browse(nurse_id)
|
||||
nurse=get_model('clinic.staff').browse(nurse_id)
|
||||
line['level_id']=nurse.level_id.id
|
||||
return data
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class CycleItemDoctor(Model):
|
||||
_name="clinic.cycle.item.doctor"
|
||||
_string="Cycle Item Doctor"
|
||||
|
||||
_fields={
|
||||
'cycle_item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
|
||||
'categ_id': fields.Many2One("clinic.personal.categ", "Category",),
|
||||
'doctor_id': fields.Many2One("clinic.personal",'Doctor',domain=[['type','=','doctor']]),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
}
|
||||
|
||||
CycleItemDoctor.register()
|
|
@ -15,7 +15,7 @@ class CycleItemLine(Model):
|
|||
|
||||
_fields={
|
||||
'item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
|
||||
'level_id': fields.Many2One("clinic.personal.level", "Level",domain=[['type','=','nurse']]),
|
||||
'level_id': fields.Many2One("clinic.staff.level", "Level",domain=[['type','=','nurse']]),
|
||||
'qty': fields.Integer("Qty"),
|
||||
'var_a': fields.Float("A"),
|
||||
'var_b': fields.Float("B"),
|
||||
|
@ -31,5 +31,4 @@ class CycleItemLine(Model):
|
|||
"company_id": lambda *a: get_active_company(),
|
||||
}
|
||||
|
||||
|
||||
CycleItemLine.register()
|
||||
|
|
|
@ -7,8 +7,8 @@ class CycleItemNurse(Model):
|
|||
|
||||
_fields={
|
||||
'cycle_item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
|
||||
'level_id': fields.Many2One("clinic.personal.level", "Level",),
|
||||
'nurse_id': fields.Many2One("clinic.personal",'Nurse',domain=[['type','=','nurse']]),
|
||||
'level_id': fields.Many2One("clinic.staff.level", "Level",),
|
||||
'nurse_id': fields.Many2One("clinic.staff",'Nurse',domain=[['type','=','nurse']]),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
|
|
@ -31,12 +31,12 @@ class GenVisit(Model):
|
|||
'friday': fields.Boolean("Fridays"),
|
||||
'sathurday': fields.Boolean("Sathurday"),
|
||||
'sunday': fields.Boolean("Sunday"),
|
||||
'doctor_id': fields.Many2One("clinic.personal","Doctor",domain=[['type','=','doctor']]),
|
||||
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
|
||||
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC."),("personal","Personal"),("others","Others")],"Patient Type"),
|
||||
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC."),("others","Others")],"Patient Type"),
|
||||
'patient_categ_id': fields.Many2One("clinic.patient.categ", "Patient Category"),
|
||||
'nurse_categ_id': fields.Many2One("clinic.personal.categ", "Nurse Category", domain=[['type','=','nurse']]),
|
||||
'nurse_categ_id': fields.Many2One("clinic.staff.categ", "Nurse Category", domain=[['type','=','nurse']]),
|
||||
}
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@ class GenVisit(Model):
|
|||
'level_id': nurse.level_id.id,
|
||||
})
|
||||
if not nurse_vals:
|
||||
for nurse in get_model("clinic.personal").search_browse([['type','=','nurse'],['categ_id','=',obj.nurse_categ_id.id]]):
|
||||
for nurse in get_model("clinic.staff").search_browse([['type','=','nurse'],['categ_id','=',obj.nurse_categ_id.id]]):
|
||||
nurse_vals.append({
|
||||
'id': nurse.id,
|
||||
'level_id': nurse.level_id.id,
|
||||
|
|
|
@ -7,7 +7,7 @@ class GenVisitLine(Model):
|
|||
_fields={
|
||||
'gen_id': fields.Many2One("clinic.gen.visit","gen_id","Gen Visit"),
|
||||
'patient_id': fields.Many2One("clinic.patient","Patient"),
|
||||
'nurse_id': fields.Many2One("clinic.personal","Nurse", domain=[['type','=','nurse']]),
|
||||
'nurse_id': fields.Many2One("clinic.staff","Nurse", domain=[['type','=','nurse']]),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class HDCase(Model):
|
|||
"time_stop": fields.DateTime("Time Stop",required=True,search=True),
|
||||
"date": fields.Date("Date",required=True,search=True),
|
||||
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
||||
"nurse_id": fields.Many2One("clinic.personal","Approve By", domain=[['type','=','nurse']]),
|
||||
"nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]),
|
||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||
"wh_start": fields.Float("Wt.Kg start"),
|
||||
"wh_stop": fields.Float("Wt.Kg stop"),
|
||||
|
@ -51,7 +51,7 @@ class HDCase(Model):
|
|||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
||||
"dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"),
|
||||
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
|
||||
"personals": fields.One2Many("clinic.hd.case.personal","hd_case_id","Personals"),
|
||||
"staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"),
|
||||
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
|
||||
"amount": fields.Float("Due Amount",function="get_total",readonly=True,function_multi=True),
|
||||
"total": fields.Float("Total",function="get_total",readonly=True,function_multi=True),
|
||||
|
@ -73,11 +73,9 @@ class HDCase(Model):
|
|||
'pay_account_id': fields.Many2One("account.account","Account"),
|
||||
'payment_id': fields.Many2One("account.payment","Payment"), # for print
|
||||
'dlz_id': fields.Many2One("clinic.dialyzer","Dialyzer"), # for link
|
||||
"total_doctor": fields.Integer("Total Doctor",function="get_personal",function_multi=True),
|
||||
"total_nurse": fields.Integer("Total Nurse",function="get_personal",function_multi=True),
|
||||
'doctor_id': fields.Many2One("clinic.personal","Doctor",domain=[['type','=','doctor']],function="get_personal",function_multi=True),
|
||||
# XXX
|
||||
#"payment_term": fields.Selection([("fee_prod","Invoice Fee & Product"),("x","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
||||
"total_doctor": fields.Integer("Total Doctor",function="get_staff",function_multi=True),
|
||||
"total_nurse": fields.Integer("Total Nurse",function="get_staff",function_multi=True),
|
||||
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']],function="get_staff",function_multi=True),
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
|
@ -683,16 +681,16 @@ class HDCase(Model):
|
|||
context['state']='draft'
|
||||
obj.undo(context=context)
|
||||
|
||||
def get_personal(self,ids,context={}):
|
||||
def get_staff(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
doctor=0
|
||||
nurse=0
|
||||
doctor_id=None
|
||||
for ps in obj.personals:
|
||||
for ps in obj.staffs:
|
||||
if ps.type=="doctor":
|
||||
if ps.priop=='owner':
|
||||
doctor_id=ps.personal_id.id
|
||||
doctor_id=ps.staff_id.id
|
||||
doctor+= 1
|
||||
else:
|
||||
nurse+=1
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from netforce.model import Model, fields
|
||||
|
||||
class HdCasePersonal(Model):
|
||||
_name="clinic.hd.case.personal"
|
||||
class HdCaseStaff(Model):
|
||||
_name="clinic.hd.case.staff"
|
||||
_fields={
|
||||
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
|
||||
"personal_id": fields.Many2One("clinic.personal","Personal",search=True),
|
||||
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("other","Other")],"Type",required=True),
|
||||
"staff_id": fields.Many2One("clinic.staff","Staff",search=True),
|
||||
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("others","Others")],"Type",required=True),
|
||||
"priop": fields.Selection([("owner","Owner"),('other','Other')],"Priority"),
|
||||
'note': fields.Char("Note"),
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ class HdCasePersonal(Model):
|
|||
'priop': 'other',
|
||||
}
|
||||
|
||||
HdCasePersonal.register()
|
||||
HdCaseStaff.register()
|
||||
|
|
@ -6,7 +6,7 @@ class LoadNurse(Model):
|
|||
|
||||
_fields={
|
||||
"schedule_id": fields.Many2One("clinic.schedule","Schedule",on_delete="cascade"),
|
||||
'categ_id': fields.Many2One("clinic.personal.categ","Category", domain=[['type','=','nurse']]),
|
||||
'categ_id': fields.Many2One("clinic.staff.categ","Category", domain=[['type','=','nurse']]),
|
||||
"lines": fields.One2Many("clinic.schedule.load.nurse.line",'load_id', 'Lines'),
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ class LoadNurse(Model):
|
|||
if cycle_ids:
|
||||
cycle_id=cycle_ids[0]
|
||||
lines=[]
|
||||
for nurse in get_model("clinic.personal").search_browse([['type','=','nurse']]):
|
||||
for nurse in get_model("clinic.staff").search_browse([['type','=','nurse']]):
|
||||
in_cycle_id=None
|
||||
if nurse.cycle_id.id:
|
||||
in_cycle_id=nurse.cycle_id.id
|
||||
|
|
|
@ -6,7 +6,7 @@ class LoadNurseLine(Model):
|
|||
|
||||
_fields={
|
||||
"load_id": fields.Many2One("clinic.schedule.load.nurse","Load Nurse",required=True,on_delete="cascade"),
|
||||
'nurse_id': fields.Many2One("clinic.personal","Nurse",domain=[['type','=','nurse']]),
|
||||
'nurse_id': fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]),
|
||||
'cycle_id': fields.Many2One("clinic.cycle", "Cycle"),
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class Patient(Model):
|
|||
"active":fields.Boolean("Uncheck as discountinue", search=True),
|
||||
'note': fields.Text("Note"),
|
||||
'categ_id': fields.Many2One("clinic.patient.categ","Category"),
|
||||
'doctor_id': fields.Many2One("clinic.personal","Doctor",domain=[['type','=','doctor']]),
|
||||
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
|
||||
"documents": fields.One2Many("document","related_id","Documents"),
|
||||
'resign_date': fields.Date("Resign Date"),
|
||||
'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"),
|
||||
|
@ -111,7 +111,7 @@ class Patient(Model):
|
|||
#'cause_lines': _get_cause_line,
|
||||
"active" : True,
|
||||
}
|
||||
_order="date desc,number desc"
|
||||
_order="resign_date desc,number desc"
|
||||
|
||||
def void(self,ids, context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
|
|
|
@ -15,8 +15,8 @@ class ReportNurseFeeDetail(Model):
|
|||
"date": fields.Date("Month"),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
"date_to": fields.Date("To", required=True),
|
||||
'personal_id': fields.Many2One("clinic.personal","Personal"),
|
||||
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["personal","Personal"]],"Type"),
|
||||
'staff_id': fields.Many2One("clinic.staff","Staff"),
|
||||
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
|
||||
}
|
||||
|
||||
def _get_date_from(self,context={}):
|
||||
|
@ -47,39 +47,39 @@ class ReportNurseFeeDetail(Model):
|
|||
year,month,day=defaults['date'].split("-")
|
||||
time_start='%s-%s-01'%(year,str(month).zfill(2))
|
||||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||
personal_id=None
|
||||
personal_type=None
|
||||
staff_id=None
|
||||
staff_type=None
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
month=obj.date_from.split("-")[1]
|
||||
time_start=obj.date_from
|
||||
time_stop=obj.date_to
|
||||
personal_id=obj.personal_id.id
|
||||
personal_type=obj.type
|
||||
staff_id=obj.staff_id.id
|
||||
staff_type=obj.type
|
||||
# new patient of this month
|
||||
dom=[]
|
||||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
personal_name=''
|
||||
if personal_id:
|
||||
personal=get_model("clinic.personal").browse(personal_id)
|
||||
personal_name=personal.name
|
||||
dom.append(['personal_id','=',personal.id])
|
||||
staff_name=''
|
||||
if staff_id:
|
||||
staff=get_model("clinic.staff").browse(staff_id)
|
||||
staff_name=staff.name
|
||||
dom.append(['staff_id','=',staff.id])
|
||||
records=get_model('clinic.cycle.dialy.line').search_browse(dom)
|
||||
# group by date
|
||||
all_vals={}
|
||||
for record in records:
|
||||
date=record.date
|
||||
personal=record.personal_id
|
||||
if personal_type:
|
||||
if personal_type!=personal.type:
|
||||
staff=record.staff_id
|
||||
if staff_type:
|
||||
if staff_type!=staff.type:
|
||||
continue
|
||||
key=(date,personal.id)
|
||||
key=(date,staff.id)
|
||||
if key not in all_vals.keys():
|
||||
all_vals[key]={
|
||||
'qty': 0,
|
||||
'personal_type': utils.PERSONAL_TYPE.get(personal.type,''),
|
||||
'personal_name': personal.name or "",
|
||||
'staff_type': utils.STAFF_TYPE.get(staff.type,''),
|
||||
'staff_name': staff.name or "",
|
||||
'amount': 0,
|
||||
}
|
||||
all_vals[key]['qty']+=record.qty or 0
|
||||
|
@ -89,16 +89,16 @@ class ReportNurseFeeDetail(Model):
|
|||
total_amount=0.0
|
||||
total_qty=0.0
|
||||
for key,vals in all_vals.items():
|
||||
date,personal_id=key
|
||||
date,staff_id=key
|
||||
qty=vals['qty'] or 0
|
||||
amount=vals['amount'] or 0
|
||||
_personal_name=vals['personal_name'] or ''
|
||||
personal_type=vals['personal_type']
|
||||
_staff_name=vals['staff_name'] or ''
|
||||
staff_type=vals['staff_type']
|
||||
lines.append({
|
||||
'date': date,
|
||||
'qty': qty,
|
||||
'personal_type': personal_type,
|
||||
'personal_name': _personal_name,
|
||||
'staff_type': staff_type,
|
||||
'staff_name': _staff_name,
|
||||
'amount': amount or 0.0,
|
||||
})
|
||||
total_qty+=qty
|
||||
|
@ -111,7 +111,7 @@ class ReportNurseFeeDetail(Model):
|
|||
data={
|
||||
'company_name': company.name or "",
|
||||
'parent_company_name': company.parent_id.name or "",
|
||||
'personal_name': personal_name,
|
||||
'staff_name': staff_name,
|
||||
'lines': sorted(lines,key=lambda x: x['date']),
|
||||
'total_qty': total_qty,
|
||||
'total_amount': total_amount,
|
||||
|
|
|
@ -17,7 +17,7 @@ class ReportNurseFeeSum(Model):
|
|||
"date": fields.Date("Month"),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
"date_to": fields.Date("To", required=True),
|
||||
"nurse_id": fields.Many2One("clinic.personal","Nurse", domain=[['type','=','nurse']]),
|
||||
"nurse_id": fields.Many2One("clinic.staff","Nurse", domain=[['type','=','nurse']]),
|
||||
}
|
||||
|
||||
def _get_date_from(self,context={}):
|
||||
|
@ -75,7 +75,7 @@ class ReportNurseFeeSum(Model):
|
|||
total_sum=0.0
|
||||
dom=[]
|
||||
dom.append(['type','=','nurse'])
|
||||
for nurse in get_model("clinic.personal").search_browse(dom):
|
||||
for nurse in get_model("clinic.staff").search_browse(dom):
|
||||
if nurse_id:
|
||||
if nurse_id!=nurse.id:
|
||||
continue
|
||||
|
@ -90,7 +90,7 @@ class ReportNurseFeeSum(Model):
|
|||
total_all[date]=0.0
|
||||
dom=[]
|
||||
dom.append(['date','=',date])
|
||||
dom.append(['personal_id','=',nurse.id])
|
||||
dom.append(['staff_id','=',nurse.id])
|
||||
amt=0
|
||||
results=get_model("clinic.cycle.dialy.line").search_read(dom,['amount','cycle_dialy_id'])
|
||||
cycle_dialy_id=None
|
||||
|
|
|
@ -164,7 +164,7 @@ class Schedule(Model):
|
|||
return data
|
||||
|
||||
def load_all_nurse(self,ids,context={}):
|
||||
nurses=get_model("clinic.personal").search_browse([['type','=','nurse']])
|
||||
nurses=get_model("clinic.staff").search_browse([['type','=','nurse']])
|
||||
vals={
|
||||
'lines': [],
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ class Schedule(Model):
|
|||
path=context["path"]
|
||||
line=get_data_path(data,path,parent=True)
|
||||
nurse_id=line['nurse_id']
|
||||
nurse=get_model("clinic.personal").browse(nurse_id)
|
||||
nurse=get_model("clinic.staff").browse(nurse_id)
|
||||
line['level_id']=nurse.level_id.id
|
||||
return data
|
||||
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class Schedule(Model):
|
||||
_name="clinic.schedule"
|
||||
_string="Schedule"
|
||||
#_field_name="cycle_id"
|
||||
|
||||
def _get_name(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
nurse_list=','.join(nurse.name for nurse in obj.nurses)
|
||||
res[obj.id]='%s, Nurse: %s'%(obj.cycle_id.name or "", nurse_list)
|
||||
return res
|
||||
|
||||
def _get_item(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
item_ids=get_model("clinic.cycle.item").search([['cycle_id','=',obj.cycle_id.id],['date','=',obj.time_start[0:10]]])
|
||||
item_id=None
|
||||
if item_ids:
|
||||
item_id=item_ids[0]
|
||||
res[obj.id]=item_id
|
||||
return res
|
||||
|
||||
_fields={
|
||||
"name": fields.Char("Name",function="_get_name"),
|
||||
'cycle_id': fields.Many2One("clinic.cycle","Cycle",required=True),
|
||||
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item", function="_get_item"),
|
||||
"time_start": fields.DateTime("Time Start",required=True),
|
||||
"time_stop": fields.DateTime("Time Stop",required=True),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
'nurses': fields.Many2Many('clinic.personal','Nurses'), # XXX domain
|
||||
'state': fields.Selection([['draft','Draft'],['confirmed', 'Confirmed']],'State'),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
'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"),
|
||||
'state': 'draft',
|
||||
}
|
||||
|
||||
def confirm(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({
|
||||
'state': 'confirmed',
|
||||
})
|
||||
|
||||
def to_draft(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({
|
||||
'state': 'draft',
|
||||
})
|
||||
|
||||
|
||||
def copy(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
nurse_ids=[nurse.id for nurse in obj.nurses]
|
||||
vals={
|
||||
'cycle_id': obj.cycle_id.id,
|
||||
'time_start': obj.time_start,
|
||||
'time_stop': obj.time_stop,
|
||||
'nurses': [('add', nurse_ids)],
|
||||
}
|
||||
obj_id=get_model("clinic.schedule").create(vals)
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_schedule',
|
||||
'mode': 'form',
|
||||
'active_id': obj_id,
|
||||
},
|
||||
'flash': 'Copy schedule successfully',
|
||||
}
|
||||
|
||||
def copy_nurses(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
nurses=[]
|
||||
for nurse in obj.nurses:
|
||||
nurses.append(('create',{
|
||||
'nurse_id': nurse.id,
|
||||
'level_id': nurse.level_id.id,
|
||||
}))
|
||||
|
||||
for nurse in obj.cycle_item_id.nurses:
|
||||
nurse.delete()
|
||||
|
||||
obj.cycle_item_id.write({
|
||||
'nurses': nurses,
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_item',
|
||||
'mode': 'form',
|
||||
'active_id': obj.cycle_item_id.id,
|
||||
},
|
||||
'flash': 'Copy nurses to cycle item successfully',
|
||||
}
|
||||
|
||||
def view_cycle_item(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
item_id=obj.cycle_item_id.id
|
||||
msg=''
|
||||
if not item_id:
|
||||
# XXX
|
||||
item_id=get_model("clinic.cycle.item").create({
|
||||
'cycle_id': obj.cycle_id.id,
|
||||
'date': obj.time_start[0:10],
|
||||
})
|
||||
#raise Exception("No found cycle item")
|
||||
item_nurse_obj=get_model("clinic.cycle.item.nurse")
|
||||
for nurse in obj.nurses:
|
||||
item_nurse_obj.create({
|
||||
'cycle_item_id': item_id,
|
||||
'nurse_id': nurse.id,
|
||||
'level_id': nurse.level_id.id,
|
||||
})
|
||||
msg='Create Cycle Item successfully'
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_item',
|
||||
'mode': 'form',
|
||||
'active_id': item_id,
|
||||
},
|
||||
'flash': msg,
|
||||
}
|
||||
|
||||
Schedule.register()
|
|
@ -14,8 +14,8 @@ class ScheduleLine(Model):
|
|||
'schedule_id': fields.Many2One("clinic.schedule","Schedule"),
|
||||
'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
|
||||
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"),
|
||||
"nurse_id": fields.Many2One("clinic.personal","Nurse",domain=[['type','=','nurse']]),
|
||||
'level_id': fields.Many2One("clinic.personal.level","Level",function="_get_level"),
|
||||
"nurse_id": fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]),
|
||||
'level_id': fields.Many2One("clinic.staff.level","Level",function="_get_level"),
|
||||
}
|
||||
|
||||
ScheduleLine.register()
|
||||
|
|
|
@ -105,8 +105,8 @@ class ClinicSetting(Model):
|
|||
print("="*50)
|
||||
patients=get_model("clinic.patient").search_read([],['name','hn'])
|
||||
visits=get_model("clinic.visit").search_read([],['number','time_start','cycle_id','state'])
|
||||
doctor_ids=[dt['id'] for dt in get_model("clinic.personal").search_read([['type','=','doctor']],['name'])]
|
||||
nurse_ids=[ns['id'] for ns in get_model("clinic.personal").search_read([['type','=','nurse']],['name'])]
|
||||
doctor_ids=[dt['id'] for dt in get_model("clinic.staff").search_read([['type','=','doctor']],['name'])]
|
||||
nurse_ids=[ns['id'] for ns in get_model("clinic.staff").search_read([['type','=','nurse']],['name'])]
|
||||
cycle_ids=[cc['id'] for cc in get_model("clinic.cycle").search_read([],['name'])]
|
||||
department_ids=[dp['id'] for dp in get_model("clinic.department").search_read([],['name'])]
|
||||
#db=get_connection()
|
||||
|
|
|
@ -12,7 +12,7 @@ class SettingLevel(Model):
|
|||
|
||||
_fields={
|
||||
"setting_id": fields.Many2One("clinic.setting","Setting"),
|
||||
"level_id": fields.Many2One("clinic.personal.level","Level",domain=[['type','=','nurse']]),
|
||||
"level_id": fields.Many2One("clinic.staff.level","Level",domain=[['type','=','nurse']]),
|
||||
'var_a': fields.Char("Ax"),
|
||||
"op": fields.Selection([["+","+"],["-","-"],["*","*"],["/","/"]],"Operation"),
|
||||
'var_b': fields.Char("B"),
|
||||
|
|
|
@ -3,9 +3,9 @@ import time
|
|||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company, get_active_user, set_active_user
|
||||
|
||||
class Personal(Model):
|
||||
_name="clinic.personal"
|
||||
_string="Personal"
|
||||
class Staff(Model):
|
||||
_name="clinic.staff"
|
||||
_string="Staff"
|
||||
_audit_log=True
|
||||
_multi_company=True
|
||||
|
||||
|
@ -54,6 +54,7 @@ class Personal(Model):
|
|||
return res
|
||||
|
||||
_fields={
|
||||
'employee_id': fields.Many2One("hr.employee","Employee"),
|
||||
"number": fields.Char("Ref.",required=True,search=True),
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
"name_eng": fields.Char("Eng Name",search=True),
|
||||
|
@ -63,7 +64,7 @@ class Personal(Model):
|
|||
"birthday": fields.Date("Birthday",search=True),
|
||||
"age": fields.Integer("Age", function="_get_age"),
|
||||
"state": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Status",search=True),
|
||||
"type": fields.Selection([['personal','Personal'],["doctor","Doctor"],["nurse","Nurse"]],"Type"),
|
||||
"type": fields.Selection([['staff','Staff'],["doctor","Doctor"],["nurse","Nurse"]],"Type"),
|
||||
"gender": fields.Selection([["male","Male"],["female","Female"]],"Gender"),
|
||||
"nation_id": fields.Many2One("clinic.nation","Nationality"),
|
||||
"mobile": fields.Char("Mobile",required=False,search=True),
|
||||
|
@ -75,7 +76,7 @@ class Personal(Model):
|
|||
"birthday": fields.Date("BirthDay",search=True),
|
||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||
"patients": fields.One2Many("clinic.patient","doctor_id","Patients"),
|
||||
"addresses": fields.One2Many("address","personal_id","Addresses"),
|
||||
"addresses": fields.One2Many("address","staff_id","Addresses"),
|
||||
"comments": fields.One2Many("message","related_id","Comments"),
|
||||
"nurse_visits": fields.One2Many("clinic.visit","nurse_id","Visits"),
|
||||
"doctor_visits": fields.One2Many("clinic.visit","doctor_id","Visits"),
|
||||
|
@ -84,8 +85,8 @@ class Personal(Model):
|
|||
"user_id": fields.Many2One("base.user","User"),
|
||||
'picture': fields.File("Picture"),
|
||||
'note': fields.Text("Note"),
|
||||
'categ_id': fields.Many2One("clinic.personal.categ", "Category"),
|
||||
'level_id': fields.Many2One("clinic.personal.level", "Personal Level", function="_get_level"),
|
||||
'categ_id': fields.Many2One("clinic.staff.categ", "Category"),
|
||||
'level_id': fields.Many2One("clinic.staff.level", "Staff Level", function="_get_level"),
|
||||
'active': fields.Boolean("Active"),
|
||||
'date': fields.Date("Register Date"),
|
||||
'base': fields.Float("Base Amount", function="_get_base",function_multi=True),
|
||||
|
@ -93,14 +94,14 @@ class Personal(Model):
|
|||
'hire_date': fields.Date("Hire Date"),
|
||||
'resign_date': fields.Date("Resign Date"),
|
||||
"documents": fields.One2Many("document","related_id","Documents"),
|
||||
"moves": fields.One2Many("clinic.personal.move","personal_id","Personal Moves"),
|
||||
"cycles": fields.One2Many("clinic.personal.cycle","personal_id","Working Cycles"),
|
||||
'cycle_id': fields.Many2One('clinic.cycle','Recent Cycle',function="_get_cycle"),
|
||||
"moves": fields.One2Many("clinic.staff.move","staff_id","Staff Movement"),
|
||||
"cycles": fields.One2Many("clinic.staff.cycle","staff_id","Working Cycles"),
|
||||
'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"),
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
while 1:
|
||||
seq_id=get_model("sequence").find_sequence(name="Clinic Personal")
|
||||
seq_id=get_model("sequence").find_sequence(name="Clinic Staff")
|
||||
if not seq_id:
|
||||
return "/"
|
||||
num=get_model("sequence").get_next_number(seq_id,context=context)
|
||||
|
@ -117,12 +118,11 @@ class Personal(Model):
|
|||
_defaults={
|
||||
'active': True,
|
||||
"state": "temporary",
|
||||
'type': 'personal',
|
||||
"personal_type": "temporary",
|
||||
'type': 'staff',
|
||||
"date": lambda *a: time.strftime("%Y-%m-%d"),
|
||||
"number": _get_number,
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
}
|
||||
_order="date desc,number desc"
|
||||
|
||||
Personal.register()
|
||||
Staff.register()
|
|
@ -1,14 +1,14 @@
|
|||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class PersonalCategory(Model):
|
||||
_name="clinic.personal.categ"
|
||||
_string="Personal Category"
|
||||
class StaffCategory(Model):
|
||||
_name="clinic.staff.categ"
|
||||
_string="Staff Category"
|
||||
|
||||
_fields={
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
"type": fields.Selection([("doctor","Doctor"),("nurse","Nurse"),('other','Other')],"Type"),
|
||||
'parent_id': fields.Many2One("clinic.personal.categ","Parent"),
|
||||
"type": fields.Selection([("doctor","Doctor"),("nurse","Nurse"),('others','Others')],"Type"),
|
||||
'parent_id': fields.Many2One("clinic.staff.categ","Parent"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
}
|
||||
|
||||
|
@ -16,4 +16,4 @@ class PersonalCategory(Model):
|
|||
"company_id": lambda *a: get_active_company(),
|
||||
}
|
||||
|
||||
PersonalCategory.register()
|
||||
StaffCategory.register()
|
|
@ -3,13 +3,13 @@ import time
|
|||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class PersonalCycle(Model):
|
||||
_name="clinic.personal.cycle"
|
||||
_string="Personal Cycle"
|
||||
class StaffCycle(Model):
|
||||
_name="clinic.staff.cycle"
|
||||
_string="Staff Cycle"
|
||||
|
||||
_fields={
|
||||
"name": fields.Char("Description",search=True),
|
||||
'personal_id': fields.Many2One("clinic.personal","Personal",required=True),
|
||||
'staff_id': fields.Many2One("clinic.staff","Staff",required=True),
|
||||
'cycle_id': fields.Many2One("clinic.cycle","Cycle",required=True),
|
||||
'date': fields.DateTime("Date"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
|
@ -20,4 +20,4 @@ class PersonalCycle(Model):
|
|||
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
}
|
||||
|
||||
PersonalCycle.register()
|
||||
StaffCycle.register()
|
|
@ -1,23 +1,21 @@
|
|||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class PersonalLevel(Model):
|
||||
_name="clinic.personal.level"
|
||||
_string="Personal Level"
|
||||
class StaffLevel(Model):
|
||||
_name="clinic.staff.level"
|
||||
_string="Staff Level"
|
||||
|
||||
_fields={
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
'formular': fields.Text("Formular"),
|
||||
'description': fields.Text("Description", search=True),
|
||||
'sequence': fields.Integer("Sequence"),
|
||||
"type": fields.Selection([('personal','Personal'),("doctor","Doctor"),("nurse","Nurse")],"Personal Type",required=True, search=True),
|
||||
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),("nurse","Nurse")],"Staff Type",required=True, search=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
'sequence': 0,
|
||||
'type': 'personal',
|
||||
'formular': '',
|
||||
'type': 'staff',
|
||||
}
|
||||
|
||||
_order="sequence"
|
||||
|
@ -29,14 +27,14 @@ class PersonalLevel(Model):
|
|||
'description': obj.description,
|
||||
'type': obj.type,
|
||||
}
|
||||
new_id=get_model("clinic.personal.level").create(vals)
|
||||
new_id=get_model("clinic.staff.level").create(vals)
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_personal_level',
|
||||
'name': 'clinic_staff_level',
|
||||
'mode': 'form',
|
||||
'active_id': new_id,
|
||||
},
|
||||
'flash': 'Copy has been succcesfully',
|
||||
}
|
||||
|
||||
PersonalLevel.register()
|
||||
StaffLevel.register()
|
|
@ -1,13 +1,13 @@
|
|||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class PersonalMove(Model):
|
||||
_name="clinic.personal.move"
|
||||
_string="Personal Move"
|
||||
class StaffMove(Model):
|
||||
_name="clinic.staff.move"
|
||||
_string="Staff Move"
|
||||
|
||||
_fields={
|
||||
"personal_id": fields.Many2One("clinic.personal","Personal (Doctor/Nurse)", search=True),
|
||||
"level_id": fields.Many2One("clinic.personal.level","Personal Level", search=True),
|
||||
"staff_id": fields.Many2One("clinic.staff","Staff", search=True),
|
||||
"level_id": fields.Many2One("clinic.staff.level","Staff Level", search=True),
|
||||
"from_company_id": fields.Many2One("company", "From", search=True),
|
||||
"to_company_id": fields.Many2One("company", "To", search=True),
|
||||
"hire_date": fields.Date("Hire Date", search=True),
|
||||
|
@ -21,4 +21,4 @@ class PersonalMove(Model):
|
|||
"company_id": lambda *a: get_active_company(),
|
||||
}
|
||||
|
||||
PersonalMove.register()
|
||||
StaffMove.register()
|
|
@ -19,10 +19,10 @@ PATIENT_TYPE={
|
|||
"others": "จ่ายเอง",
|
||||
}
|
||||
|
||||
PERSONAL_TYPE={
|
||||
STAFF_TYPE={
|
||||
'doctor': 'แพทย์',
|
||||
'nurse': 'พยาบาล',
|
||||
'personal': 'ทั่วไป',
|
||||
'staff': 'ทั่วไป',
|
||||
}
|
||||
|
||||
TOPICS={
|
||||
|
|
|
@ -31,8 +31,8 @@ class Visit(Model):
|
|||
"time_start": fields.DateTime("Time Start",required=True),
|
||||
"time_stop": fields.DateTime("Time Stop",required=True),
|
||||
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
||||
"doctor_id": fields.Many2One("clinic.personal","Doctor", domain=[['type','=','doctor']],search=True),
|
||||
"nurse_id": fields.Many2One("clinic.personal","Confirm By", domain=[['type','=','nurse']],search=True),
|
||||
"doctor_id": fields.Many2One("clinic.staff","Doctor", domain=[['type','=','doctor']],search=True),
|
||||
"nurse_id": fields.Many2One("clinic.staff","Confirm By", domain=[['type','=','nurse']],search=True),
|
||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||
"comments": fields.One2Many("message","related_id","Comments"),
|
||||
"company_id": fields.Many2One("company","Company"),
|
||||
|
@ -67,7 +67,7 @@ class Visit(Model):
|
|||
|
||||
def _get_nurse(self,context={}):
|
||||
user_id=get_active_user()
|
||||
nurse_ids=get_model("clinic.personal").search([['user_id','=',user_id],['type','=','nurse']])
|
||||
nurse_ids=get_model("clinic.staff").search([['user_id','=',user_id],['type','=','nurse']])
|
||||
if nurse_ids:
|
||||
return nurse_ids[0]
|
||||
return None
|
||||
|
@ -119,12 +119,12 @@ class Visit(Model):
|
|||
'cycle_id': obj.cycle_id.id,
|
||||
'lines':[],
|
||||
'dialyzers': [],
|
||||
'personals': [],
|
||||
'staffs': [],
|
||||
'state': 'draft',
|
||||
}
|
||||
|
||||
vals['personals'].append(('create',{
|
||||
'personal_id': obj.doctor_id.id,
|
||||
vals['staffs'].append(('create',{
|
||||
'staff_id': obj.doctor_id.id,
|
||||
'type': 'doctor',
|
||||
'priop': 'owner',
|
||||
}))
|
||||
|
@ -157,7 +157,6 @@ class Visit(Model):
|
|||
patient_type={
|
||||
"sc":"Social Security",
|
||||
"uc":"UC",
|
||||
"personal": "Personal",
|
||||
"others": "Others",
|
||||
}
|
||||
categ_name=patient_type.get(obj.patient_id.type)
|
||||
|
@ -338,7 +337,7 @@ class Visit(Model):
|
|||
hd_case.to_draft()
|
||||
for line in hd_case.lines:
|
||||
line.delete()
|
||||
for ps in hd_case.personals:
|
||||
for ps in hd_case.staffs:
|
||||
ps.delete()
|
||||
#hd_case.delete()
|
||||
obj.write({
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<td style="background-color: {{cycle_color}}">{{cycle_name}}</td>
|
||||
<td>{{no}}</td>
|
||||
<td><a href="/ui#name=clinic_patient&active_id={{patient_id}}&mode=form">{{patient_name}}</a></td>
|
||||
<td><a href="/ui#name=clinic_personal&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
|
||||
<td><a href="/ui#name=clinic_staff&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
|
||||
<td>{{patient_type}}</td>
|
||||
<td>{{currency fee_amount}}</td>
|
||||
<td>-</td>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{{parent_company_name}} {{company_name}}<br/>
|
||||
</h3>
|
||||
<h4>
|
||||
{{personal_name}}
|
||||
{{staff_name}}
|
||||
</h4>
|
||||
<h4>
|
||||
{{#if is_duration}}
|
||||
|
@ -18,7 +18,7 @@
|
|||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th>วันที่</th>
|
||||
{{#unless ../personal_name}}
|
||||
{{#unless ../staff_name}}
|
||||
<th>บุคลากร</th>
|
||||
<th>ประเภท</th>
|
||||
{{/unless}}
|
||||
|
@ -29,9 +29,9 @@
|
|||
{{#each lines}}
|
||||
<tr>
|
||||
<td>{{date}}</td>
|
||||
{{#unless ../personal_name}}
|
||||
<td>{{personal_name}}</td>
|
||||
<td>{{personal_type}}</td>
|
||||
{{#unless ../staff_name}}
|
||||
<td>{{staff_name}}</td>
|
||||
<td>{{staff_type}}</td>
|
||||
{{/unless}}
|
||||
<td style="text-align:right">{{qty}}</td>
|
||||
<td style="text-align:right">{{currency amount}}</td>
|
||||
|
@ -39,7 +39,7 @@
|
|||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{{#unless ../personal_name}}
|
||||
{{#unless ../staff_name}}
|
||||
<th></th>
|
||||
<th></th>
|
||||
{{/unless}}
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
======
|
||||
DROP TABLE clinic_cycle_dialy_line;
|
||||
drop table clinic_cycle_item_line;
|
||||
drop table clinic_cycle_item_nurse;
|
||||
drop table clinic_gen_visit cascade;
|
||||
drop table clinic_gen_visit_line;
|
||||
drop table clinic_hd_case cascade;
|
||||
drop table clinic_hd_case_dialyzer;
|
||||
drop table clinic_hd_case_line;
|
||||
drop table clinic_patient cascade;
|
||||
drop table address cascade;
|
||||
TRUNCATE clinic_dialyzer cascade;
|
||||
TRUNCATE clinic_patient_cause cascade;
|
||||
TRUNCATE clinic_patient_comorbidity cascade;
|
||||
TRUNCATE clinic_patient_morbidity cascade;
|
||||
TRUNCATE clinic_schedule_line cascade;
|
||||
TRUNCATE clinic_schedule_load_nurse_line cascade;
|
||||
TRUNCATE clinic_setting_level cascade;
|
||||
|
||||
=======
|
||||
- change personal -> stuff -> link to employee
|
||||
- add level to the list of the stuff
|
||||
|
|
Loading…
Reference in New Issue