improvement

conv_bal
watcha.h 2015-03-02 11:03:07 +07:00
parent 16461ae34d
commit b9ba5c9f17
31 changed files with 75 additions and 88 deletions

View File

@ -2,7 +2,12 @@
<field name="string">Patients</field> <field name="string">Patients</field>
<field name="view_cls">multi_view</field> <field name="view_cls">multi_view</field>
<field name="model">clinic.patient</field> <field name="model">clinic.patient</field>
<field name="tabs">[["All",[]],["Archived",[["active","=","False"]]]]</field> <field name="tabs">[
["All",[]],
["Archived",[["active","=","False"]]],
["Admit",[["state","=","admit"]]],
["Dispose",[["state","=","dispose"]]]]
</field>
<field name="menu">clinic_menu</field> <field name="menu">clinic_menu</field>
<field name="limit">25</field> <field name="limit">25</field>
</action> </action>

View File

@ -20,7 +20,7 @@
<field name="branch_id" required="1"/> <field name="branch_id" required="1"/>
<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/> <field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/>
<tabs> <tabs>
<tab string="General Information"> <tab string="General">
<group span="6" columns="1"> <group span="6" columns="1">
<field name="gender"/> <field name="gender"/>
<field name="marital_status"/> <field name="marital_status"/>
@ -77,14 +77,10 @@
<field name="partner_id" domain='[["is_patient","=","true"]]'/> <field name="partner_id" domain='[["is_patient","=","true"]]'/>
</tab> </tab>
<tab string="Other"> <tab string="Other">
<group form_layout="stacked"> <field name="state"/>
<field name="active" span="2"/> <field name="resign_date" attrs='{"required":[["state","=","resign"]]}'/>
<field name="rm_remain_visit" span="2" attrs='{"invisible":[["active","=","true"]]}'/> <field name="hn_no"/>
<field name="resign_date" span="2"/> <field name="note" attrs='{"required":[["state","=","resign"]]}'/>
<field name="hn_no" span="2"/>
<newline/>
<field name="note"/>
</group>
</tab> </tab>
</tabs> </tabs>
<related> <related>

View File

@ -1,4 +1,4 @@
<list model="clinic.patient"> <list model="clinic.patient" colors='{"#cfc":[["state","=","confirmed"]],"#dbdbdb":[["state","=","dispose"]]}'>
<!-- <!--
<head> <head>
<button string="Generate Visit" action="clinic_gen_visit" type="success"/> <button string="Generate Visit" action="clinic_gen_visit" type="success"/>
@ -13,5 +13,6 @@
<field name="branch_id"/> <field name="branch_id"/>
<field name="department_id"/> <field name="department_id"/>
<field name="doctor_id"/> <field name="doctor_id"/>
<field name="state"/>
<!--<field name="image" preview='1'/>--> <!--<field name="image" preview='1'/>-->
</list> </list>

View File

@ -3,7 +3,7 @@
<field name="date_from" required="1" span="2"/> <field name="date_from" required="1" span="2"/>
<field name="date_to" required="1" span="2"/> <field name="date_to" required="1" span="2"/>
<field name="staff_type" onchange="onchange_type" span="2"/> <field name="staff_type" onchange="onchange_type" span="2"/>
<field name="staff_id" domain='[["type","=",type]]' span="2"/> <field name="staff_id" domain='[["type","=",staff_type]]' span="2"/>
<field name="categ_id" span="2"/> <field name="categ_id" span="2"/>
<field name="level_id" span="2"/> <field name="level_id" span="2"/>
<field name="only_value" span="2"/> <field name="only_value" span="2"/>

View File

@ -5,7 +5,7 @@ class Address(Model):
_inherit="address" _inherit="address"
_fields={ _fields={
"patient_id": fields.Many2One("clinic.patient","Patient"), "patient_id": fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
"staff_id": fields.Many2One("clinic.staff","Staff"), "staff_id": fields.Many2One("clinic.staff","Staff"),
} }

View File

@ -25,7 +25,7 @@ class Dialyzer(Model):
"company_id": fields.Many2One("company","Company"), "company_id": fields.Many2One("company","Company"),
'product_id': fields.Many2One("product", "Product",required=True,search=True), 'product_id': fields.Many2One("product", "Product",required=True,search=True),
"pickings": fields.One2Many("stock.picking","related_id","Pickings"), "pickings": fields.One2Many("stock.picking","related_id","Pickings"),
"patient_id": fields.Many2One("clinic.patient","Patient",search=True), "patient_id": fields.Many2One("clinic.patient","Patient",search=True,domain=[['state','=','admit']]),
"visit_id": fields.Many2One("clinic.visit","Visit",search=True), "visit_id": fields.Many2One("clinic.visit","Visit",search=True),
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",search=True), "hd_case_id": fields.Many2One("clinic.hd.case","HD Case",search=True),
"hd_cases": fields.One2Many("clinic.hd.case","dlz_id","HD Case"), #TODO funtion to get hd case "hd_cases": fields.One2Many("clinic.hd.case","dlz_id","HD Case"), #TODO funtion to get hd case

View File

@ -96,7 +96,7 @@ class HDCase(Model):
"time_start": fields.DateTime("Start Time",required=True), "time_start": fields.DateTime("Start Time",required=True),
"time_stop": fields.DateTime("Finish Time",required=True), "time_stop": fields.DateTime("Finish Time",required=True),
"date": fields.Date("Date",required=True,search=True), "date": fields.Date("Date",required=True,search=True),
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True), "patient_id": fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']],required=True,search=True),
"patient_type_id": fields.Many2One("clinic.patient.type", "Type"), "patient_type_id": fields.Many2One("clinic.patient.type", "Type"),
"nurse_id": fields.Many2One("clinic.staff","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), "department_id": fields.Many2One("clinic.department", "Department",search=True),
@ -753,6 +753,7 @@ class HDCase(Model):
return True return True
def do_expense(self,ids,context={}): def do_expense(self,ids,context={}):
# not longer use 2015-02-28
for obj in self.browse(ids): for obj in self.browse(ids):
# clear old expense # clear old expense
for exp in obj.expenes: for exp in obj.expenes:
@ -794,7 +795,7 @@ class HDCase(Model):
obj.make_invoices(context=context) obj.make_invoices(context=context)
obj.post_invoices(context=context) obj.post_invoices(context=context)
obj.create_cycle_item() obj.create_cycle_item()
obj.do_expense(context=context) #obj.do_expense(context=context)
vals={ vals={
"state":"waiting_payment", # for government "state":"waiting_payment", # for government
} }

View File

@ -30,7 +30,7 @@ class HDCaseExpense(Model):
_fields={ _fields={
'name': fields.Char("Name", function="_get_store",store=True), 'name': fields.Char("Name", function="_get_store",store=True),
'date': fields.Date("Date",required=True,search=True), 'date': fields.Date("Date",required=True,search=True),
'patient_id': fields.Many2One("clinic.patient","Patient",required=True,search=True), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']], required=True,search=True),
'hd_case_id': fields.Many2One("clinic.hd.case","HD Case",required=True,search=True), 'hd_case_id': fields.Many2One("clinic.hd.case","HD Case",required=True,search=True),
'payment_id': fields.Many2One("account.payment","Payment",search=True), 'payment_id': fields.Many2One("account.payment","Payment",search=True),
"invoices": fields.One2Many("account.invoice","clinic_expense_id","Invoices"), "invoices": fields.One2Many("account.invoice","clinic_expense_id","Invoices"),

View File

@ -27,7 +27,7 @@ class HDCaseStaff(Model):
"priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"), "priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"),
'note': fields.Char("Note"), 'note': fields.Char("Note"),
'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True), 'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True),
'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']], function="_get_all",function_multi=True),
'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type",function="_get_all",function_multi=True), 'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type",function="_get_all",function_multi=True),
'cycle_id': fields.Many2One("clinic.cycle","Cycle",function="_get_all",function_multi=True), 'cycle_id': fields.Many2One("clinic.cycle","Cycle",function="_get_all",function_multi=True),
'department_id': fields.Many2One("clinic.department","Department",function="_get_all",function_multi=True), 'department_id': fields.Many2One("clinic.department","Department",function="_get_all",function_multi=True),

View File

@ -9,7 +9,7 @@ class PaymentLine(Model):
'date': fields.Date("Date"), 'date': fields.Date("Date"),
'ref': fields.Char("Ref"), 'ref': fields.Char("Ref"),
'invoice_id': fields.Many2One("account.invoice","Invoice"), 'invoice_id': fields.Many2One("account.invoice","Invoice"),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
'hd_case_id': fields.Many2One("clinic.hd.case","HDCase"), 'hd_case_id': fields.Many2One("clinic.hd.case","HDCase"),
'state': fields.Selection([['match','Match'],['unmatch','Unmatch']],"State"), 'state': fields.Selection([['match','Match'],['unmatch','Unmatch']],"State"),
'amount': fields.Float("Amount"), 'amount': fields.Float("Amount"),

View File

@ -42,6 +42,7 @@ class MakeAPT(Model):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
pts={} pts={}
dom=[] dom=[]
dom.append(['patient_id.state','=','admit'])
if obj.department_id: if obj.department_id:
dom.append(['department_id','=',obj.department_id.id]) dom.append(['department_id','=',obj.department_id.id])
if obj.cycle_id: if obj.cycle_id:
@ -76,6 +77,8 @@ class MakeAPT(Model):
patient=pc.patient_id patient=pc.patient_id
dpt=pc.department_id dpt=pc.department_id
branch=dpt.branch_id branch=dpt.branch_id
if not branch:
continue
if branch_id and branch_id!=branch.id: if branch_id and branch_id!=branch.id:
continue continue
key=(patient.id,dpt.id) key=(patient.id,dpt.id)
@ -131,7 +134,7 @@ class MakeAPT(Model):
'mode': 'form', 'mode': 'form',
'active_id': obj.id, 'active_id': obj.id,
}, },
'flash': 'Ready to generate', #'flash': 'Ready to generate', #remove this message because user confuse
} }
def gen(self,ids,context={}): def gen(self,ids,context={}):

View File

@ -6,7 +6,7 @@ class MakeAPTLine(Model):
_fields={ _fields={
'apt_id': fields.Many2One("clinic.make.apt","APT", required=True,on_delete="cascade"), 'apt_id': fields.Many2One("clinic.make.apt","APT", required=True,on_delete="cascade"),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
'mon_cycle_id': fields.Many2One("clinic.cycle","Monday"), 'mon_cycle_id': fields.Many2One("clinic.cycle","Monday"),
'tue_cycle_id': fields.Many2One("clinic.cycle","Tuesday"), 'tue_cycle_id': fields.Many2One("clinic.cycle","Tuesday"),
'wed_cycle_id': fields.Many2One("clinic.cycle","Wednesday"), 'wed_cycle_id': fields.Many2One("clinic.cycle","Wednesday"),

View File

@ -118,7 +118,7 @@ class Patient(Model):
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"), "hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
"partner_id": fields.Many2One("partner","Contact"), "partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"), "dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
"active":fields.Boolean("Uncheck as discountinue", search=True), "active":fields.Boolean("Active", search=True),
'note': fields.Text("Note"), 'note': fields.Text("Note"),
'categ_id': fields.Many2One("clinic.patient.categ","Category"), 'categ_id': fields.Many2One("clinic.patient.categ","Category"),
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
@ -130,6 +130,7 @@ class Patient(Model):
'branch_id': fields.Many2One("clinic.branch","Branch",search=True), 'branch_id': fields.Many2One("clinic.branch","Branch",search=True),
'cycles': fields.One2Many("clinic.patient.cycle","patient_id", "Cycles"), 'cycles': fields.One2Many("clinic.patient.cycle","patient_id", "Cycles"),
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."), "vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -176,12 +177,24 @@ class Patient(Model):
'card_type': 'identification', 'card_type': 'identification',
'type_id': _get_type, 'type_id': _get_type,
"active" : True, "active" : True,
'state': 'admit',
} }
_sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"), _sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"),
_order="resign_date desc,number desc" _order="number desc"
def check_idcard(self,idcard=''):
res=True
if idcard.isalpha():
res=False
elif len(idcard)!=13:
res=False
if not res:
raise Exception("Wrong ID Card!")
def create(self, vals,**kw): def create(self, vals,**kw):
if 'card_no' in vals.keys():
self.check_idcard(vals['card_no'])
obj_id=super().create(vals,**kw) obj_id=super().create(vals,**kw)
self.function_store([obj_id]) self.function_store([obj_id])
obj=self.browse(obj_id) obj=self.browse(obj_id)
@ -229,7 +242,8 @@ class Patient(Model):
super().delete(ids) super().delete(ids)
def write(self,ids,vals,**kw): def write(self,ids,vals,**kw):
#TODO change department of patient after change department if 'card_no' in vals.keys():
self.check_idcard(vals['card_no'])
ctx={} ctx={}
if 'active' in vals.keys(): if 'active' in vals.keys():
if not vals['active']: if not vals['active']:
@ -243,6 +257,9 @@ class Patient(Model):
for visit in get_model('clinic.visit').browse(vids): for visit in get_model('clinic.visit').browse(vids):
visit.write(visit_vals) visit.write(visit_vals)
for obj in self.browse(ids): for obj in self.browse(ids):
if obj.state=='treatment':
vals['note']=''
vals['resign_date']=None
visit_vals={} visit_vals={}
if 'department_id' in vals.keys(): if 'department_id' in vals.keys():
visit_vals.update({ visit_vals.update({
@ -376,4 +393,5 @@ class Patient(Model):
},'flash': 'New Dialyzer successfully', },'flash': 'New Dialyzer successfully',
} }
Patient.register() Patient.register()

View File

@ -6,7 +6,7 @@ class PatientCause(Model):
_name="clinic.patient.cause" _name="clinic.patient.cause"
_string="Patient Cause" _string="Patient Cause"
_fields={ _fields={
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"), "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade",domain=[['state','=','admit']]),
"cause_id": fields.Many2One("clinic.cause.chronic","Cause"), "cause_id": fields.Many2One("clinic.cause.chronic","Cause"),
"date_cause": fields.Date("Date Cause"), "date_cause": fields.Date("Date Cause"),
} }

View File

@ -1,12 +1,10 @@
import time
from netforce.model import Model, fields from netforce.model import Model, fields
class PatientComorbidity(Model): class PatientComorbidity(Model):
_name="clinic.patient.comorbidity" _name="clinic.patient.comorbidity"
_string="Patient Patient Comorbidity" _string="Patient Patient Comorbidity"
_fields={ _fields={
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"), "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade",domain=[['state','=','admit']]),
"comorbility_id": fields.Many2One("clinic.comorbidity","Comorbidity"), "comorbility_id": fields.Many2One("clinic.comorbidity","Comorbidity"),
"ans": fields.Selection([['yes','Yes'],['no','No']], "Answer"), "ans": fields.Selection([['yes','Yes'],['no','No']], "Answer"),
"analysis_date": fields.Date("Analysis Date"), "analysis_date": fields.Date("Analysis Date"),

View File

@ -5,7 +5,7 @@ class PatientCycle(Model):
_string="Patient Cycle" _string="Patient Cycle"
_fields={ _fields={
"patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True), "patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True,domain=[['state','=','admit']]),
"cycle_id": fields.Many2One('clinic.cycle',"Cycle",search=True), "cycle_id": fields.Many2One('clinic.cycle',"Cycle",search=True),
"department_id": fields.Many2One('clinic.department',"Department",search=True), "department_id": fields.Many2One('clinic.department',"Department",search=True),
'day': fields.Selection([('mon', 'Monday'), ('tue','Tuesday'), ('wed','Wednesday'),('thu','Thursday'),('fri','Friday'),('sat','Saturday'),('sun','Sunday')], 'Day',search=True), 'day': fields.Selection([('mon', 'Monday'), ('tue','Tuesday'), ('wed','Wednesday'),('thu','Thursday'),('fri','Friday'),('sat','Saturday'),('sun','Sunday')], 'Day',search=True),

View File

@ -4,7 +4,7 @@ class PatientMorbidity(Model):
_name="clinic.patient.morbidity" _name="clinic.patient.morbidity"
_string="Patient Patient Morbidity" _string="Patient Patient Morbidity"
_fields={ _fields={
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"), "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade",domain=[['state','=','admit']]),
"morbility_id": fields.Many2One("clinic.morbidity","Morbidity"), "morbility_id": fields.Many2One("clinic.morbidity","Morbidity"),
"ans": fields.Selection([['yes','Yes'],['no','No']], "Answer"), "ans": fields.Selection([['yes','Yes'],['no','No']], "Answer"),
"analysis_date": fields.Date("Analysis Date"), "analysis_date": fields.Date("Analysis Date"),

View File

@ -15,7 +15,7 @@ class ReportHDCaseDetail(Model):
"date_from": fields.Date("From", required=True), "date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
'patient_type_id': fields.Many2One("clinic.patient.type","Payers"), 'patient_type_id': fields.Many2One("clinic.patient.type","Payers"),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
'branch_id': fields.Many2One("clinic.branch","Branch"), 'branch_id': fields.Many2One("clinic.branch","Branch"),
'department_id': fields.Many2One("clinic.department","Department"), 'department_id': fields.Many2One("clinic.department","Department"),
} }

View File

@ -68,7 +68,6 @@ class ReportLaborCostSummary(Model):
only_value=obj.only_value only_value=obj.only_value
dom.append(['date','>=',date_from]) dom.append(['date','>=',date_from])
dom.append(['date','<=',date_to]) dom.append(['date','<=',date_to])
print("staff_type ", staff_type)
if staff_id: if staff_id:
dom.append(['staff_id','=',staff_id]) dom.append(['staff_id','=',staff_id])
if staff_type: if staff_type:
@ -88,7 +87,6 @@ class ReportLaborCostSummary(Model):
categ_id=None categ_id=None
categ=staff.categ_id categ=staff.categ_id
level_name='' level_name=''
#XXX fix
if not staff: if not staff:
continue continue
if level_id and staff.level_id.id!=level_id: if level_id and staff.level_id.id!=level_id:
@ -180,7 +178,7 @@ class ReportLaborCostSummary(Model):
'dpts': dpts, 'dpts': dpts,
'comp_name': comp.name or 0, 'comp_name': comp.name or 0,
'comp_span': len(dpts), 'comp_span': len(dpts),
'lines': lines, 'lines': sorted(lines, key=lambda x: x['number']),
'total_lines': total_lines, 'total_lines': total_lines,
} }
return data return data

View File

@ -24,7 +24,7 @@ class ReportPaymentMatching(Model):
"date_from": fields.Date("From", required=True), "date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
'state': fields.Selection([['draft','Draft'],['waiting_matching','Waiting Matching'],['match','Match'],['unmatch','Unmatch'],['approved','Approved']],'State'), 'state': fields.Selection([['draft','Draft'],['waiting_matching','Waiting Matching'],['match','Match'],['unmatch','Unmatch'],['approved','Approved']],'State'),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
'file': fields.File("File"), 'file': fields.File("File"),
'type_id': fields.Many2One("clinic.patient.type","Patient Type",required=True), 'type_id': fields.Many2One("clinic.patient.type","Patient Type",required=True),
'hcode_id': fields.Many2One("clinic.hospital","HCode",required=True), 'hcode_id': fields.Many2One("clinic.hospital","HCode",required=True),

View File

@ -17,7 +17,7 @@ class ReportStaffLine(Model):
'report_staff_id': fields.Many2One("clinic.report.staff","Report Staff", required=True, on_delete="cascade"), 'report_staff_id': fields.Many2One("clinic.report.staff","Report Staff", required=True, on_delete="cascade"),
'hd_case_id': fields.Many2One("clinic.hd.case","HD Case"), 'hd_case_id': fields.Many2One("clinic.hd.case","HD Case"),
'date': fields.Date("Date",function="_get_all", function_multi=True), 'date': fields.Date("Date",function="_get_all", function_multi=True),
'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True), 'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True,domain=[['state','=','admit']]),
'amount': fields.Float("Amount"), 'amount': fields.Float("Amount"),
} }

View File

@ -6,7 +6,7 @@ class ReportStaffPatient(Model):
_fields={ _fields={
'report_staff_id': fields.Many2One("clinic.report.staff","Report Staff", required=True, on_delete="cascade"), 'report_staff_id': fields.Many2One("clinic.report.staff","Report Staff", required=True, on_delete="cascade"),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
'date': fields.Date("Date"), 'date': fields.Date("Date"),
'amount': fields.Float("Amount"), 'amount': fields.Float("Amount"),
} }

View File

@ -15,7 +15,7 @@ class ReportVisit(Model):
"date": fields.Date("Month"), "date": fields.Date("Month"),
"date_from": fields.Date("From", required=True), "date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
"patient_id": fields.Many2One("clinic.patient","Patient"), "patient_id": fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
"doctor_id": fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]), "doctor_id": fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
"state": fields.Selection([["draft","Draft"],['pending','Pending'],["confirmed","Confirmed"],["cancelled","Cancelled"]],"Status",required=True), "state": fields.Selection([["draft","Draft"],['pending','Pending'],["confirmed","Confirmed"],["cancelled","Cancelled"]],"Status",required=True),
} }

View File

@ -110,6 +110,12 @@ class ClinicSetting(Model):
if user_id !=1: if user_id !=1:
print("Only admin!!") print("Only admin!!")
return return
for pt in get_model("clinic.patient").search_browse([]):
pt.write({
'state': 'admit',
})
print("Done!")
return
for citem in get_model("clinic.cycle.item").search_browse([]): for citem in get_model("clinic.cycle.item").search_browse([]):
for line in citem.lines: for line in citem.lines:
nurse=line.nurse_id nurse=line.nurse_id

View File

@ -30,7 +30,7 @@ class Shop(Model):
"number": fields.Char("Number",required=True,search=True), "number": fields.Char("Number",required=True,search=True),
"ref": fields.Char("Ref",search=True), "ref": fields.Char("Ref",search=True),
'date': fields.Date("Date",search=True), 'date': fields.Date("Date",search=True),
'patient_id': fields.Many2One('clinic.patient','Patient',search=True), 'patient_id': fields.Many2One('clinic.patient','Patient',search=True,domain=[['state','=','admit']]),
'contact_id': fields.Many2One('partner','Contact',search=True), 'contact_id': fields.Many2One('partner','Contact',search=True),
'department_id': fields.Many2One("clinic.department","Department",search=True), 'department_id': fields.Many2One("clinic.department","Department",search=True),
'branch_id': fields.Many2One("clinic.branch","Branch",search=True), 'branch_id': fields.Many2One("clinic.branch","Branch",search=True),

View File

@ -30,7 +30,7 @@ class SickBed(Model):
"available": fields.Boolean("Available"), "available": fields.Boolean("Available"),
'hd_cases': fields.One2Many("clinic.hd.case",'sickbed_id','HDCases'), 'hd_cases': fields.One2Many("clinic.hd.case",'sickbed_id','HDCases'),
'company_id': fields.Many2One("company","Company"), 'company_id': fields.Many2One("company","Company"),
'patient_id': fields.Many2One("clinic.patient","Lasted Patient",function="_get_all",function_multi=True), 'patient_id': fields.Many2One("clinic.patient","Lasted Patient",function="_get_all",function_multi=True,domain=[['state','=','admit']]),
'image': fields.File("Image",function="_get_all",function_multi=True), 'image': fields.File("Image",function="_get_all",function_multi=True),
'date': fields.Date("Lasted Date",function="_get_all",function_multi=True), 'date': fields.Date("Lasted Date",function="_get_all",function_multi=True),
"state": fields.Selection([("available","Available"),("not_available","Not Available")],"Status"), "state": fields.Selection([("available","Available"),("not_available","Not Available")],"Status"),

View File

@ -295,13 +295,10 @@ class Staff(Model):
def name_get(self,ids,context={}): def name_get(self,ids,context={}):
vals=[] vals=[]
for obj in self.browse(ids): for obj in self.browse(ids):
level=obj.level_id
name=obj.name or "" name=obj.name or ""
nickname=obj.nick_name or "" nickname=obj.nick_name or ""
if level: if nickname:
if nickname: name+=" (%s)"%(nickname)
name+=" (%s)"%(nickname)
name+=" - %s"%(level.name or "")
vals.append((obj.id,name)) vals.append((obj.id,name))
return vals return vals
@ -310,21 +307,11 @@ class Staff(Model):
if domain: if domain:
dom=[dom,domain] dom=[dom,domain]
ids1=self.search(dom) ids1=self.search(dom)
dom=[["name","ilike","%"+name+"%"]]
level_ids=get_model('clinic.staff.level').search(dom)
ids2=[]
for x in self.search_read([domain],['level_id']):
if x['level_id']:
level_id=x['level_id'][0]
if level_id in level_ids:
ids2.append(x['id'])
dom=[["nick_name","ilike","%"+name+"%"]] dom=[["nick_name","ilike","%"+name+"%"]]
if domain: if domain:
dom=[dom,domain] dom=[dom,domain]
ids3=self.search(dom) ids2=self.search(dom)
ids=list(set(ids1+ids2))
ids=list(set(ids1+ids2+ids3))
return self.name_get(ids,context=context) return self.name_get(ids,context=context)
Staff.register() Staff.register()

View File

@ -34,7 +34,7 @@ class Visit(Model):
"number": fields.Char("Number",required=True,search=True), "number": fields.Char("Number",required=True,search=True),
"time_start": fields.DateTime("Start Time",required=True), "time_start": fields.DateTime("Start Time",required=True),
"time_stop": fields.DateTime("End Time",required=True), "time_stop": fields.DateTime("End Time",required=True),
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True), "patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True,domain=[['state','=','admit']]),
"doctor_id": fields.Many2One("clinic.staff","Doctor", domain=[['type','=','doctor']],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), "nurse_id": fields.Many2One("clinic.staff","Confirm By", domain=[['type','=','nurse']],search=True),
"department_id": fields.Many2One("clinic.department", "Department",search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True),

View File

@ -30,7 +30,7 @@ class VisitBoard(Model):
"date": fields.Date("Month", required=False), "date": fields.Date("Month", required=False),
"date_from": fields.Date("From", required=True), "date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
'cycle_id': fields.Many2One("clinic.cycle","Cycle"), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[["type","=","doctor"]]), 'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[["type","=","doctor"]]),
'department_id': fields.Many2One("clinic.department","Department"), 'department_id': fields.Many2One("clinic.department","Department"),

View File

@ -6,7 +6,7 @@ class VisitPopupConfirmLine(Model):
_fields={ _fields={
"popup_visit_id": fields.Many2One("clinic.popup.visit.confirm","Popup Board",required=True,on_delete="cascade"), "popup_visit_id": fields.Many2One("clinic.popup.visit.confirm","Popup Board",required=True,on_delete="cascade"),
'patient_id': fields.Many2One("clinic.patient","Patient"), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']]),
'department_id': fields.Many2One("clinic.department","Department"), 'department_id': fields.Many2One("clinic.department","Department"),
'cycle_id': fields.Many2One("clinic.cycle","Cycle"), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
'visit_id': fields.Many2One("clinic.visit","Visit"), 'visit_id': fields.Many2One("clinic.visit","Visit"),

View File

@ -1,4 +1,6 @@
todo: todo:
- set patient_id with domain state=='treatment'
- compute labor cost - compute labor cost
- update level - update level
@ -15,33 +17,5 @@ todo:
create contact from staff -> ok create contact from staff -> ok
script to clear invoice -> ok script to clear invoice -> ok
requirement:
1.1 Profile STAFF ยังไม่สามารถ กำหนดให้ 1คน มี profile ได้หลาย Department (ตามเมล์ date: Mon, Feb 23, 2015 at 3:15 PM ที่คุณพอลลี่แจ้งมา อยู่ระหว่างกำลังแก้ไข)
1.2 HD Cases ยังพบ bug ในส่วน Expense EPO ที่เบิกได้ตามสิทธิ์ของผู้ป่วย เลือก Product แล้วราคาไม่แสดง
-> config on product price list and retest it again
1.3 HD Cases ในส่วน Expense ที่ถูกต้อง เมื่อเลือก Product แล้ว Product นั้นต้องสัมพันธ์กับสถานะ Reimbursable (เช่น Category: EPO Product: [61006-SSO] EPIAO-SSO Reimbursable ต้องเป็น Yes ถ้า EPO ขาย สถานะ Reimbursable เป็น No)
->ok
1.4 RC เป็น PDF + ชื่อพยาบาล วันที่ (ตรงลายเซ็นคุณผดา ต้องการให้สามารถใส่ไฟล์แก้ไขได้เอง)
1.5 HD Case Summary สร้าง filter กรองตามชั้น
-> ok
2. Accounting issues
2.1 HD Cases Matching
2.2 Statement Matching
2.3 ค่าตอบแทนแพทย์ และพยาบาล (ตามที่ คุณบอย แจ้งเมื่อวันที่ 19 ก.พ. 58)
2.4 Bank Reconciliation
2.5 Fixed Asset