gen visit

conv_bal
watcha.h 2014-11-01 10:48:22 +07:00
parent 156310367f
commit 63bdaff4d9
15 changed files with 150 additions and 88 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">Generate Visit</field>
<field name="view_cls">form_view</field>
<field name="model">clinic.gen.visit</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -1,5 +1,5 @@
<action> <action>
<field name="string">Treatments</field> <field name="string">HD Cases</field>
<field name="view_cls">multi_view</field> <field name="view_cls">multi_view</field>
<field name="model">clinic.hd.case</field> <field name="model">clinic.hd.case</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["In Progress",[["state","=","in_progress"]]],["Waiting Payment",[["state","=","waiting_payment"]]],["Completed",[["state","=","completed"]]],["In Completed",[["state","=","in_completed"]]]]</field> <field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["In Progress",[["state","=","in_progress"]]],["Waiting Payment",[["state","=","waiting_payment"]]],["Completed",[["state","=","completed"]]],["In Completed",[["state","=","in_completed"]]]]</field>

View File

@ -1,28 +1,46 @@
<form model="clinic.gen.visit"> <form model="clinic.gen.visit">
<group form_layout="stacked"> <group form_layout="stacked">
<field name="date_from" onchange="onchange_time" span="6"/> <field name="date_from" onchange="onchange_time" span="3"/>
<field name="date_to" onchange="onchange_dateto" span="6"/> <field name="date_to" onchange="onchange_dateto" span="3"/>
<field name="cycle_id" onchange="onchange_time" span="6"/> <field name="duration" span="3"/>
<field name="duration" span="6"/> <field name="cycle_id" onchange="onchange_time" span="3"/>
<field name="nurse_id" span="6"/> <field name="doctor_id" span="3"/>
<field name="doctor_id" span="6"/> <field name="department_id" span="3"/>
<field name="department_id" span="6"/> <field name="patient_type" span="3"/>
<field name="nurse_categ_id" span="3"/>
</group> </group>
<separator string="Select Days"/> <separator string="Select Days"/>
<field name="monday" span="4"/> <group form_layout="stacked">
<field name="tuesday" span="4"/> <field name="monday" span="3"/>
<field name="wednesday" span="4"/> <field name="tuesday" span="3"/>
<field name="thursday" span="4"/> <field name="wednesday" span="3"/>
<field name="friday" span="4"/> <field name="thursday" span="3"/>
<field name="sathurday" span="4"/> <field name="friday" span="3"/>
<field name="sunday" span="4"/> <field name="sathurday" span="3"/>
<field name="lines" nolabel="1"> <field name="sunday" span="3"/>
<list> </group>
<field name="patient_id"/> <tabs>
</list> <tab string="Patients">
</field> <group form_layout="stacked">
<field name="patient_lines" nolabel="1">
<list>
<field name="patient_id"/>
</list>
</field>
</group>
</tab>
<tab string="Nurses">
<group form_layout="stacked">
<field name="nurse_lines" nolabel="1">
<list>
<field name="nurse_id"/>
</list>
</field>
</group>
</tab>
</tabs>
<foot> <foot>
<button string="Generate" type="success" method="gen_visit"/> <button string="Generate" type="success" icon="arrow-right" method="gen_visit"/>
<button string="Clear" type="danger" icon="remove" method="clear_visit"/> <button string="Remove" type="danger" icon="remove" method="clear_visit"/>
</foot> </foot>
</form> </form>

View File

@ -56,11 +56,6 @@
</list> </list>
</field> </field>
<group span="8" form_layout="stacked" attrs='{"invisible":[["amount","=",0]]}'> <group span="8" form_layout="stacked" attrs='{"invisible":[["amount","=",0]]}'>
<!--<separator string="Make a payment"/>-->
<!--<field name="pay_amount" attrs='{"required":[["amount","!=",0]]}' onchange="onchange_pay" span="3"/>-->
<!--<field name="pay_date" span="3"/>-->
<!--<field name="pay_account_id" span="3"/>-->
<!--<button string="Pay" type="success" icon="ok" action="clinic_payment" attrs='{"invisible":[["amount","=",0]]}'/>-->
</group> </group>
<group span="4" columns="1"> <group span="4" columns="1">
<field name="total"/> <field name="total"/>
@ -83,8 +78,20 @@
</group> </group>
</tab> </tab>
<tab string="Personals"> <tab string="Personals">
<field name="doctor_id"/> <field name="personals" nolabel="1">
<field name="nurse_id"/> <list>
<field name="type"/>
<field name="personal_id" domain="[['type','=',type]]"/>
<field name="priop"/>
<field name="note"/>
</list>
</field>
<group span="9" form_layout="stacked">
</group>
<group span="3" columns="1">
<!--<field name="total_doctor"/>-->
<!--<field name="total_nurse"/>-->
</group>
</tab> </tab>
<tab string="Other Info"> <tab string="Other Info">
<group span="6" columns="1"> <group span="6" columns="1">

View File

@ -5,15 +5,11 @@
<field name="time_stop"/> <field name="time_stop"/>
<field name="patient_id"/> <field name="patient_id"/>
<field name="cycle_id"/> <field name="cycle_id"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
</search> </search>
<field name="number"/> <field name="number"/>
<field name="time_start"/> <field name="time_start"/>
<field name="time_stop"/> <field name="time_stop"/>
<field name="cycle_id"/> <field name="cycle_id"/>
<field name="patient_id"/> <field name="patient_id"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
<field name="state"/> <field name="state"/>
</list> </list>

View File

@ -20,13 +20,13 @@
<item string="Morbidities" action="clinic_morbidity"/> <item string="Morbidities" action="clinic_morbidity"/>
<item string="Nationalities" action="clinic_nation"/> <item string="Nationalities" action="clinic_nation"/>
</item> </item>
<item string="Schedules" action="clinic_schedule"/>
<item string="Cycles"> <item string="Cycles">
<item string="Cycles" action="clinic_cycle"/> <item string="Cycles" action="clinic_cycle"/>
<item string="Cycle Items" action="clinic_cycle_item"/> <item string="Cycle Items" action="clinic_cycle_item"/>
</item> </item>
<item string="Schedules" action="clinic_schedule"/>
<item string="Visits" action="clinic_visit"/> <item string="Visits" action="clinic_visit"/>
<item string="Treatments" action="clinic_hd_case"/> <item string="HD Cases" action="clinic_hd_case"/>
<item string="Reports"> <item string="Reports">
<header string="HD CASE"/> <header string="HD CASE"/>
<item string="HD Detail" action="clinic_report_hd_detail"/> <item string="HD Detail" action="clinic_report_hd_detail"/>
@ -39,6 +39,7 @@
<item string="Topics" action="clinic_translate"/> <item string="Topics" action="clinic_translate"/>
</item> </item>
<item string="Settings"> <item string="Settings">
<item string="Generate Visit" action="clinic_gen_visit_form"/>
<item string="Departments" action="clinic_department"/> <item string="Departments" action="clinic_department"/>
<item string="Clinic Settings" action="clinic_setting"/> <item string="Clinic Settings" action="clinic_setting"/>
</item> </item>

View File

@ -19,6 +19,7 @@ from . import visit_line
from . import visit_plan from . import visit_plan
from . import hd_case from . import hd_case
from . import hd_case_line from . import hd_case_line
from . import hd_case_personal
from . import hd_case_gmline from . import hd_case_gmline
from . import hd_case_discont from . import hd_case_discont
from . import hd_case_payment from . import hd_case_payment

View File

@ -23,7 +23,8 @@ class GenVisit(Model):
'date_from': fields.DateTime("From", required=True), 'date_from': fields.DateTime("From", required=True),
'date_to': fields.DateTime("To", required=True), 'date_to': fields.DateTime("To", required=True),
'cycle_id': fields.Many2One("clinic.cycle","Cycle", required=True), 'cycle_id': fields.Many2One("clinic.cycle","Cycle", required=True),
'lines': fields.One2Many("clinic.gen.visit.line","gen_id","Lines"), 'patient_lines': fields.One2Many("clinic.gen.visit.line","gen_id","Patient Lines"),
'nurse_lines': fields.One2Many("clinic.gen.visit.line","gen_id","Nurse Lines"),
'monday': fields.Boolean("Monday"), 'monday': fields.Boolean("Monday"),
'tuesday': fields.Boolean("Tuesdays"), 'tuesday': fields.Boolean("Tuesdays"),
'wednesday': fields.Boolean("Wednesdays"), 'wednesday': fields.Boolean("Wednesdays"),
@ -35,14 +36,19 @@ class GenVisit(Model):
'nurse_id': fields.Many2One("clinic.nurse","Nurse"), 'nurse_id': fields.Many2One("clinic.nurse","Nurse"),
'department_id': fields.Many2One("clinic.department","Department"), 'department_id': fields.Many2One("clinic.department","Department"),
'duration': fields.Integer("Duration (hrs)", function="_get_duration"), 'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
"patient_type": fields.Selection([("mg","Medical Government"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("others","Others")],"Patient Type"),
'nurse_categ_id': fields.Many2One("clinic.personal.categ", "Nurse Category", domain=[['type','=','nurse']]),
} }
def _get_lines(self,context={}): def _get_patient_lines(self,context={}):
ids=context.get("ids") ids=context.get("ids")
if not ids: if not ids:
ids=[context.get("refer_id")] ids=[context.get("refer_id")]
lines=[{'patient_id': id} for id in ids] lines=[]
# XXX [None]
if any(ids):
lines=[{'patient_id': id} for id in ids]
return lines return lines
def _get_nurse(self,context={}): def _get_nurse(self,context={}):
@ -60,9 +66,9 @@ class GenVisit(Model):
return cycle_id or None return cycle_id or None
_defaults={ _defaults={
'lines': _get_lines, 'patient_lines': _get_patient_lines,
'date_from': lambda *a: datetime.now().strftime(FMT_DATETIME), 'date_from': lambda *a: datetime.now().strftime(FMT_DATETIME),
'date_to': lambda *a: datetime.now().strftime(FMT_DATETIME), 'date_to': lambda *a: (datetime.now()+timedelta(days=7)).strftime(FMT_DATETIME),
'nurse_id': _get_nurse, 'nurse_id': _get_nurse,
'duration': 1, 'duration': 1,
'cycle_id': _get_cycle, 'cycle_id': _get_cycle,
@ -107,7 +113,13 @@ class GenVisit(Model):
visit_vals=[] visit_vals=[]
date_from=datetime.strptime(obj.date_from,FMT_DATETIME) date_from=datetime.strptime(obj.date_from,FMT_DATETIME)
date_to=datetime.strptime(obj.date_to,FMT_DATETIME) date_to=datetime.strptime(obj.date_to,FMT_DATETIME)
for line in obj.lines: patients=[p.patient_id.id for p in obj.patient_lines]
if not patients and obj.patient_type:
patients=get_model("clinic.patient").search([['type','=',obj.patient_type]])
else:
raise Exception("Please select some patient or patient type")
for patient_id in patients:
ntoday=1 ntoday=1
day_total=(date_to-date_from).days+ntoday day_total=(date_to-date_from).days+ntoday
for weekday in days: for weekday in days:
@ -124,7 +136,7 @@ class GenVisit(Model):
while count < day_total: while count < day_total:
tmp=start_date+timedelta(days=count) tmp=start_date+timedelta(days=count)
vals={ vals={
'patient_id': line.patient_id.id, 'patient_id': patient_id,
'doctor_id': obj.doctor_id.id, 'doctor_id': obj.doctor_id.id,
'nurse_id': obj.nurse_id.id, 'nurse_id': obj.nurse_id.id,
'department_id': obj.department_id.id, 'department_id': obj.department_id.id,
@ -139,7 +151,7 @@ class GenVisit(Model):
dom=[] dom=[]
dom.append(['time_start','>=','%s %s'%(tmp.strftime(FMT_DATE)[0:10],' 00:00:00')]) dom.append(['time_start','>=','%s %s'%(tmp.strftime(FMT_DATE)[0:10],' 00:00:00')])
dom.append(['time_stop','<=','%s %s'%(tmp.strftime(FMT_DATE)[0:10],' 23:59:59')]) dom.append(['time_stop','<=','%s %s'%(tmp.strftime(FMT_DATE)[0:10],' 23:59:59')])
dom.append(['patient_id', '=', line.patient_id.id]) dom.append(['patient_id', '=', patient_id])
dom.append(['cycle_id', '=', obj.cycle_id.id]) #XXX dom.append(['cycle_id', '=', obj.cycle_id.id]) #XXX
dom.append(['state','=','draft']) dom.append(['state','=','draft'])
vids=visit_obj.search(dom) vids=visit_obj.search(dom)
@ -151,7 +163,7 @@ class GenVisit(Model):
return { return {
'next': { 'next': {
'name': 'clinic_patient', 'name': 'clinic_visit',
'mode': 'list', 'mode': 'list',
}, },
'flash': 'Generate OK', 'flash': 'Generate OK',
@ -171,8 +183,13 @@ class GenVisit(Model):
date_from=datetime.strptime(obj.date_from,FMT_DATETIME) date_from=datetime.strptime(obj.date_from,FMT_DATETIME)
date_to=datetime.strptime(obj.date_to,FMT_DATETIME) date_to=datetime.strptime(obj.date_to,FMT_DATETIME)
visit_obj=get_model("clinic.visit") visit_obj=get_model("clinic.visit")
patients=[p.patient_id.id for p in obj.patient_lines]
if not patients and obj.patient_type:
patients=get_model("clinic.patient").search([['type','=',obj.patient_type]])
else:
raise Exception("Please select some patient or patient type")
if days: if days:
for line in obj.lines: for patient_id in patients:
# loop days in weekend # loop days in weekend
ntoday=1 ntoday=1
day_total=(date_to-date_from).days+ntoday day_total=(date_to-date_from).days+ntoday
@ -191,7 +208,6 @@ class GenVisit(Model):
tmp=start_date+timedelta(days=count) tmp=start_date+timedelta(days=count)
time_start="%s 00:00:00" % (tmp.strftime(FMT_DATE)) time_start="%s 00:00:00" % (tmp.strftime(FMT_DATE))
time_stop="%s 23:59:59" % (tmp.strftime(FMT_DATE)) time_stop="%s 23:59:59" % (tmp.strftime(FMT_DATE))
patient_id=line.patient_id.id
dom=[] dom=[]
dom.append(['time_start','>=','%s'%time_start]) dom.append(['time_start','>=','%s'%time_start])
dom.append(['time_stop','<=','%s'%time_stop]) dom.append(['time_stop','<=','%s'%time_stop])
@ -206,8 +222,7 @@ class GenVisit(Model):
else: else:
time_start=obj.date_from time_start=obj.date_from
time_stop=obj.date_to time_stop=obj.date_to
for line in obj.lines: for patient_id in patients:
patient_id=line.patient_id.id
dom=[] dom=[]
dom.append(['time_start','>=','%s'%time_start]) dom.append(['time_start','>=','%s'%time_start])
dom.append(['time_stop','<=','%s'%time_stop]) dom.append(['time_stop','<=','%s'%time_stop])
@ -221,31 +236,12 @@ class GenVisit(Model):
get_model("clinic.visit").delete(visit_ids) get_model("clinic.visit").delete(visit_ids)
return { return {
'next': { 'next': {
'name': 'clinic_patient', 'name': 'clinic_visit',
'mode': 'list', 'mode': 'list',
}, },
'flash': 'Clear OK', 'flash': 'Clear OK',
} }
def _clear_visit(self,ids,context):
obj=self.browse(ids)[0]
visit_obj=get_model("clinic.visit")
for line in obj.lines:
patient_id=line.patient_id
dom=[]
dom.append(['patient_id','=',patient_id.id])
dom.append(['state','=','draft'])
# clear
# only from to and day
visit_ids=visit_obj.search(dom)
visit_obj.delete(visit_ids)
return {
'next': {
'name': 'clinic_patient',
'mode': 'list',
},
'flash': 'Clear OK',
}
GenVisit.register() GenVisit.register()

View File

@ -7,7 +7,9 @@ class GenVisitLine(Model):
_fields={ _fields={
'gen_id': fields.Many2One("clinic.gen.visit","gen_id","Gen Visit"), 'gen_id': fields.Many2One("clinic.gen.visit","gen_id","Gen Visit"),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient"),
'nurse_id': fields.Many2One("clinic.personal","Nurse", domain=[['type','=','nurse']]),
} }
GenVisitLine.register() GenVisitLine.register()

View File

@ -8,7 +8,7 @@ from netforce.access import get_active_company
class HDCase(Model): class HDCase(Model):
_name="clinic.hd.case" _name="clinic.hd.case"
_string="Treatment" _string="HD Case"
_audit_log=True _audit_log=True
_name_field="number" _name_field="number"
_multi_company=True _multi_company=True
@ -35,7 +35,6 @@ class HDCase(Model):
"date": fields.Date("Time stop",required=True,search=True), "date": fields.Date("Time stop",required=True,search=True),
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True), "patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=False,search=True), "doctor_id": fields.Many2One("clinic.doctor","Doctor", required=False,search=True),
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,search=True),
"department_id": fields.Many2One("clinic.department", "Department",search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True),
"wh_start": fields.Float("Wt.Kg start"), "wh_start": fields.Float("Wt.Kg start"),
"wh_stop": fields.Float("Wt.Kg stop"), "wh_stop": fields.Float("Wt.Kg stop"),
@ -52,6 +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), "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.dialyzer.line","hd_case_id","Dialyzers"), "dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"),
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"), "lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
"personals": fields.One2Many("clinic.hd.case.personal","hd_case_id","Personals"),
"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"),
"amount": fields.Float("Due Amount",function="get_total",readonly=True,function_multi=True), "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), "total": fields.Float("Total",function="get_total",readonly=True,function_multi=True),
@ -73,6 +73,8 @@ class HDCase(Model):
'pay_account_id': fields.Many2One("account.account","Account"), 'pay_account_id': fields.Many2One("account.account","Account"),
'payment_id': fields.Many2One("account.payment","Payment"), # for print 'payment_id': fields.Many2One("account.payment","Payment"), # for print
'dlz_id': fields.Many2One("clinic.dialyzer","Dialyzer"), # for link '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),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -89,20 +91,11 @@ class HDCase(Model):
return num return num
get_model("sequence").increment_number(seq_id,context=context) get_model("sequence").increment_number(seq_id,context=context)
def _get_nurse(self,context={}):
user_id=get_active_user()
print("user_id ",user_id)
nurse_ids=get_model("clinic.nurse").search([['user_id','=',user_id]])
if nurse_ids:
return nurse_ids[0]
return None
_defaults={ _defaults={
"state": "draft", "state": "draft",
"date": lambda *a: time.strftime("%Y-%m-%d"), "date": lambda *a: time.strftime("%Y-%m-%d"),
"time_start": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"), "time_start": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
"time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"), "time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
'nurse_id': _get_nurse,
"number": _get_number, "number": _get_number,
"company_id": lambda *a: get_active_company(), "company_id": lambda *a: get_active_company(),
'hct': 0, 'hct': 0,
@ -142,14 +135,13 @@ class HDCase(Model):
data=context['data'] data=context['data']
patient_id=data['patient_id'] patient_id=data['patient_id']
hd_cases=self.search_browse([['patient_id','=',patient_id]]) hd_cases=self.search_browse([['patient_id','=',patient_id]])
# TODO reset dialyzer
if hd_cases: if hd_cases:
hd_case=hd_cases[-1] hd_case=hd_cases[-1]
data['doctor_id']=hd_case.doctor_id.id
data['department_id']=hd_case.department_id.id data['department_id']=hd_case.department_id.id
else: else:
data['doctor_id']=None
data['department_id']=None data['department_id']=None
#XXX
data['dialyzers']=[]
return data return data
@ -687,5 +679,22 @@ class HDCase(Model):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
context['state']='draft' context['state']='draft'
obj.undo(context=context) obj.undo(context=context)
def get_personal(self,ids,context={}):
res={}
for obj in self.browse(ids):
doctor=0
nurse=0
for personal in obj.personals:
if personal.type=="doctor":
doctor+= 1
else:
nurse+=1
res[obj.id]={
'total_doctor': doctor,
'total_nurse': nurse,
}
return res
HDCase.register() HDCase.register()

View File

@ -0,0 +1,19 @@
from netforce.model import Model, fields
class HdCasePersonal(Model):
_name="clinic.hd.case.personal"
_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),
"priop": fields.Selection([("owner","Owner"),('other','Other')],"Priority"),
'note': fields.Char("Note"),
}
_defaults={
'type': 'nurse',
'priop': 'other',
}
HdCasePersonal.register()

View File

@ -31,7 +31,7 @@ class Patient(Model):
_fields={ _fields={
"type": fields.Selection([("mg","Medical Government"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("others","Others")],"Patient Type",required=True), "type": fields.Selection([("mg","Medical Government"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("others","Others")],"Patient Type",required=True),
"number": fields.Char("Patient No.",required=True,search=True), "number": fields.Char("Patient No.",required=True,search=True),
"hn": fields.Char("HN",search=True), "hn": fields.Char("REF/HN",search=True),
"name": fields.Char("Name",required=True,search=True), "name": fields.Char("Name",required=True,search=True),
"reg_date": fields.Date("Register Date",required=False,search=True), "reg_date": fields.Date("Register Date",required=False,search=True),
"birthday": fields.Date("Birthday",required=False,search=True), "birthday": fields.Date("Birthday",required=False,search=True),

View File

@ -27,7 +27,7 @@ class Personal(Model):
"expiry_card" : fields.Date("Card Expiry"), "expiry_card" : fields.Date("Card Expiry"),
"birthday": fields.Date("Birthday",search=True), "birthday": fields.Date("Birthday",search=True),
"age": fields.Integer("Age", function="_get_age"), "age": fields.Integer("Age", function="_get_age"),
"state": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Status"), "state": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Status",search=True),
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["other","Other"]],"Type"), "type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["other","Other"]],"Type"),
"mobile": fields.Char("Mobile",required=False,search=True), "mobile": fields.Char("Mobile",required=False,search=True),
"phone": fields.Char("Phone",search=True), "phone": fields.Char("Phone",search=True),

View File

@ -24,6 +24,12 @@ class Visit(Model):
for obj in self.browse(ids): for obj in self.browse(ids):
res[obj.id]=datetime.now().strftime("%Y-%m-%d %H:%M:%S") res[obj.id]=datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return res return res
def _get_color(self,ids,context={}):
res={}
for obj in self.browse(ids):
res[obj.id]='red'
return res
_fields={ _fields={
"number": fields.Char("Number",required=True,search=True), "number": fields.Char("Number",required=True,search=True),
@ -41,6 +47,7 @@ class Visit(Model):
"comments": fields.One2Many("message","related_id","Comments"), "comments": fields.One2Many("message","related_id","Comments"),
'visit_date': fields.Date('Visit Date',function="_get_visit_date"), 'visit_date': fields.Date('Visit Date',function="_get_visit_date"),
'print_date': fields.Date('Print Date',function="_get_print_date"), 'print_date': fields.Date('Print Date',function="_get_print_date"),
'cycle_color': fields.Char("Cycle Color", function="_get_color"), # FIXME
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -104,8 +111,6 @@ class Visit(Model):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
vals={ vals={
'patient_id': obj.patient_id.id, 'patient_id': obj.patient_id.id,
'doctor_id': obj.doctor_id.id,
'nurse_id': obj.nurse_id.id,
'department_id': obj.department_id.id, 'department_id': obj.department_id.id,
'time_start': obj.time_start, 'time_start': obj.time_start,
'time_stop': obj.time_stop, 'time_stop': obj.time_stop,
@ -114,11 +119,10 @@ class Visit(Model):
'cycle_id': obj.cycle_id.id, 'cycle_id': obj.cycle_id.id,
'lines':[], 'lines':[],
'dialyzers': [], 'dialyzers': [],
'personals': [],
'state': 'draft', 'state': 'draft',
} }
# search dialyzer and count automatically
# search Nurse with category
products=get_model("product").search_browse([['code','=','FEE']]) products=get_model("product").search_browse([['code','=','FEE']])
for product in products: for product in products:
vals['lines'].append(('create',{ vals['lines'].append(('create',{

View File

@ -1,3 +1,6 @@
after finish hd case -> show popup to check nurse and doctor after finish
formalar formalar
tick: tick:
find all -> replace -> multiple x find all -> replace -> multiple x