clinic/netforce_clinic/models/login.py

18 lines
520 B
Python

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()