fix get_sequence
parent
dd87e8eea1
commit
a5afa558e0
|
@ -288,7 +288,7 @@ class HDCase(Model):
|
||||||
|
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
while 1:
|
while 1:
|
||||||
seq_id=get_model("sequence").find_sequence(type="clinic_hdcase")
|
seq_id=get_model("sequence").find_sequence(type="clinic_hdcase",context=context)
|
||||||
num=get_model("sequence").get_next_number(seq_id,context=context)
|
num=get_model("sequence").get_next_number(seq_id,context=context)
|
||||||
if not num:
|
if not num:
|
||||||
return None
|
return None
|
||||||
|
@ -1500,7 +1500,7 @@ class HDCase(Model):
|
||||||
#break
|
#break
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
def create(self,vals,**kw):
|
def create(self,vals,context):
|
||||||
patient_id=vals['patient_id']
|
patient_id=vals['patient_id']
|
||||||
if 'vascular_acc' in vals.keys():
|
if 'vascular_acc' in vals.keys():
|
||||||
patient=get_model("clinic.patient").browse(patient_id)
|
patient=get_model("clinic.patient").browse(patient_id)
|
||||||
|
@ -1509,7 +1509,7 @@ class HDCase(Model):
|
||||||
})
|
})
|
||||||
vals=self.get_staff_line(vals,patient_id)
|
vals=self.get_staff_line(vals,patient_id)
|
||||||
vals=self.get_hct(vals,patient_id)
|
vals=self.get_hct(vals,patient_id)
|
||||||
new_id=super().create(vals,**kw)
|
new_id=super().create(vals,context)
|
||||||
self.function_store([new_id])
|
self.function_store([new_id])
|
||||||
return new_id
|
return new_id
|
||||||
|
|
||||||
|
|
|
@ -69,14 +69,16 @@ class Sequence(Model):
|
||||||
user=get_model('base.user').browse(user_id)
|
user=get_model('base.user').browse(user_id)
|
||||||
dpt=user.department_id
|
dpt=user.department_id
|
||||||
branch=user.branch_id
|
branch=user.branch_id
|
||||||
if dpt:
|
if context.get('branch_id'):
|
||||||
|
comp_dom=comp_dom+[["branch_id","=",context['branch_id']]]
|
||||||
|
elif dpt:
|
||||||
branch_id=dpt.branch_id.id
|
branch_id=dpt.branch_id.id
|
||||||
comp_dom=comp_dom+[["branch_id","=",branch_id]]
|
comp_dom=comp_dom+[["branch_id","=",branch_id]]
|
||||||
elif branch:
|
elif branch:
|
||||||
branch_id=branch.id
|
branch_id=branch.id
|
||||||
comp_dom=comp_dom+[["branch_id","=",branch_id]]
|
comp_dom=comp_dom+[["branch_id","=",branch_id]]
|
||||||
elif context.get('branch_id'):
|
#elif context.get('branch_id'):
|
||||||
comp_dom=comp_dom+[["branch_id","=",context['branch_id']]]
|
#comp_dom=comp_dom+[["branch_id","=",context['branch_id']]]
|
||||||
print('com_dom ', comp_dom)
|
print('com_dom ', comp_dom)
|
||||||
res=self.search(comp_dom,order="id")
|
res=self.search(comp_dom,order="id")
|
||||||
if res:
|
if res:
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Visit(Model):
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
while 1:
|
while 1:
|
||||||
seq_type='clinic_visit'
|
seq_type='clinic_visit'
|
||||||
seq_id=get_model("sequence").find_sequence(type=seq_type)
|
seq_id=get_model("sequence").find_sequence(type=seq_type,context=context)
|
||||||
if not seq_id:
|
if not seq_id:
|
||||||
raise Exception("Can not found sequence %s"%seq_type)
|
raise Exception("Can not found sequence %s"%seq_type)
|
||||||
num=get_model("sequence").get_next_number(seq_id,context=context)
|
num=get_model("sequence").get_next_number(seq_id,context=context)
|
||||||
|
@ -206,7 +206,7 @@ class Visit(Model):
|
||||||
hd_case.write(vals)
|
hd_case.write(vals)
|
||||||
hd_case_id=hd_case.id
|
hd_case_id=hd_case.id
|
||||||
else:
|
else:
|
||||||
hd_case_id=hd_case_obj.create(vals)
|
hd_case_id=hd_case_obj.create(vals,context)
|
||||||
|
|
||||||
if context.get("called"): #XXX call outside
|
if context.get("called"): #XXX call outside
|
||||||
return hd_case_id
|
return hd_case_id
|
||||||
|
@ -476,8 +476,8 @@ class Visit(Model):
|
||||||
'flash': 'Visit\'s %s has been cancelled'%obj.patient_id.name
|
'flash': 'Visit\'s %s has been cancelled'%obj.patient_id.name
|
||||||
}
|
}
|
||||||
|
|
||||||
def create(self, vals,**kw):
|
def create(self, vals,context):
|
||||||
new_id=super().create(vals,**kw)
|
new_id=super().create(vals,context)
|
||||||
self.function_store([new_id])
|
self.function_store([new_id])
|
||||||
return new_id
|
return new_id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue