add clinic dialyzer

conv_bal
Phongsan.b 2014-08-21 17:03:45 +07:00
parent bb971b374d
commit 829441339e
11 changed files with 100 additions and 8 deletions

View File

@ -0,0 +1,8 @@
<action>
<field name="string">Dialyzer</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.dialyzer</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Active",[["state","=","active"]]],["Drop",[["state","=","drop"]]]]</field>
<field name="modes">list,page,form</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -0,0 +1,16 @@
<form model="clinic.dialyzer">
<head>
<field name="state"/>
<button string="Options" dropdown="1">
<item string="Drop"/>
</button>
</head>
<field name="number"/>
<field name="detail"/>
<field name="use_time"/>
<field name="max_use_time"/>
<field name="date"/>
<field name="exp_date"/>
<field name="patient_id"/>
<field name="state"/>
</form>

View File

@ -0,0 +1,10 @@
<list model="clinic.dialyzer">
<field name="number"/>
<field name="detail"/>
<field name="use_time"/>
<field name="max_use_time"/>
<field name="date"/>
<field name="exp_date"/>
<field name="patient_id"/>
<field name="state"/>
</list>

View File

@ -15,9 +15,10 @@
<field name="lines" nolabel="1"> <field name="lines" nolabel="1">
<list> <list>
<field name="dialzer_id" onchange="onchange_product"/> <field name="dialzer_id" onchange="onchange_product"/>
<field name="description"/> <field name="detail"/>
<field name="qty" onchange="onchange_qty"/> <field name="use_time"/>
<field name="dz_state"/> <field name="max_use_time"/>
<field name="state"/>
</list> </list>
</field> </field>
<related> <related>

View File

@ -8,6 +8,7 @@
<item string="Clinic"> <item string="Clinic">
<item string="Visit" action="clinic_visit"/> <item string="Visit" action="clinic_visit"/>
<item string="HD case treatment" action="clinic_hd_case"/> <item string="HD case treatment" action="clinic_hd_case"/>
<item string="Dialyzer" action="clinic_dialyzer"/>
</item> </item>
<item string="Settings"> <item string="Settings">
<item string="Clinic Setting" action="clinic_setting"/> <item string="Clinic Setting" action="clinic_setting"/>

View File

@ -4,3 +4,4 @@ from . import clinic_nurse
from . import clinic_visit from . import clinic_visit
from . import clinic_hd_case from . import clinic_hd_case
from . import clinic_hd_case_line from . import clinic_hd_case_line
from . import clinic_dialyzer

View File

@ -0,0 +1,54 @@
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 Dialyzer(Model):
_name="clinic.dialyzer"
_string="Dialyzer"
_audit_log=True
_name_field="number"
_multi_company=True
_fields={
"number": fields.Char("Number",required=True,search=True),
"detail": fields.Char("Detail",search=True),
"date": fields.Date("Create Date",search=True),
"use_time": fields.Integer("Use Time"),
"max_use_time": fields.Integer("Max Use Time"),
"exp_date": fields.Date("Expire Date",search=True),
"patient_id": fields.Many2One("clinic.patient","Patient"),
"state": fields.Selection([("draft","Draft"),("active","Active"),("drop","Drop")],"Status",required=True),
"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(name="dialyzer")
if not num:
return None
res=self.search([["number","=",num]])
if not res:
return num
get_model("sequence").increment(name="dialyzer")
_defaults={
"state": "draft",
"date": lambda *a: time.strftime("%Y-%m-%d"),
"number": _get_number,
"max_use_time": 10,
"use_time": 0,
"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"})
Dialyzer.register()

View File

@ -8,10 +8,11 @@ class Hdcaseline(Model):
_name="clinic.hd.case.line" _name="clinic.hd.case.line"
_fields={ _fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"), "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("clinic.dialyzer","Dialzer",search=True),
"dialzer_id": fields.Many2One("product","Dialzer",search=True), "detail": fields.Char("description",search=True),
"qty":fields.Integer("QTY"), "use_time":fields.Integer("Use time"),
"dz_state":fields.Selection([("active","Active"),("drop","Drop")],"Status DZ",required=True), "max_use_time":fields.Integer("Max use time"),
"state":fields.Selection([("active","Active"),("drop","Drop")],"Status DZ"),
} }
Hdcaseline.register() Hdcaseline.register()

View File

@ -8,7 +8,7 @@ class Patient(Model):
_name="clinic.patient" _name="clinic.patient"
_string="Partient" _string="Partient"
_audit_log=True _audit_log=True
_name_field="number" _name_field="name"
_multi_company=True _multi_company=True
_fields={ _fields={
"number": fields.Char("Number",required=True,search=True), "number": fields.Char("Number",required=True,search=True),