From edfe2f20c89e835707878693b14884d983a1b683 Mon Sep 17 00:00:00 2001 From: Ramon Bartl Date: Fri, 9 Jun 2017 13:13:54 +0200 Subject: [PATCH 1/3] PEP8 for bika.lims.browser.batch.batchbook --- bika/lims/browser/batch/batchbook.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bika/lims/browser/batch/batchbook.py b/bika/lims/browser/batch/batchbook.py index 0c30c646eb..5728a63851 100644 --- a/bika/lims/browser/batch/batchbook.py +++ b/bika/lims/browser/batch/batchbook.py @@ -5,17 +5,20 @@ # Copyright 2011-2017 by it's authors. # Some rights reserved. See LICENSE.txt, AUTHORS.txt. +import re from operator import itemgetter + from AccessControl import getSecurityManager -from Products.CMFCore.permissions import ModifyPortalContent + from Products.CMFPlone import PloneMessageFactory +from Products.CMFCore.permissions import ModifyPortalContent + +from bika.lims import api from bika.lims import bikaMessageFactory as _ from bika.lims.browser.bika_listing import BikaListingView -from bika.lims.permissions import EditResults, AddAnalysisRequest, \ - ManageAnalysisRequests -from Products.CMFCore.utils import getToolByName - -import re +from bika.lims.permissions import EditResults +from bika.lims.permissions import AddAnalysisRequest +from bika.lims.permissions import ManageAnalysisRequests class BatchBookView(BikaListingView): @@ -25,7 +28,7 @@ def __init__(self, context, request): self.icon = self.portal_url + \ "/++resource++bika.lims.images/batchbook_big.png" self.context_actions = {} - self.contentFilter = {"sort_on":"created"} + self.contentFilter = {"sort_on": "created"} self.title = context.Title() self.Description = context.Description() self.show_select_all_checkbox = True @@ -88,7 +91,7 @@ def __init__(self, context, request): @property def copy_to_new_allowed(self): - mtool = getToolByName(self.context, 'portal_membership') + mtool = api.get_tool('portal_membership') if mtool.checkPermission(ManageAnalysisRequests, self.context) \ or mtool.checkPermission(ModifyPortalContent, self.context) \ or mtool.checkPermission(AddAnalysisRequest, self.portal): @@ -97,7 +100,7 @@ def copy_to_new_allowed(self): def __call__(self): # Allow "Modify portal content" to see edit widgets - mtool = getToolByName(self.context, 'portal_membership') + mtool = api.get_tool('portal_membership') self.allow_edit = mtool.checkPermission("Modify portal content", self.context) # Allow certain users to duplicate ARs (Copy to new). if self.copy_to_new_allowed: @@ -118,7 +121,7 @@ def folderitems(self): """Accumulate a list of all AnalysisRequest objects contained in this Batch, as well as those which are inherited. """ - wf = getToolByName(self.context, 'portal_workflow') + wf = api.get_tool('portal_workflow') schema = self.context.Schema() ars = [] From 6da865e367df2f9e915843ae09798ae31508d229 Mon Sep 17 00:00:00 2001 From: Ramon Bartl Date: Fri, 9 Jun 2017 15:50:22 +0200 Subject: [PATCH 2/3] Added title to custom_action This fixes #2063 --- bika/lims/browser/batch/batchbook.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bika/lims/browser/batch/batchbook.py b/bika/lims/browser/batch/batchbook.py index 5728a63851..ed081a302c 100644 --- a/bika/lims/browser/batch/batchbook.py +++ b/bika/lims/browser/batch/batchbook.py @@ -247,7 +247,10 @@ def folderitems(self): items[i]['class'][keyword] = 'empty' if self.insert_submit_button: custom_actions = self.review_states[0].get('custom_actions', []) - custom_actions.append({'id': 'submit'}) + custom_actions.append({ + 'id': 'submit', + 'title': _('Submit'), + }) self.review_states[0]['custom_actions'] = custom_actions self.categories.sort() From a7e0f5b5520a2fc9e80a1eb45b5b9dfe50c99309 Mon Sep 17 00:00:00 2001 From: Ramon Bartl Date: Fri, 9 Jun 2017 15:51:32 +0200 Subject: [PATCH 3/3] Updated Changelog --- docs/CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index a828752d5b..8c1a7c9800 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -1,6 +1,7 @@ 3.2.1b3 (unreleased) -------------------- +- Issue-2063: Batch Book raises an Error if the Batch inherits from 2 ARs - Issue-2062: Worksheet raises Error on `add_duplicate` view - Issue-2011: Client Folder Listing Table decreases Bika LIMS performance and is unusable for many Clients - Issue-2068: Member Discount is always applied on adding new ARs