add hd case module

conv_bal
Phongsan.b 2014-08-21 14:29:37 +07:00
parent 97183e2f9c
commit 681715b5ed
21 changed files with 151 additions and 3 deletions

View File

@ -1,3 +1,4 @@
README
setup.py
clinic/__init__.py
clinic.egg-info/PKG-INFO
@ -6,4 +7,9 @@ clinic.egg-info/dependency_links.txt
clinic.egg-info/top_level.txt
clinic/controllers/__init__.py
clinic/models/__init__.py
clinic/models/clinic_patients.py
clinic/models/clinic_doctor.py
clinic/models/clinic_hd_case.py
clinic/models/clinic_hd_case_line.py
clinic/models/clinic_nurse.py
clinic/models/clinic_patient.py
clinic/models/clinic_visit.py

View File

@ -3,5 +3,6 @@
<field name="view_cls">multi_view</field>
<field name="model">clinic.doctor</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Active",[["state","=","active"]]],["Deactive",[["state","=","deactive"]]]]</field>
<field name="modes">list,page,form</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -0,0 +1,8 @@
<action>
<field name="string">HD Case</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.hd.case</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Pending",[["state","=","pending"]]],["Confirm",[["state","=","corfirmed"]]]]</field>
<field name="modes">list,page,form</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -0,0 +1,7 @@
<action>
<field name="name">clinic_hd_case_line</field>
<field name="string">Hd Case Detial </field>
<field name="view_cls">list</field>
<field name="model">clinic.hd.case.line</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -3,5 +3,6 @@
<field name="view_cls">multi_view</field>
<field name="model">clinic.nurse</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Active",[["state","=","active"]]],["Deactive",[["state","=","deactive"]]]]</field>
<field name="modes">list,page,form</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -19,6 +19,12 @@
<related>
<field name="addresses"/>
</related>
<related>
<field name="visits"/>
</related>
<related>
<field name="hd_cases"/>
</related>
<related>
<field name="patients"/>
</related>

View File

@ -0,0 +1,26 @@
<form model="clinic.hd.case">
<head>
<field name="state"/>
<button string="Options" dropdown="1">
<item string="XXXX"/>
</button>
</head>
<separator string="HD Case Info"/>
<field name="number"/>
<field name="date"/>
<field name="patient_id"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
<field name="department"/>
<field name="lines" nolabel="1">
<list>
<field name="dialzer_id" onchange="onchange_product"/>
<field name="description"/>
<field name="qty" onchange="onchange_qty"/>
<field name="dz_state"/>
</list>
</field>
<related>
<field name="comments"/>
</related>
</form>

View File

@ -0,0 +1,8 @@
<list model="clinic.hd.case">
<field name="number"/>
<field name="date"/>
<field name="patient_id"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
<field name="state"/>
</list>

View File

@ -20,6 +20,12 @@
<related>
<field name="addresses"/>
</related>
<related>
<field name="visits"/>
</related>
<related>
<field name="hd_cases"/>
</related>
<related>
<field name="patients"/>
</related>

View File

@ -65,6 +65,9 @@
<related>
<field name="visits"/>
</related>
<related>
<field name="hd_cases"/>
</related>
<related>
<field name="comments"/>
</related>

View File

@ -2,3 +2,5 @@ from . import clinic_patient
from . import clinic_doctor
from . import clinic_nurse
from . import clinic_visit
from . import clinic_hd_case
from . import clinic_hd_case_line

View File

@ -22,6 +22,8 @@ class Doctor(Model):
"addresses": fields.One2Many("address","related_id","Addresses"),
"comments": fields.One2Many("message","related_id","Comments"),
"patients": fields.Many2Many("clinic.patient","Patients"),
"visits": fields.One2Many("clinic.visit","doctor_id","Visits"),
"hd_cases": fields.One2Many("clinic.hd.case","doctor_id","HD Cases"),
"company_id": fields.Many2One("company","Company"),
}

View File

@ -0,0 +1,52 @@
from netforce.model import Model, fields, get_model
from netforce.utils import get_data_path
import time
from netforce.access import get_active_user
from netforce.access import get_active_company
class Hdcase(Model):
_name="clinic.hd.case"
_string="HD Case Treatment"
_audit_log=True
_name_field="number"
_multi_company=True
_fields={
"number": fields.Char("Number",required=True,search=True),
"patient_id": fields.Many2One("clinic.patient","Patients",required=True,search=True),
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
"date": fields.Date("Create Date",required=True,search=True),
"department": fields.Char("Department",required=True,search=True),
"state": fields.Selection([("draft","Draft"),("pending","Pending"),("confirmed","Confirmed"),("canceled","Canceled")],"Status",required=True),
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Details"),
"comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company"),
}
def _get_number(self,context={}):
while 1:
num=get_model("sequence").get_number("sale_order")
if not num:
return None
res=self.search([["number","=",num]])
if not res:
return num
get_model("sequence").increment("sale_order")
_defaults={
"state": "draft",
"date": lambda *a: time.strftime("%Y-%m-%d"),
"number": _get_number,
"company_id": lambda *a: get_active_company(),
}
_order="date desc,number desc"
def void(self,ids,context={}):
obj=self.browse(ids)[0]
obj.write({"state":"voided"})
Hdcase.register()

View File

@ -0,0 +1,17 @@
from netforce.model import Model, fields, get_model
from netforce.utils import get_data_path
import time
from netforce.access import get_active_user
from netforce.access import get_active_company
class Hdcaseline(Model):
_name="clinic.hd.case.line"
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
"description": fields.Char("description",required=True,search=True),
"dialzer_id": fields.Many2One("product","Dialzer",search=True),
"qty":fields.Integer("QTY"),
"dz_state":fields.Selection([("active","Active"),("drop","Drop")],"Status DZ",required=True),
}
Hdcaseline.register()

View File

@ -22,6 +22,8 @@ class Nurse(Model):
"addresses": fields.One2Many("address","related_id","Addresses"),
"comments": fields.One2Many("message","related_id","Comments"),
"patients": fields.Many2Many("clinic.patient","Patients"),
"visits": fields.One2Many("clinic.visit","nurse_id","Visits"),
"hd_cases": fields.One2Many("clinic.hd.case","nurse_id","HD cases"),
"company_id": fields.Many2One("company","Company"),
}

View File

@ -67,17 +67,18 @@ class Patient(Model):
"doctorsss": fields.Many2Many("clinic.doctor","Doctors"),
"nurses": fields.Many2Many("clinic.nurse","Nurses"),
"visits": fields.One2Many("clinic.visit","patient_id","Visits"),
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
}
def _get_number(self,context={}):
while 1:
num=get_model("sequence").get_number("sale_order")
num=get_model("sequence").get_number("clinic_patient")
if not num:
return None
res=self.search([["number","=",num]])
if not res:
return num
get_model("sequence").increment("sale_order")
get_model("sequence").increment("clinic_patient")
_defaults={