order cycle item
parent
8f6230e488
commit
48141145b5
|
@ -35,8 +35,8 @@ class CycleItem(Model):
|
|||
'sequence': fields.Char("Sequence",function="_get_all",function_multi=True,store=True),
|
||||
'user_id': fields.Many2One("base.user","Validator"),
|
||||
'company_id': fields.Many2One("company", "Company"),
|
||||
'branch_id': fields.Many2One("clinic.branch", "Branch"),
|
||||
'department_id': fields.Many2One("clinic.department", "Department"),
|
||||
'branch_id': fields.Many2One("clinic.branch", "Branch",search=True),
|
||||
'department_id': fields.Many2One("clinic.department", "Department",search=True),
|
||||
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
|
||||
"state": fields.Selection([("draft","Draft"),("validated","Validated")],"Status",required=True),
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class CycleItem(Model):
|
|||
'department_id': _get_department,
|
||||
}
|
||||
|
||||
_order="date desc"
|
||||
_order="date desc,department_id,cycle_id"
|
||||
_sql_constraints=[
|
||||
("cycle_item_uniq","unique (cycle_id,date,company_id,branch_id,department_id)","Cycle item should be unique"),
|
||||
]
|
||||
|
@ -219,6 +219,7 @@ class CycleItem(Model):
|
|||
vs.write({
|
||||
'cycle_item_id': obj.id,
|
||||
})
|
||||
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_item',
|
||||
|
|
|
@ -126,6 +126,11 @@ class ClinicSetting(Model):
|
|||
})
|
||||
print('update ', item.name)
|
||||
item.validate()
|
||||
if item.department_id:
|
||||
print("update department for nurse", nid)
|
||||
get_model("clinic.staff").browse(nid).write({
|
||||
'department_id': item.department_id.id,
|
||||
})
|
||||
#return
|
||||
#############################################
|
||||
print("Done!")
|
||||
|
|
|
@ -229,7 +229,7 @@ class Visit(Model):
|
|||
'branch_id': branch.id,
|
||||
'department_id': department.id,
|
||||
'date': date,
|
||||
'nurses': [],
|
||||
'lines': [],
|
||||
}
|
||||
|
||||
item_id=None
|
||||
|
@ -241,7 +241,7 @@ class Visit(Model):
|
|||
item=item_obj.browse(item_id)
|
||||
if item.state!='draft':
|
||||
# reset nurse
|
||||
for nurse in item.nurses:
|
||||
for nurse in item.lines:
|
||||
nurse.delete()
|
||||
|
||||
# copy nurse from schedule
|
||||
|
@ -252,7 +252,7 @@ class Visit(Model):
|
|||
for line in schedule.lines:
|
||||
if line.cycle_id.id==cycle.id:
|
||||
nurse=line.nurse_id
|
||||
item_vals['nurses'].append(('create',{
|
||||
item_vals['lines'].append(('create',{
|
||||
'nurse_id': nurse.id,
|
||||
'level_id': nurse.level_id.id,
|
||||
}))
|
||||
|
|
Loading…
Reference in New Issue