Skip to content

Commit

Permalink
Fix content filter for batch samples
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonski committed Feb 12, 2025
1 parent a55d09c commit f2eb123
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
15 changes: 5 additions & 10 deletions src/bika/lims/browser/batch/analysisrequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@
# Copyright 2018-2024 by it's authors.
# Some rights reserved, see README and LICENSE.

from bika.lims import api
from bika.lims.browser.analysisrequest import AnalysisRequestsView as BaseView
# flake8: noqa

from senaite.core.browser.batches.samples import \
SamplesView as AnalysisRequestsView
from zope import deprecation

class AnalysisRequestsView(BaseView):

def __init__(self, context, request):
super(AnalysisRequestsView, self).__init__(context, request)
self.contentFilter = {"portal_type": "AnalysisRequest",
"getBatchUID": api.get_uid(self.context),
"sort_on": "created",
"sort_order": "reverse"}
deprecation.deprecated("AnalysisRequestsView", "Moved to senaite.core.browser.batches.samples.SamplesView")
8 changes: 0 additions & 8 deletions src/bika/lims/browser/batch/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="senaite.core">

<browser:page
for="bika.lims.interfaces.IBatch"
name="analysisrequests"
class="bika.lims.browser.batch.analysisrequests.AnalysisRequestsView"
permission="zope2.View"
layer="bika.lims.interfaces.IBikaLIMS"
/>

<browser:page
for="bika.lims.interfaces.IBatch"
name="batchbook"
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions src/senaite/core/browser/batches/configure.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">

<browser:page
for="bika.lims.interfaces.IBatch"
name="analysisrequests"
class=".samples.SamplesView"
permission="zope2.View"
layer="senaite.core.interfaces.ISenaiteCore"
/>

</configure>
19 changes: 19 additions & 0 deletions src/senaite/core/browser/batches/samples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

from bika.lims import api
from senaite.core.browser.samples.view import SamplesView as BaseView


class SamplesView(BaseView):
"""Samples listing inside Batches
"""

def __init__(self, context, request):
super(SamplesView, self).__init__(context, request)
self.contentFilter = {
"portal_type": "AnalysisRequest",
"getBatchUID": api.get_uid(self.context),
"sort_on": "created",
"sort_order": "reverse",
"isRootAncestor": True, # only root ancestors
}
1 change: 1 addition & 0 deletions src/senaite/core/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<!-- Package includes -->
<include package=".attachment"/>
<include package=".batches"/>
<include package=".batching"/>
<include package=".bootstrap"/>
<include package=".clients"/>
Expand Down

0 comments on commit f2eb123

Please sign in to comment.