From c84fc31946f2cda1d235a1ed2b87f739533c1f2b Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 24 Jun 2015 18:02:34 +0700 Subject: [PATCH] run script --- netforce_clinic/models/setting.py | 17 ++--------------- netforce_clinic/models/staff.py | 5 +++-- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 2aaad60..5867964 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -161,21 +161,8 @@ class ClinicSetting(Model): if user_id !=1: print("Only admin!!") return - categ_ids=get_model('product.categ').search([['parent_id.code','=','MDC']]) - for prod in get_model("product").search_browse([['categ_id','in',categ_ids]]): - 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, - #}) + obj=self.browse(ids)[0] + obj.merge_staff() print("Done!") def merge_staff(self,ids,context={}): diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py index dd5c08e..8502be9 100644 --- a/netforce_clinic/models/staff.py +++ b/netforce_clinic/models/staff.py @@ -75,6 +75,7 @@ class Staff(Model): name='' title_name='' title=obj.title_id + name_check="" if title: title_name=title.name or "" title_name=title_name.replace(" ","") @@ -82,15 +83,15 @@ class Staff(Model): name+=obj.title_id.name or "" if obj.first_name: name+=obj.first_name or "" + name_check+=obj.first_name or "" name+=" " if obj.last_name: name+=obj.last_name or "" + name_check+=obj.last_name or "" if not obj.active: name+='__' elif context.get('active'): name+='__' - name_check=name.replace(" ","") - name_check=name_check.replace(title_name,"") res[obj.id]={ 'name': name, 'name_check': name_check, # remove all space for make sure