Skip to content

Commit 314f80b

Browse files
authored
Fix wrong context in reference widget lookups (senaite#1917)
* Use absolute context url for reference widget lookups * Changelog updated
1 parent 8a1f37c commit 314f80b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES.rst

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Changelog
44
2.2.0 (unreleased)
55
------------------
66

7+
- #1917 Fix wrong context in reference widget lookups
78
- #1916 Provide the request record to object info adapters in the sample add form
89
- #1913 Ported PR #1865 for dexterity contents
910
- #1915 Support list queries in dx reference widget

src/senaite/core/browser/widgets/referencewidget.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,14 @@ def get_combogrid_options(self, context, fieldName):
100100
colModel = self.colModel
101101
if "UID" not in [x["columnName"] for x in colModel]:
102102
colModel.append({"columnName": "UID", "hidden": True})
103+
104+
# ensure we have an absolute url for the current context
105+
url = api.get_url(context)
106+
search_path = self.url.split(url)[-1]
107+
search_url = "/".join([url, search_path])
108+
103109
options = {
104-
"url": self.url,
110+
"url": search_url,
105111
"colModel": colModel,
106112
"showOn": self.showOn,
107113
"width": self.popup_width,

0 commit comments

Comments
 (0)