Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-2063: Fixed Error in Batchbook View #2080

Merged
merged 3 commits into from
Jun 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions bika/lims/browser/batch/batchbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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:
Expand All @@ -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 = []
Expand Down Expand Up @@ -244,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()
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down