diff --git a/netforce_clinic/layouts/clinic_account_setting.xml b/netforce_clinic/layouts/clinic_account_setting.xml
index 2c03d64..549a23d 100644
--- a/netforce_clinic/layouts/clinic_account_setting.xml
+++ b/netforce_clinic/layouts/clinic_account_setting.xml
@@ -37,6 +37,14 @@
+
+
+
+
+
+
+
+
diff --git a/netforce_clinic/layouts/clinic_setting.xml b/netforce_clinic/layouts/clinic_setting.xml
index 98b490a..1586bc7 100644
--- a/netforce_clinic/layouts/clinic_setting.xml
+++ b/netforce_clinic/layouts/clinic_setting.xml
@@ -2,7 +2,6 @@
-
@@ -31,6 +30,7 @@
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index 69c0b11..ec985ca 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -2,6 +2,7 @@ from . import utils
from . import setting
from . import setting_product
from . import setting_account_product
+from . import setting_account_patient
from . import setting_shop_product
from . import setting_level
from . import setting_policy
diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py
index d3190b2..e33607c 100644
--- a/netforce_clinic/models/setting.py
+++ b/netforce_clinic/models/setting.py
@@ -13,6 +13,7 @@ class ClinicSetting(Model):
'levels': fields.One2Many("clinic.setting.level","setting_id","Levels"),
'products': fields.One2Many("clinic.setting.product","setting_id","Products"),
'account_products': fields.One2Many("clinic.setting.account.product","setting_id","Account Products"),
+ 'account_patients': fields.One2Many("clinic.setting.account.patient","setting_id","Account Patients"),
'shop_products': fields.One2Many("clinic.setting.shop.product","setting_id","Shop Products"),
'invoice_policies': fields.One2Many("clinic.setting.policy","setting_id","Invoice Policies"),
'cost_per_case': fields.Float("Cost Per Case"),
@@ -127,6 +128,21 @@ class ClinicSetting(Model):
print("Only admin!!")
return
print("Done!")
+ lines=[]
+ for pt in get_model("clinic.patient").search_browse([['state','=','admit']]):
+ partner_id=None
+ if pt.partner_id:
+ partner_id=pt.partner_id.id
+ vals={
+ 'patient_id': pt.id,
+ 'partner_id': partner_id,
+ 'type_id': pt.type_id.id,
+ }
+ lines.append(('create',vals))
+ obj=self.browse(ids)[0]
+ obj.write({
+ 'account_patients': lines,
+ })
return
def update_staff_department(self,ids,context={}):
diff --git a/netforce_clinic/models/setting_account_patient.py b/netforce_clinic/models/setting_account_patient.py
new file mode 100644
index 0000000..e6cb6e9
--- /dev/null
+++ b/netforce_clinic/models/setting_account_patient.py
@@ -0,0 +1,16 @@
+from netforce.model import Model, fields
+
+class SettingAccountPatient(Model):
+ _name="clinic.setting.account.patient"
+ _string="Setting Account Patient"
+
+ _fields={
+ "setting_id": fields.Many2One("clinic.setting","Setting",required=True,on_delete="cascade"),
+ "patient_id": fields.Many2One("clinic.patient","Patient",domain=[["state","=","admit"]]),
+ 'partner_id': fields.Many2One("partner","Contact"),
+ 'type_id': fields.Many2One("clinic.patient.type","Type"),
+ }
+
+ _order="type_id,patient_id"
+
+SettingAccountPatient.register()