diff --git a/netforce_clinic/layouts/clinic_account_setting.xml b/netforce_clinic/layouts/clinic_account_setting.xml index 549a23d..450d1bf 100644 --- a/netforce_clinic/layouts/clinic_account_setting.xml +++ b/netforce_clinic/layouts/clinic_account_setting.xml @@ -40,9 +40,10 @@ - - + + + diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index c629c93..e77a313 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -136,10 +136,19 @@ class ClinicSetting(Model): if user_id !=1: print("Only admin!!") return - for st in get_model("clinic.staff").search_browse([]): - st.write({ - 'note':' ', - }) + obj=self.browse(ids)[0] + lines=[] + for pt in get_model("clinic.patient").search_browse([]): + lines.append(('create',{ + 'patient_id': pt.id, + 'partner_id': pt.partner_id.id, + 'type_id': pt.type_id.id, + 'hn': pt.hn_no, + 'card_no': pt.card_no, + })) + obj.write({ + 'account_patients': lines, + }) print('Done!') return diff --git a/netforce_clinic/models/setting_account_patient.py b/netforce_clinic/models/setting_account_patient.py index e6cb6e9..104509c 100644 --- a/netforce_clinic/models/setting_account_patient.py +++ b/netforce_clinic/models/setting_account_patient.py @@ -9,6 +9,8 @@ class SettingAccountPatient(Model): "patient_id": fields.Many2One("clinic.patient","Patient",domain=[["state","=","admit"]]), 'partner_id': fields.Many2One("partner","Contact"), 'type_id': fields.Many2One("clinic.patient.type","Type"), + 'hn': fields.Char("HN"), + 'card_no': fields.Char("ID Card",size=13), } _order="type_id,patient_id" diff --git a/netforce_clinic/models/staff_rotation.py b/netforce_clinic/models/staff_rotation.py index 5b0d2d7..5e2455f 100644 --- a/netforce_clinic/models/staff_rotation.py +++ b/netforce_clinic/models/staff_rotation.py @@ -1,6 +1,6 @@ import time -from netforce.model import Model, fields +from netforce.model import Model, fields, get_model from netforce.access import get_active_company class StaffRotation(Model): @@ -55,10 +55,17 @@ class StaffRotation(Model): def create(self,vals,**kw): id=super().create(vals,**kw) self.function_store([id]) + #XXX + get_model("clinic.staff").function_store([vals['staff_id']]) return id def write(self,ids,vals,**kw): super().write(ids,vals,**kw) self.function_store(ids) + #XXX + staff_ids=[] + for obj in self.browse(ids): + staff_ids.append(obj.staff_id.id) + get_model("clinic.staff").function_store(staff_ids) StaffRotation.register()