diff --git a/src/bika/lims/browser/batchfolder.py b/src/bika/lims/browser/batchfolder.py index c44bcc8c6d..3ca8432131 100644 --- a/src/bika/lims/browser/batchfolder.py +++ b/src/bika/lims/browser/batchfolder.py @@ -83,6 +83,8 @@ def __init__(self, context, request): ("ClientBatchID", { "title": _("Client Batch ID"), "index": "getClientBatchID", }), + ("getNumberOfSamples", { + "title": _("Samples"), }), ("state_title", { "title": _("State"), "sortable": False, }), @@ -206,6 +208,9 @@ def folderitem(self, obj, item, index): item["BatchDate"] = self.ulocalized_time(date, long_format=True) item["BatchLabels"] = "" + item["getNumberOfSamples"] = str( + obj.getNumberOfSamples()) + if batch_labels: item["BatchLabels"] = ",".join(batch_labels) item["replace"]["BatchLabels"] = "".join(map( diff --git a/src/bika/lims/content/batch.py b/src/bika/lims/content/batch.py index 833022ab62..89bd35ab5e 100644 --- a/src/bika/lims/content/batch.py +++ b/src/bika/lims/content/batch.py @@ -270,5 +270,14 @@ def getProgress(self): total_progress = sum(sample_progresses) / total return total_progress + def getNumberOfSamples(self): + """ + Returns the number of samples. + :returns: number of samples + :rtype: integer + """ + samples = self.getAnalysisRequests() + return len(samples) + registerType(Batch, PROJECTNAME)