diff --git a/netforce_clinic/layouts/clinic_staff_form.xml b/netforce_clinic/layouts/clinic_staff_form.xml index 41d6821..56b8f31 100644 --- a/netforce_clinic/layouts/clinic_staff_form.xml +++ b/netforce_clinic/layouts/clinic_staff_form.xml @@ -76,8 +76,23 @@ + + + + +
+ + +
+ + + + +
+ + +
- diff --git a/netforce_clinic/models/cycle_item.py b/netforce_clinic/models/cycle_item.py index 069f03f..6d6a71e 100644 --- a/netforce_clinic/models/cycle_item.py +++ b/netforce_clinic/models/cycle_item.py @@ -51,6 +51,7 @@ class CycleItem(Model): 'visits': fields.One2Many("clinic.visit","cycle_item_id", "Visits"), 'hd_cases': fields.One2Many("clinic.hd.case","cycle_item_id", "HD Cases"), 'nurses': fields.One2Many("clinic.cycle.item.nurse",'cycle_item_id','Nurses'), + 'nurse_id': fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]), #XXX 'sequence': fields.Char("Sequence"), # for sort item 'company_id': fields.Many2One("company", "Company"), "state": fields.Selection([("draft","Draft"),("done","Done")],"Status",required=True), diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 422db39..13c9904 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -81,7 +81,7 @@ class HDCase(Model): "patient_type": fields.Char("Service Type",function="_get_patient_type"), "vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."), "nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]), - "staff_id": fields.Many2One("clinic.staff", "Staff"), + "staff_id": fields.Many2One("clinic.staff", "Staff"), #XXX "department_id": fields.Many2One("clinic.department", "Department",search=True), "wt_kg": fields.Float("Wt.kg."), "bp": fields.Integer("BP"), @@ -94,6 +94,7 @@ class HDCase(Model): "dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"), "lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"), "staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"), + "staff_id": fields.Many2One("clinic.hd.case.staff","Staff"), #XXX "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"), "reconcile_id": fields.Many2One("account.reconcile","Reconcile Id",readonly=True), "invoices": fields.One2Many("account.invoice","related_id","Invoices"), @@ -826,9 +827,9 @@ class HDCase(Model): st=get_model("clinic.setting").browse(1) for pl in st.invoice_policies: policy=pl.invoice_policy - patient_type=pl.patient_type + patient_type_id=pl.patient_type_id.id opt=pl.invoice_option - if patient.type==patient_type: + if patient.type_id.id==patient_type_id: vals['invoice_policy']=policy vals['invoice_option']=opt break @@ -843,15 +844,10 @@ class HDCase(Model): def write(self,ids,vals,**kw): patient_id=vals.get('patient_id') - # XXX import problem + # XXX importing problem # when change patient #vals=self.get_staff_line(vals,patient_id) vals=self.get_invoice_policy(vals,patient_id) - obj=self.browse(ids)[0] - for st in obj.staffs: - if st.type=='doctor': - doctor=st.staff_id - vals['staff_id']=doctor.id super().write(ids,vals,**kw) def onchange_type(self,context={}): diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py index 09feea4..cadd2e2 100644 --- a/netforce_clinic/models/staff.py +++ b/netforce_clinic/models/staff.py @@ -53,6 +53,7 @@ class Staff(Model): 'max_cycle': max_cycle, } return res + _fields={ 'employee_id': fields.Many2One("hr.employee","Employee"), @@ -81,7 +82,6 @@ class Staff(Model): "comments": fields.One2Many("message","related_id","Comments"), "nurse_visits": fields.One2Many("clinic.visit","nurse_id","Visits"), "doctor_visits": fields.One2Many("clinic.visit","doctor_id","Visits"), - "hd_cases": fields.One2Many("clinic.hd.case","staff_id","HD Cases"), "company_id": fields.Many2One("company","Company"), "user_id": fields.Many2One("base.user","User"), 'picture': fields.File("Picture"), @@ -100,6 +100,8 @@ class Staff(Model): "cycles": fields.One2Many("clinic.staff.cycle","staff_id","Cycles"), 'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"), 'branch_id': fields.Many2One("clinic.branch","Branch"), + "hd_case_staffs": fields.One2Many("clinic.hd.case.staff","staff_id","HD Cases"), + "cycle_item_nurses": fields.One2Many("clinic.cycle.item.nurse","nurse_id","Cycle Items"), } def _get_number(self,context={}): @@ -121,7 +123,6 @@ class Staff(Model): _defaults={ 'active': True, "state": "temporary", - #'type': 'staff', "type": lambda self,ctx: ctx.get("type") or "staff", "date": lambda *a: time.strftime("%Y-%m-%d"), "number": _get_number,