run script
parent
c3760db0e0
commit
c84fc31946
|
@ -161,21 +161,8 @@ class ClinicSetting(Model):
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
categ_ids=get_model('product.categ').search([['parent_id.code','=','MDC']])
|
obj=self.browse(ids)[0]
|
||||||
for prod in get_model("product").search_browse([['categ_id','in',categ_ids]]):
|
obj.merge_staff()
|
||||||
prod.write({
|
|
||||||
'report_visible': True,
|
|
||||||
})
|
|
||||||
#for dt in get_model("district").search_browse([]):
|
|
||||||
#name=(dt.name or "")[0:1]
|
|
||||||
#dt.write({
|
|
||||||
#'sort_name': name,
|
|
||||||
#})
|
|
||||||
#for sdt in get_model("subdistrict").search_browse([]):
|
|
||||||
#name=(sdt.name or "")[0:1]
|
|
||||||
#sdt.write({
|
|
||||||
#'sort_name': name,
|
|
||||||
#})
|
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
def merge_staff(self,ids,context={}):
|
def merge_staff(self,ids,context={}):
|
||||||
|
|
|
@ -75,6 +75,7 @@ class Staff(Model):
|
||||||
name=''
|
name=''
|
||||||
title_name=''
|
title_name=''
|
||||||
title=obj.title_id
|
title=obj.title_id
|
||||||
|
name_check=""
|
||||||
if title:
|
if title:
|
||||||
title_name=title.name or ""
|
title_name=title.name or ""
|
||||||
title_name=title_name.replace(" ","")
|
title_name=title_name.replace(" ","")
|
||||||
|
@ -82,15 +83,15 @@ class Staff(Model):
|
||||||
name+=obj.title_id.name or ""
|
name+=obj.title_id.name or ""
|
||||||
if obj.first_name:
|
if obj.first_name:
|
||||||
name+=obj.first_name or ""
|
name+=obj.first_name or ""
|
||||||
|
name_check+=obj.first_name or ""
|
||||||
name+=" "
|
name+=" "
|
||||||
if obj.last_name:
|
if obj.last_name:
|
||||||
name+=obj.last_name or ""
|
name+=obj.last_name or ""
|
||||||
|
name_check+=obj.last_name or ""
|
||||||
if not obj.active:
|
if not obj.active:
|
||||||
name+='__'
|
name+='__'
|
||||||
elif context.get('active'):
|
elif context.get('active'):
|
||||||
name+='__'
|
name+='__'
|
||||||
name_check=name.replace(" ","")
|
|
||||||
name_check=name_check.replace(title_name,"")
|
|
||||||
res[obj.id]={
|
res[obj.id]={
|
||||||
'name': name,
|
'name': name,
|
||||||
'name_check': name_check, # remove all space for make sure
|
'name_check': name_check, # remove all space for make sure
|
||||||
|
|
Loading…
Reference in New Issue