diff --git a/clinic.egg-info/SOURCES.txt b/clinic.egg-info/SOURCES.txt
index 0790ecb..3104b53 100644
--- a/clinic.egg-info/SOURCES.txt
+++ b/clinic.egg-info/SOURCES.txt
@@ -11,6 +11,7 @@ clinic/models/clinic_dialyzer.py
clinic/models/clinic_doctor.py
clinic/models/clinic_hd_case.py
clinic/models/clinic_hd_case_line.py
+clinic/models/clinic_hd_case_line_detail.py
clinic/models/clinic_nurse.py
clinic/models/clinic_patient.py
clinic/models/clinic_visit.py
\ No newline at end of file
diff --git a/clinic/__pycache__/__init__.cpython-32.pyc b/clinic/__pycache__/__init__.cpython-32.pyc
new file mode 100644
index 0000000..b14183e
Binary files /dev/null and b/clinic/__pycache__/__init__.cpython-32.pyc differ
diff --git a/clinic/actions/clinic_hd_case.xml b/clinic/actions/clinic_hd_case.xml
index 1097fdc..e06a7a3 100644
--- a/clinic/actions/clinic_hd_case.xml
+++ b/clinic/actions/clinic_hd_case.xml
@@ -2,7 +2,7 @@
HD Case
multi_view
clinic.hd.case
- [["All",[]],["Draft",[["state","=","draft"]]],["Pending",[["state","=","pending"]]],["Confirm",[["state","=","corfirmed"]]]]
- list,page,form
+ [["All",[]],["Draft",[["state","=","draft"]]],["Confirm",[["state","=","corfirmed"]]],["Approved",[["state","=","approved"]]],["Validate",[["state","=","validate"]]],["Payment",[["state","=","payment"]]]]
+ list,form
clinic_menu
diff --git a/clinic/actions/clinic_setting.xml b/clinic/actions/clinic_setting.xml
new file mode 100644
index 0000000..7dac94f
--- /dev/null
+++ b/clinic/actions/clinic_setting.xml
@@ -0,0 +1,10 @@
+
+ clinic_setting
+ Settings
+ form_view
+ clinic.setting
+ form
+ 1
+ clinic_menu
+
+
diff --git a/clinic/actions/clinic_visit.xml b/clinic/actions/clinic_visit.xml
index 6afafb2..2de58af 100644
--- a/clinic/actions/clinic_visit.xml
+++ b/clinic/actions/clinic_visit.xml
@@ -2,7 +2,7 @@
Visit
multi_view
clinic.visit
- [["All",[]],["Draft",[["state","=","draft"]]],["Pending",[["state","=","pending"]]],["Confirm",[["state","=","corfirmed"]]]]
- list,calendar,page,form
+ [["All",[]],["Pending",[["state","=","pending"]]],["Confirm",[["state","=","corfirmed"]]],["Canceled",[["state","=","canceled"]]]]
+ list,calendar,form
clinic_menu
diff --git a/clinic/controllers/__pycache__/__init__.cpython-32.pyc b/clinic/controllers/__pycache__/__init__.cpython-32.pyc
new file mode 100644
index 0000000..6fd7563
Binary files /dev/null and b/clinic/controllers/__pycache__/__init__.cpython-32.pyc differ
diff --git a/clinic/layouts/clinic_hd_case_form.xml b/clinic/layouts/clinic_hd_case_form.xml
index e215b9f..80be1ac 100644
--- a/clinic/layouts/clinic_hd_case_form.xml
+++ b/clinic/layouts/clinic_hd_case_form.xml
@@ -2,46 +2,56 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/clinic/layouts/clinic_setting.xml b/clinic/layouts/clinic_setting.xml
new file mode 100644
index 0000000..9c9ba1f
--- /dev/null
+++ b/clinic/layouts/clinic_setting.xml
@@ -0,0 +1,14 @@
+
diff --git a/clinic/layouts/clinic_visit_calendar.xml b/clinic/layouts/clinic_visit_calendar.xml
index 24aac59..2665592 100644
--- a/clinic/layouts/clinic_visit_calendar.xml
+++ b/clinic/layouts/clinic_visit_calendar.xml
@@ -1,6 +1,7 @@
-
-
+
+
+
diff --git a/clinic/layouts/clinic_visit_form.xml b/clinic/layouts/clinic_visit_form.xml
index e046c34..1618b08 100644
--- a/clinic/layouts/clinic_visit_form.xml
+++ b/clinic/layouts/clinic_visit_form.xml
@@ -9,13 +9,18 @@
+
+
-
+
+
+
+
diff --git a/clinic/layouts/clinic_visit_list.xml b/clinic/layouts/clinic_visit_list.xml
index 258104b..428b979 100644
--- a/clinic/layouts/clinic_visit_list.xml
+++ b/clinic/layouts/clinic_visit_list.xml
@@ -1,6 +1,7 @@
+
diff --git a/clinic/models/__init__.py b/clinic/models/__init__.py
index 27cbf6e..7253074 100644
--- a/clinic/models/__init__.py
+++ b/clinic/models/__init__.py
@@ -6,3 +6,4 @@ from . import clinic_hd_case
from . import clinic_hd_case_line
from . import clinic_hd_case_line_detail
from . import clinic_dialyzer
+from . import clinic_setting
diff --git a/clinic/models/__pycache__/__init__.cpython-32.pyc b/clinic/models/__pycache__/__init__.cpython-32.pyc
index dc1600b..652a9d8 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_dialyzer.cpython-32.pyc b/clinic/models/__pycache__/clinic_dialyzer.cpython-32.pyc
new file mode 100644
index 0000000..1765c8b
Binary files /dev/null and b/clinic/models/__pycache__/clinic_dialyzer.cpython-32.pyc differ
diff --git a/clinic/models/__pycache__/clinic_hd_case.cpython-32.pyc b/clinic/models/__pycache__/clinic_hd_case.cpython-32.pyc
new file mode 100644
index 0000000..cd25e8b
Binary files /dev/null and b/clinic/models/__pycache__/clinic_hd_case.cpython-32.pyc differ
diff --git a/clinic/models/__pycache__/clinic_hd_case_line.cpython-32.pyc b/clinic/models/__pycache__/clinic_hd_case_line.cpython-32.pyc
new file mode 100644
index 0000000..3f921ad
Binary files /dev/null and b/clinic/models/__pycache__/clinic_hd_case_line.cpython-32.pyc differ
diff --git a/clinic/models/__pycache__/clinic_hd_case_line_detail.cpython-32.pyc b/clinic/models/__pycache__/clinic_hd_case_line_detail.cpython-32.pyc
new file mode 100644
index 0000000..7304bc9
Binary files /dev/null and b/clinic/models/__pycache__/clinic_hd_case_line_detail.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 53b3103..c4ac44b 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/__pycache__/clinic_setting.cpython-32.pyc b/clinic/models/__pycache__/clinic_setting.cpython-32.pyc
new file mode 100644
index 0000000..c47bbd5
Binary files /dev/null and b/clinic/models/__pycache__/clinic_setting.cpython-32.pyc differ
diff --git a/clinic/models/__pycache__/clinic_visit.cpython-32.pyc b/clinic/models/__pycache__/clinic_visit.cpython-32.pyc
index 80a1348..f892923 100644
Binary files a/clinic/models/__pycache__/clinic_visit.cpython-32.pyc and b/clinic/models/__pycache__/clinic_visit.cpython-32.pyc differ
diff --git a/clinic/models/clinic_dialyzer.py b/clinic/models/clinic_dialyzer.py
index a557e7c..8f0f326 100644
--- a/clinic/models/clinic_dialyzer.py
+++ b/clinic/models/clinic_dialyzer.py
@@ -19,7 +19,7 @@ class Dialyzer(Model):
"exp_date": fields.Date("Expire Date",search=True),
"patient_id": fields.Many2One("clinic.patient","Patient"),
"member_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Member Type",required=True),
- "dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Member Type",required=True),
+ "dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type",required=True),
"bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)",required=True,search=True),
"ultrafittration": fields.Float("Ultrafittration Kg.",required=True,search=True),
"state": fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status",required=True),
diff --git a/clinic/models/clinic_hd_case.py b/clinic/models/clinic_hd_case.py
index 9b71dff..86b2821 100644
--- a/clinic/models/clinic_hd_case.py
+++ b/clinic/models/clinic_hd_case.py
@@ -1,7 +1,7 @@
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_user,set_active_user
from netforce.access import get_active_company
class Hdcase(Model):
@@ -25,11 +25,15 @@ class Hdcase(Model):
"bp_stop": fields.Integer("BP mmHG stop",required=True,search=True),
"per_bp_stop": fields.Integer("/Per stop",required=True,search=True),
"hct": fields.Integer("HCT %",required=True,search=True),
- "state": fields.Selection([("draft","Draft"),("pending","Pending"),("confirmed","Confirmed"),("canceled","Canceled")],"Status",required=True),
+ "state": fields.Selection([("draft","Draft"),("approved","Approved"),("confirmed","Confirmed"),("validate","Validate"),("canceled","Canceled"),("payment","Payment")],"Status",required=True),
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Details"),
"lines_detail": fields.One2Many("clinic.hd.case.line.detail","hd_case_id","Detail"),
"comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company"),
+ "fee": fields.Float("Fee",required=True),
+ "amount": fields.Float("Amount",function="get_total",readonly=True,function_multi=True),
+ "total": fields.Float("Total",function="get_total",readonly=True,function_multi=True),
+ "reconcile_id": fields.Many2One("account.reconcile","Reconcile Id",readonly=True),
}
def _get_number(self,context={}):
@@ -66,14 +70,137 @@ class Hdcase(Model):
"date_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
"number": _get_number,
"company_id": lambda *a: get_active_company(),
+ "fee": 1500,
}
- _order="date desc,number desc"
+ _order="date_start desc,number desc"
- def void(self,ids,context={}):
+ def canceled(self,ids,context={}):
obj=self.browse(ids)[0]
- obj.write({"state":"voided"})
+ obj.write({"state":"canceled"})
+ def confirmed(self,ids,context={}):
+ obj=self.browse(ids)[0]
+ obj.write({"state":"confirmed"})
+
+ def payment(self,ids,context={}):
+ obj=self.browse(ids)[0]
+ obj.write({"state":"payment"})
+
+ def approved(self,ids,context={}):
+ for obj in self.browse(ids):
+ user_id=get_active_user()
+ try:
+ set_active_user(1)
+ settings=get_model("clinic.setting").browse(1)
+ reconcile_id=get_model("account.reconcile").create({})
+ if obj.patient_id.type == 'mg':
+ vals={
+ "narration": obj.number,
+ "lines": [
+ ("create",{
+ "description": obj.number,
+ "account_id": settings.ar_mg_id.id,
+ "debit": obj.amount,
+ "credit": 0,
+ "partner_id": settings.mg_partner_id.id,
+ "due_date": obj.date,
+ "reconcile_id":reconcile_id,
+ }),
+ ("create",{
+ "description": obj.number,
+ "account_id": settings.ap_mg_id.id,
+ "debit": 0,
+ "credit": obj.amount,
+ }),
+ ],
+ "state": "posted",
+ "date_posted": obj.date,
+ "date": obj.date,
+ }
+ get_model("account.move").create(vals)
+ elif obj.patient_id.type == 'sc':
+ vals={
+ "narration": obj.number,
+ "lines": [
+ ("create",{
+ "description": obj.number,
+ "account_id": settings.ar_sc_id.id,
+ "debit": obj.amount,
+ "credit": 0,
+ "partner_id": settings.sc_partner_id.id,
+ "due_date": obj.date,
+ "reconcile_id":reconcile_id,
+ }),
+ ("create",{
+ "description": obj.number,
+ "account_id": settings.ap_sc_id.id,
+ "debit": 0,
+ "credit": obj.amount,
+ }),
+ ],
+ "state": "posted",
+ "date_posted": obj.date,
+ "date": obj.date,
+ }
+ get_model("account.move").create(vals)
+ elif obj.patient_id.type == 'nhso':
+ vals={
+ "narration": obj.number,
+ "lines": [
+ ("create",{
+ "description": obj.number,
+ "account_id": settings.ar_nhso_id.id,
+ "debit": obj.amount,
+ "credit": 0,
+ "partner_id": settings.nhso_partner_id.id,
+ "due_date": obj.date,
+ "reconcile_id":reconcile_id,
+ }),
+ ("create",{
+ "description": obj.number,
+ "account_id": settings.ap_nhso_id.id,
+ "debit": 0,
+ "credit": obj.amount,
+ }),
+ ],
+ "state": "posted",
+ "date_posted": obj.date,
+ "date": obj.date,
+ }
+ get_model("account.move").create(vals)
+ finally:
+ set_active_user(user_id)
+ obj.write({"state":"approved","reconcile_id":reconcile_id})
+
+ def journal_report(self,ids,context={}):
+ obj=self.browse(ids[0])
+ move_id = get_model("account.move").search([["narration","=",obj.number]])
+ if not move_id:
+ raise Exception("Order is not post or nove have jounal entry.")
+ return {
+ "next": {
+ "name": "journal_entry",
+ "mode":"form",
+ "active_id":move_id[0],
+ }
+ }
+
+ def get_total(self,ids,context={}):
+ vals={}
+ for obj in self.browse(ids):
+ total=0
+ amt=0
+ fee=obj.fee
+ for line in obj.lines_detail:
+ total+=line.total
+ amt=total+fee
+ vals[obj.id]={
+ "total": total,
+ "amount": amt,
+ }
+ return vals
+
Hdcase.register()
diff --git a/clinic/models/clinic_patient.py b/clinic/models/clinic_patient.py
index 2e9dd66..aac1d22 100644
--- a/clinic/models/clinic_patient.py
+++ b/clinic/models/clinic_patient.py
@@ -6,7 +6,7 @@ from netforce.access import get_active_company
class Patient(Model):
_name="clinic.patient"
- _string="Partient"
+ _string="Patient"
_audit_log=True
_name_field="name"
_multi_company=True
diff --git a/clinic/models/clinic_setting.py b/clinic/models/clinic_setting.py
new file mode 100644
index 0000000..4c9d05c
--- /dev/null
+++ b/clinic/models/clinic_setting.py
@@ -0,0 +1,22 @@
+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 ClinicSetting(Model):
+ _name="clinic.setting"
+ _string="Setting"
+ _fields={
+ "mg_partner_id": fields.Many2One("partner","Partner Medical Govement"),
+ "ar_mg_id": fields.Many2One("account.account","Account Receivable Medical Govement"),
+ "ap_mg_id": fields.Many2One("account.account","Account Payment Medical Govement"),
+ "nhso_partner_id": fields.Many2One("partner","Partner NHSO 30B"),
+ "ar_nhso_id": fields.Many2One("account.account","Account Receiveble NHSO 30B"),
+ "ap_nhso_id": fields.Many2One("account.account","Account Payment NHSO 30B"),
+ "sc_partner_id": fields.Many2One("partner","Partner Social Security"),
+ "ar_sc_id": fields.Many2One("account.account","Account Receiveble Social Security"),
+ "ap_sc_id": fields.Many2One("account.account","Account Payment Social Security"),
+ }
+
+ClinicSetting.register()
diff --git a/clinic/models/clinic_visit.py b/clinic/models/clinic_visit.py
index 16d9b81..90b995e 100644
--- a/clinic/models/clinic_visit.py
+++ b/clinic/models/clinic_visit.py
@@ -15,9 +15,10 @@ class Visit(Model):
"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),
+ "date": fields.Date("Visit Date",required=True,search=True),
+ "department": fields.Char("Department",required=False,search=True),
+ "cycle": fields.Selection([("1","One"),("2","Two"),("3","Tree"),("4","Four")],"Cycle",required=True),
+ "state": fields.Selection([("pending","Pending"),("confirmed","Confirmed"),("canceled","Canceled")],"Status",required=True),
"comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company"),
}
@@ -34,18 +35,20 @@ class Visit(Model):
_defaults={
- "state": "draft",
- "date": lambda *a: time.strftime("%Y-%m-%d"),
+ "state": "pending",
"number": _get_number,
"company_id": lambda *a: get_active_company(),
}
- _order="date desc,number desc"
+ _order="date asc,cycle asc"
-
- def void(self,ids,context={}):
+ def confirmed(self,ids,context={}):
obj=self.browse(ids)[0]
- obj.write({"state":"voided"})
+ obj.write({"state":"confirmed"})
+
+ def canceled(self,ids,context={}):
+ obj=self.browse(ids)[0]
+ obj.write({"state":"canceled"})
Visit.register()