diff --git a/clinic/actions/clinic_dialyzer.xml b/clinic/actions/clinic_dialyzer.xml new file mode 100644 index 0000000..f2b5391 --- /dev/null +++ b/clinic/actions/clinic_dialyzer.xml @@ -0,0 +1,8 @@ + + Dialyzer + multi_view + clinic.dialyzer + [["All",[]],["Draft",[["state","=","draft"]]],["Active",[["state","=","active"]]],["Drop",[["state","=","drop"]]]] + list,page,form + clinic_menu + diff --git a/clinic/layouts/clinic_dialyzer_form.xml b/clinic/layouts/clinic_dialyzer_form.xml new file mode 100644 index 0000000..2219db9 --- /dev/null +++ b/clinic/layouts/clinic_dialyzer_form.xml @@ -0,0 +1,16 @@ +
+ + + + + + + + + + + + + diff --git a/clinic/layouts/clinic_dialyzer_list.xml b/clinic/layouts/clinic_dialyzer_list.xml new file mode 100644 index 0000000..ee5f49a --- /dev/null +++ b/clinic/layouts/clinic_dialyzer_list.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/clinic/layouts/clinic_hd_case_form.xml b/clinic/layouts/clinic_hd_case_form.xml index 5b698a1..897829a 100644 --- a/clinic/layouts/clinic_hd_case_form.xml +++ b/clinic/layouts/clinic_hd_case_form.xml @@ -15,9 +15,10 @@ - - - + + + + diff --git a/clinic/layouts/clinic_menu.xml b/clinic/layouts/clinic_menu.xml index 0683d88..d8ecdf4 100644 --- a/clinic/layouts/clinic_menu.xml +++ b/clinic/layouts/clinic_menu.xml @@ -8,6 +8,7 @@ + diff --git a/clinic/models/__init__.py b/clinic/models/__init__.py index d135f53..487c30a 100644 --- a/clinic/models/__init__.py +++ b/clinic/models/__init__.py @@ -4,3 +4,4 @@ from . import clinic_nurse from . import clinic_visit from . import clinic_hd_case from . import clinic_hd_case_line +from . import clinic_dialyzer diff --git a/clinic/models/__pycache__/__init__.cpython-32.pyc b/clinic/models/__pycache__/__init__.cpython-32.pyc index 6ee129d..db91871 100644 Binary files a/clinic/models/__pycache__/__init__.cpython-32.pyc and b/clinic/models/__pycache__/__init__.cpython-32.pyc differ diff --git a/clinic/models/__pycache__/clinic_patient.cpython-32.pyc b/clinic/models/__pycache__/clinic_patient.cpython-32.pyc index da7b23a..4ca1f42 100644 Binary files a/clinic/models/__pycache__/clinic_patient.cpython-32.pyc and b/clinic/models/__pycache__/clinic_patient.cpython-32.pyc differ diff --git a/clinic/models/clinic_dialyzer.py b/clinic/models/clinic_dialyzer.py new file mode 100644 index 0000000..a6ce913 --- /dev/null +++ b/clinic/models/clinic_dialyzer.py @@ -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() diff --git a/clinic/models/clinic_hd_case_line.py b/clinic/models/clinic_hd_case_line.py index 695a70d..f71d03c 100644 --- a/clinic/models/clinic_hd_case_line.py +++ b/clinic/models/clinic_hd_case_line.py @@ -8,10 +8,11 @@ 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), + "dialzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True), + "detail": fields.Char("description",search=True), + "use_time":fields.Integer("Use time"), + "max_use_time":fields.Integer("Max use time"), + "state":fields.Selection([("active","Active"),("drop","Drop")],"Status DZ"), } Hdcaseline.register() diff --git a/clinic/models/clinic_patient.py b/clinic/models/clinic_patient.py index 6ea37a7..9bbef99 100644 --- a/clinic/models/clinic_patient.py +++ b/clinic/models/clinic_patient.py @@ -8,7 +8,7 @@ class Patient(Model): _name="clinic.patient" _string="Partient" _audit_log=True - _name_field="number" + _name_field="name" _multi_company=True _fields={ "number": fields.Char("Number",required=True,search=True),