Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit f2cd821

Browse files
committed
Don't display doctors from other clients in AR Add
Dependencies: senaite/senaite.core#1014 In AR Add form, do not display doctors from other client than the one selected, but include those that do not have any client assigned
1 parent 00b5c07 commit f2cd821

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

bika/health/browser/doctors/folder_view.py

+8-17
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
# Copyright 2018 by it's authors.
66
# Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.
77

8-
from Products.CMFCore.utils import getToolByName
8+
from collections import OrderedDict
99

10+
from Products.CMFCore.utils import getToolByName
1011
from bika.health import bikaMessageFactory as _
1112
from bika.health.permissions import *
1213
from bika.lims import api
1314
from bika.lims.browser.client import ClientContactsView
14-
from bika.lims.interfaces import IClient, ILabContact
15+
from bika.lims.interfaces import IClient
1516
from bika.lims.utils import get_link
1617
from plone.memoize import view as viewcache
17-
from collections import OrderedDict
18+
1819

1920
class DoctorsView(ClientContactsView):
2021

@@ -87,20 +88,10 @@ def __call__(self):
8788
def get_user_client_uid(self, default=None):
8889
"""Returns the id of the client the current user belongs to
8990
"""
90-
user = api.get_current_user()
91-
roles = user.getRoles()
92-
if 'Client' not in roles:
93-
return default
94-
95-
contact = api.get_user_contact(user)
96-
if not contact or ILabContact.providedBy(contact):
97-
return default
98-
99-
client = api.get_parent(contact)
100-
if not client or not IClient.providedBy(client):
101-
return default
102-
103-
return api.get_uid(client)
91+
client = api.get_current_client()
92+
if client:
93+
return api.get_uid(client)
94+
return default
10495

10596
def folderitem(self, obj, item, index):
10697
"""Applies new properties to the item to be rendered

0 commit comments

Comments
 (0)