show department name
parent
3f9379d562
commit
19489e8ff5
|
@ -120,3 +120,4 @@ from . import base_user
|
|||
from . import select_company
|
||||
from . import name_title
|
||||
from . import compute_labor_cost
|
||||
from . import login
|
||||
|
|
|
@ -88,7 +88,7 @@ class Department(Model):
|
|||
['clinic.cycle.item','department_id.code','='],
|
||||
['clinic.sickbed','department_id.code','='],
|
||||
['clinic.shop','department_id.code','='],
|
||||
#['clinic.department','code','='],
|
||||
['clinic.department','code','='], #XXX
|
||||
['clinic.dialyzer','department_id.code','='],
|
||||
['clinic.schedule','department_id.code','='],
|
||||
]
|
||||
|
|
|
@ -3,8 +3,7 @@ import time
|
|||
from datetime import datetime, timedelta
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.utils import get_data_path, get_file_path
|
||||
from netforce.access import get_active_user,set_active_user
|
||||
from netforce.access import get_active_company
|
||||
from netforce.access import get_active_user,set_active_user, get_active_company
|
||||
from . import utils
|
||||
|
||||
class HDCase(Model):
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
from netforce.model import Model, get_model
|
||||
from netforce.access import get_active_user
|
||||
|
||||
class Login(Model):
|
||||
_inherit="login"
|
||||
|
||||
def login(self,context={}):
|
||||
res=super().login(context=context)
|
||||
cookies=res['cookies']
|
||||
user_id=get_active_user()
|
||||
user=get_model('base.user').browse(user_id)
|
||||
department=user.department_id
|
||||
if department:
|
||||
cookies['company_name']='%s (%s)'%(cookies['company_name'], department.name or "")
|
||||
return res
|
||||
|
||||
Login.register()
|
|
@ -109,7 +109,9 @@ class SelectCompany(Model):
|
|||
user_id=get_active_user()
|
||||
user=get_model("base.user").browse(user_id)
|
||||
dpt_profile=user.department_profile_id
|
||||
set_active_user(1) #XXX
|
||||
dpt_codes=[dpt.code for dpt in dpt_profile.departments]
|
||||
set_active_user(user_id)
|
||||
exist_model=[]
|
||||
for obj in self.browse(ids):
|
||||
for sa in get_model('share.access').search_browse([]):
|
||||
|
@ -143,7 +145,9 @@ class SelectCompany(Model):
|
|||
return
|
||||
user=get_model('base.user').browse(user_id)
|
||||
obj=self.browse(ids)[0]
|
||||
department_name=''
|
||||
if obj.department:
|
||||
department_name=obj.department
|
||||
# set to main profile of that user
|
||||
for dpt in get_model("clinic.department").search_browse([["name","=",obj.department]]):
|
||||
user.write({
|
||||
|
@ -166,6 +170,10 @@ class SelectCompany(Model):
|
|||
'profile_id': pf_id,
|
||||
})
|
||||
res=super().select(ids,context)
|
||||
if department_name:
|
||||
cookies=res.get("cookies")
|
||||
if cookies:
|
||||
cookies['company_name']='%s (%s)'%(cookies['company_name'], department_name)
|
||||
return res
|
||||
|
||||
def get_select(self,context={}):
|
||||
|
|
|
@ -28,7 +28,7 @@ class Shop(Model):
|
|||
|
||||
_fields={
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"ref": fields.Char("Ref",search=True),
|
||||
"ref": fields.Char("Customer Name",search=True),
|
||||
'date': fields.Date("Date",search=True),
|
||||
'patient_id': fields.Many2One('clinic.patient','Patient',search=True,domain=[['state','=','admit']]),
|
||||
'contact_id': fields.Many2One('partner','Contact',search=True),
|
||||
|
|
Loading…
Reference in New Issue