diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml index dff986d..2fa0d30 100644 --- a/netforce_clinic/layouts/clinic_hd_case_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_form.xml @@ -89,8 +89,6 @@ - - diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 4efebbf..8c6cf7f 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -38,10 +38,6 @@ - - - -
@@ -52,7 +48,7 @@
- + diff --git a/netforce_clinic/layouts/clinic_staff_form.xml b/netforce_clinic/layouts/clinic_staff_form.xml index 90063b4..446d19e 100644 --- a/netforce_clinic/layouts/clinic_staff_form.xml +++ b/netforce_clinic/layouts/clinic_staff_form.xml @@ -32,16 +32,14 @@ - - - - + + - + - + @@ -64,7 +62,7 @@ - + @@ -76,9 +74,7 @@ - - - + diff --git a/netforce_clinic/models/hd_case_staff.py b/netforce_clinic/models/hd_case_staff.py index 15ac7ca..4839a43 100644 --- a/netforce_clinic/models/hd_case_staff.py +++ b/netforce_clinic/models/hd_case_staff.py @@ -5,8 +5,8 @@ class HdCaseStaff(Model): _fields={ "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"), "staff_id": fields.Many2One("clinic.staff","Staff",search=True), - "type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("others","Others")],"Type",required=True), - "priop": fields.Selection([("owner","Owner"),('other','Other')],"Priority"), + "type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True), + "priop": fields.Selection([("owner","Owner"),('second','Second')],"Priority"), 'note': fields.Char("Note"), } diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py index 3baf360..bb063bc 100644 --- a/netforce_clinic/models/staff.py +++ b/netforce_clinic/models/staff.py @@ -24,8 +24,8 @@ class Staff(Model): res={} for obj in self.browse(ids): level_id=None - for move in obj.moves: - level_id=move.level_id.id + for rotate in obj.rotations: + level_id=rotate.level_id.id res[obj.id]=level_id return res @@ -42,13 +42,13 @@ class Staff(Model): def _get_base(self,ids,context={}): res={} for obj in self.browse(ids): - base=0 + wage=0 max_cycle=0 - for mv in obj.moves: - base=mv.wage - max_cycle=mv.max_cycle + for rotate in obj.rotations: + wage=rotate.wage + max_cycle=rotate.max_cycle res[obj.id]={ - 'base': base, + 'wage': wage, 'max_cycle': max_cycle, } return res @@ -86,16 +86,16 @@ class Staff(Model): 'picture': fields.File("Picture"), 'note': fields.Text("Note"), 'categ_id': fields.Many2One("clinic.staff.categ", "Category"), - 'level_id': fields.Many2One("clinic.staff.level", "Staff Level", function="_get_level"), + 'level_id': fields.Many2One("clinic.staff.level", "Level", function="_get_level"), 'active': fields.Boolean("Active"), 'date': fields.Date("Register Date"), - 'base': fields.Float("Base Amount", function="_get_base",function_multi=True), + 'wage': fields.Float("Wage", function="_get_base",function_multi=True), 'max_cycle': fields.Integer("Max Cycle", function="_get_base",function_multi=True), 'hire_date': fields.Date("Hire Date"), 'resign_date': fields.Date("Resign Date"), "documents": fields.One2Many("document","related_id","Documents"), - "moves": fields.One2Many("clinic.staff.move","staff_id","Staff Movement"), - "cycles": fields.One2Many("clinic.staff.cycle","staff_id","Working Cycles"), + "rotations": fields.One2Many("clinic.staff.rotation","staff_id","Staff Rotation"), + "cycles": fields.One2Many("clinic.staff.cycle","staff_id","Cycles"), 'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"), } @@ -124,5 +124,13 @@ class Staff(Model): "company_id": lambda *a: get_active_company(), } _order="date desc,number desc" + + def create(self,vals,**kw): + emp_obj=get_model("hr.employee") + last_name=vals['name'].split(" ")[-1] + emp_ids=emp_obj.search([['last_name','=',last_name]]) + # TODO create employee automatically + new_id=super().create(vals,**kw) + return new_id Staff.register()