diff --git a/CHANGES.rst b/CHANGES.rst index d36bf7d20e..9a6513cd77 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -71,12 +71,12 @@ Changelog - #345 'SearchableText' field and adapter in Batches. - #348 Add Attachment objects to portal_catalog, to allow idserver to function correctly. - #352 Fix traceback on listings +- #353 Remove deprecation warnings - #364 Error on Manage Results view while Adding new Analyses from different Category - #365 Lims Installation fails during setting client permissions in bika setup. - #358 Merged updates for AR Add2 - #371 Reflex Rules don't have 'inactive_state' values set. - 1.0.0 (2017-10-13) ------------------ diff --git a/bika/lims/browser/aggregatedanalyses/aggregatedanalyses.py b/bika/lims/browser/aggregatedanalyses/aggregatedanalyses.py index 69c5feb4d1..1a91c7c70e 100644 --- a/bika/lims/browser/aggregatedanalyses/aggregatedanalyses.py +++ b/bika/lims/browser/aggregatedanalyses/aggregatedanalyses.py @@ -48,8 +48,8 @@ def __init__(self, context, request, **kwargs): self.columns['AnalysisRequest'] = { 'title': _('Analysis Request'), - 'attr': 'getAnalysisRequestTitle', - 'replace_url': 'getAnalysisRequestURL', + 'attr': 'getRequestTitle', + 'replace_url': 'getRequestURL', 'sortable': False } self.columns['Worksheet'] = { diff --git a/bika/lims/browser/analyses.py b/bika/lims/browser/analyses.py index 0aa40f2ad0..692b306b06 100644 --- a/bika/lims/browser/analyses.py +++ b/bika/lims/browser/analyses.py @@ -243,25 +243,6 @@ def ResultOutOfRange(self, analysis): # By default, not out of range return False - @deprecated('[1703] Orphan. No alternative') - def getAnalysisSpecsStr(self, spec): - """ - Generates a string representation of the specifications passed in. If - neither min nor max values found, returns an empty string - - :param spec: specifications dict, with 'min' and 'max' keys - :type spec: dict - :returns: a string representation of the passed in specs - :rtype: string - """ - if spec['min'] and spec['max']: - return '%s - %s' % (spec['min'], spec['max']) - if spec['min']: - return '> %s' % spec['min'] - if spec['max']: - return '< %s' % spec['max'] - return '' - def get_methods_vocabulary(self, analysis=None): """ Returns a vocabulary with all the methods available for the passed in diff --git a/bika/lims/browser/analysisrequest/analysisrequests.py b/bika/lims/browser/analysisrequest/analysisrequests.py index 322bd70284..c1abfeabbf 100644 --- a/bika/lims/browser/analysisrequest/analysisrequests.py +++ b/bika/lims/browser/analysisrequest/analysisrequests.py @@ -84,7 +84,7 @@ def __init__(self, context, request): 'title': 'Progress', 'sortable': False, 'toggle': True}, - 'getRequestID': { + 'getId': { 'title': _('Request ID'), 'attr': 'getId', 'replace_url': 'absolute_url', @@ -233,7 +233,7 @@ def __init__(self, context, request): 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', 'Progress', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -276,7 +276,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -316,7 +316,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -354,7 +354,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -398,7 +398,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -438,7 +438,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -480,7 +480,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -520,7 +520,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -555,7 +555,7 @@ def __init__(self, context, request): 'transitions': [{'id': 'republish'}], 'custom_transitions': [], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -601,7 +601,7 @@ def __init__(self, context, request): 'sort_order': 'reverse'}, 'transitions': [{'id': 'reinstate'}], 'custom_transitions': [], - 'columns': ['getRequestID', + 'columns': ['getId', 'getSample', 'BatchID', # 'SubGroup', @@ -640,7 +640,7 @@ def __init__(self, context, request): 'id': 'print_stickers', 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], - 'columns':['getRequestID', + 'columns':['getId', 'getSample', 'BatchID', # 'SubGroup', @@ -690,7 +690,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -741,7 +741,7 @@ def __init__(self, context, request): 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], 'columns': ['Priority', - 'getRequestID', + 'getId', 'getSample', 'BatchID', # 'SubGroup', @@ -780,7 +780,7 @@ def __init__(self, context, request): 'id': 'print_stickers', 'title': _('Print stickers'), 'url': 'workflow_action?action=print_stickers'}], - 'columns': ['getRequestID', + 'columns': ['getId', 'getSample', 'BatchID', # 'SubGroup', @@ -865,10 +865,10 @@ def folderitem(self, obj, item, index): priority_text = PRIORITIES.getValue(priority) priority_div = '
%s
' item['replace']['Priority'] = priority_div % (priority, priority_text) - item['getRequestID'] = obj.getId + item['getId'] = obj.getId url = obj.getURL() + "?check_edit=1" - item['replace']['getRequestID'] = "%s" % \ - (url, item['getRequestID']) + item['replace']['getId'] = "%s" % \ + (url, item['getId']) item['replace']['getProfilesTitle'] =\ ", ".join(obj.getProfilesTitleStr) @@ -962,7 +962,7 @@ def folderitem(self, obj, item, index): after_icons += "" % \ (self.portal_url, t(_("Hazardous"))) if after_icons: - item['after']['getRequestID'] = after_icons + item['after']['getId'] = after_icons item['Created'] = self.ulocalized_time(obj.created) if obj.getContactUID: diff --git a/bika/lims/browser/analysisrequest/invoice.py b/bika/lims/browser/analysisrequest/invoice.py index d5c722104b..6b6897d941 100644 --- a/bika/lims/browser/analysisrequest/invoice.py +++ b/bika/lims/browser/analysisrequest/invoice.py @@ -73,7 +73,7 @@ def __call__(self): self.clientSampleId = sample.getClientSampleID() self.sampleType = sample.getSampleType().Title() self.samplePoint = samplePoint and samplePoint.Title() - self.requestId = context.getRequestID() + self.requestId = context.getId() self.headers = [ {'title': 'Invoice ID', 'value': self.invoiceId}, {'title': 'Client Reference', diff --git a/bika/lims/browser/analysisrequest/log.py b/bika/lims/browser/analysisrequest/log.py index 03eca8e388..4a203195e3 100644 --- a/bika/lims/browser/analysisrequest/log.py +++ b/bika/lims/browser/analysisrequest/log.py @@ -20,7 +20,7 @@ def __call__(self): if workflow.getInfoFor(ar, 'review_state') == 'invalid': childar = hasattr(ar, 'getChildAnalysisRequest') \ and ar.getChildAnalysisRequest() or None - childid = childar and childar.getRequestID() or None + childid = childar and childar.getId() or None message = _('This Analysis Request has been withdrawn and is shown ' 'for trace-ability purposes only. Retest: ' '${retest_child_id}.', @@ -35,7 +35,7 @@ def __call__(self): 'generated automatically due to ' 'the retraction of the Analysis ' 'Request ${retracted_request_id}.', - mapping={'retracted_request_id': safe_unicode(par.getRequestID())}) + mapping={'retracted_request_id': safe_unicode(par.getId())}) self.context.plone_utils.addPortalMessage( t(message), 'info') template = LogView.__call__(self) diff --git a/bika/lims/browser/analysisrequest/manage_results.py b/bika/lims/browser/analysisrequest/manage_results.py index d6e03d60c7..bf601f12fa 100644 --- a/bika/lims/browser/analysisrequest/manage_results.py +++ b/bika/lims/browser/analysisrequest/manage_results.py @@ -37,7 +37,7 @@ def __call__(self): getPointOfCapture=poc, sort_on='title', show_categories=show_cats, - getAnalysisRequestUID=ar.UID()) + getRequestUID=ar.UID()) t.form_id = "ar_manage_results_%s" % poc t.allow_edit = True t.review_states[0]['transitions'] = [{'id': 'submit'}, diff --git a/bika/lims/browser/analysisrequest/publish.py b/bika/lims/browser/analysisrequest/publish.py index 755bc4276f..a4a14bd773 100644 --- a/bika/lims/browser/analysisrequest/publish.py +++ b/bika/lims/browser/analysisrequest/publish.py @@ -540,7 +540,7 @@ def get_mail_subject(self, ar): css = [] blanks_found = False if ai: - ais.append(ar.getRequestID()) + ais.append(ar.getId()) if co: if ar.getClientOrderNumber(): if not ar.getClientOrderNumber() in cos: @@ -1183,7 +1183,6 @@ def _sampler_data(self, sample=None): 'home_phone': contact.getHomePhone() if contact else '', 'mobile_phone': contact.getMobilePhone() if contact else '', 'job_title': to_utf8(contact.getJobTitle()) if contact else '', - 'department': to_utf8(contact.getDepartment()) if contact else '', 'physical_address': physical_address, 'postal_address': postal_address, 'home_page': to_utf8(mhomepage)} @@ -1280,7 +1279,7 @@ def _analyses_data(self, ar, analysis_states=None): showhidden = self.isHiddenAnalysesVisible() catalog = get_tool(CATALOG_ANALYSIS_LISTING) - brains = catalog({'getAnalysisRequestUID': ar.UID(), + brains = catalog({'getRequestUID': ar.UID(), 'review_state': analysis_states, 'sort_on': 'sortable_title'}) for brain in brains: @@ -1569,4 +1568,4 @@ def _format_address(address): keys = ['address', 'city', 'district', 'state', 'zip', 'country'] addr = ''.join(["%s" % address.get(v) for v in keys if address.get(v, None)]) - return "
%s
" % addr \ No newline at end of file + return "
%s
" % addr diff --git a/bika/lims/browser/analysisrequest/published_results.py b/bika/lims/browser/analysisrequest/published_results.py index 407fd1f7bf..28c0c055b7 100644 --- a/bika/lims/browser/analysisrequest/published_results.py +++ b/bika/lims/browser/analysisrequest/published_results.py @@ -68,7 +68,7 @@ def __call__(self): if workflow.getInfoFor(ar, 'review_state') == 'invalid': childar = hasattr(ar, 'getChildAnalysisRequest') \ and ar.getChildAnalysisRequest() or None - childid = childar and childar.getRequestID() or None + childid = childar and childar.getId() or None message = _('This Analysis Request has been withdrawn and is ' 'shown for trace-ability purposes only. Retest: ' '${retest_child_id}.', @@ -84,7 +84,7 @@ def __call__(self): 'generated automatically due to ' 'the retraction of the Analysis ' 'Request ${retracted_request_id}.', - mapping={'retracted_request_id': par.getRequestID()}) + mapping={'retracted_request_id': par.getId()}) self.context.plone_utils.addPortalMessage( self.context.translate(message), 'info') diff --git a/bika/lims/browser/analysisrequest/results_not_requested.py b/bika/lims/browser/analysisrequest/results_not_requested.py index 87822f0fcf..5013e21816 100644 --- a/bika/lims/browser/analysisrequest/results_not_requested.py +++ b/bika/lims/browser/analysisrequest/results_not_requested.py @@ -32,7 +32,7 @@ def __call__(self): if workflow.getInfoFor(ar, 'review_state') == 'invalid': childar = hasattr(ar, 'getChildAnalysisRequest') \ and ar.getChildAnalysisRequest() or None - childid = childar and childar.getRequestID() or None + childid = childar and childar.getId() or None message = _('This Analysis Request has been withdrawn and is shown ' 'for trace-ability purposes only. Retest: ${retest_child_id}.', mapping={"retest_child_id":childid if childid else ''}) @@ -46,7 +46,7 @@ def __call__(self): message = _( 'This Analysis Request has been generated automatically due to ' 'the retraction of the Analysis Request ${retracted_request_id}.', - mapping={"retracted_request_id": par.getRequestID()}) + mapping={"retracted_request_id": par.getId()}) self.context.plone_utils.addPortalMessage(message, 'info') can_do = getSecurityManager().checkPermission(ResultsNotRequested, ar) diff --git a/bika/lims/browser/analysisrequest/view.py b/bika/lims/browser/analysisrequest/view.py index a89b191295..19446a6852 100644 --- a/bika/lims/browser/analysisrequest/view.py +++ b/bika/lims/browser/analysisrequest/view.py @@ -88,7 +88,7 @@ def __call__(self): self.request, getPointOfCapture=poc, show_categories=self.context.bika_setup.getCategoriseAnalysisServices(), - getAnalysisRequestUID=self.context.UID()) + getRequestUID=self.context.UID()) t.allow_edit = True t.form_id = "%s_analyses" % poc t.review_states[0]['transitions'] = [{'id': 'submit'}, @@ -140,7 +140,7 @@ def __call__(self): 'listed here for trace-ability purposes. Please follow ' 'the link to the retest') if childar: - message = (message + " %s.") % childar.getRequestID() + message = (message + " %s.") % childar.getId() else: message = message + "." self.addMessage(message, 'warning') @@ -153,7 +153,7 @@ def __call__(self): 'generated automatically due to ' 'the retraction of the Analysis ' 'Request ${retracted_request_id}.', - mapping={'retracted_request_id': par.getRequestID()}) + mapping={'retracted_request_id': par.getId()}) self.addMessage(message, 'info') self.renderMessages() return self.template() @@ -314,7 +314,7 @@ def SelectedServices(self): bac = getToolByName(self.context, 'bika_analysis_catalog') res = [] for analysis in bac(portal_type="Analysis", - getRequestID=self.context.RequestID): + getRequestID=self.context.getId()): analysis = analysis.getObject() res.append([analysis.getPointOfCapture(), analysis.getCategoryUID(), @@ -458,7 +458,7 @@ def get_custom_fields(self): if workflow.getInfoFor(ar, 'review_state') == 'invalid': childar = hasattr(ar, 'getChildAnalysisRequest') \ and ar.getChildAnalysisRequest() or None - anchor = childar and ("%s" % (childar.absolute_url(), childar.getRequestID())) or None + anchor = childar and ("%s" % (childar.absolute_url(), childar.getId())) or None if anchor: custom['ChildAR'] = { 'title': t(_("AR for retested results")), @@ -469,7 +469,7 @@ def get_custom_fields(self): if hasattr(ar, 'getParentAnalysisRequest') \ and ar.getParentAnalysisRequest(): par = ar.getParentAnalysisRequest() - anchor = "%s" % (par.absolute_url(), par.getRequestID()) + anchor = "%s" % (par.absolute_url(), par.getId()) custom['ParentAR'] = { 'title': t(_("Invalid AR retested")), 'value': anchor diff --git a/bika/lims/browser/analysisrequest/workflow.py b/bika/lims/browser/analysisrequest/workflow.py index 9eaabe2b42..d26da23b76 100644 --- a/bika/lims/browser/analysisrequest/workflow.py +++ b/bika/lims/browser/analysisrequest/workflow.py @@ -66,7 +66,7 @@ def notify_ar_retract(self, ar, newar): lab_address = "
".join(laboratory.getPrintAddress()) mime_msg = MIMEMultipart('related') mime_msg['Subject'] = t(_("Erroneus result publication from ${request_id}", - mapping={"request_id": ar.getRequestID()})) + mapping={"request_id": ar.getId()})) mime_msg['From'] = formataddr( (encode_header(laboratory.getName()), laboratory.getEmailAddress())) @@ -92,9 +92,9 @@ def notify_ar_retract(self, ar, newar): to.append(formatted) mime_msg['To'] = ','.join(to) aranchor = "%s" % (ar.absolute_url(), - ar.getRequestID()) + ar.getId()) naranchor = "%s" % (newar.absolute_url(), - newar.getRequestID()) + newar.getId()) addremarks = ('addremarks' in self.request and ar.getRemarks()) and ("

" + _("Additional remarks:") + "
" + ar.getRemarks().split("===")[1].strip() + "

") or '' @@ -578,7 +578,7 @@ def workflow_action_retract_ar(self): self.notify_ar_retract(ar, newar) message = _('${items} invalidated.', - mapping={'items': ar.getRequestID()}) + mapping={'items': ar.getId()}) self.context.plone_utils.addPortalMessage(message, 'warning') self.request.response.redirect(newar.absolute_url()) diff --git a/bika/lims/browser/batch/publish.py b/bika/lims/browser/batch/publish.py index f129810145..6d71d28f10 100644 --- a/bika/lims/browser/batch/publish.py +++ b/bika/lims/browser/batch/publish.py @@ -110,7 +110,7 @@ def __call__(self): _("Analyst"): self.user_fullname(analysis.getAnalyst()), _("Remarks"): analysis.getRemarks()}) self.ars.append({ - _("Request ID"): ar.getRequestID(), + _("Request ID"): ar.getId(), _("Date Requested"): self.ulocalized_time(datecreated), # requested->created _("Sample Type"): sample.getSampleType() and sample.getSampleType().Title() or '', _("Sample Point"): sample.getSamplePoint() and sample.getSamplePoint().Title() or '', diff --git a/bika/lims/browser/late_analyses.py b/bika/lims/browser/late_analyses.py index 638de9081b..949a6307f7 100644 --- a/bika/lims/browser/late_analyses.py +++ b/bika/lims/browser/late_analyses.py @@ -43,8 +43,8 @@ def __init__(self, context, request): self.columns = {'Analysis': {'title': _('Analysis'), 'index': 'sortable_title'}, - 'RequestID': {'title': _('Request ID'), - 'index': 'getRequestID'}, + 'getRequestID': {'title': _('Request ID'), + 'index': 'getRequestID'}, 'Client': {'title': _('Client')}, 'Contact': {'title': _('Contact')}, 'DateReceived': {'title': _('Date Received'), @@ -59,7 +59,7 @@ def __init__(self, context, request): 'title': _('All'), 'contentFilter':{}, 'columns':['Analysis', - 'RequestID', + 'getRequestID', 'Client', 'Contact', 'DateReceived', @@ -87,8 +87,8 @@ def folderitems(self): client = ar.aq_parent contact = ar.getContact() items[x]['Analysis'] = obj.Title() - items[x]['RequestID'] = '' - items[x]['replace']['RequestID'] = "%s" % \ + items[x]['getRequestID'] = '' + items[x]['replace']['getRequestID'] = "%s" % \ (ar.absolute_url(), ar.Title()) items[x]['Client'] = '' if hideclientlink == False: diff --git a/bika/lims/browser/referenceanalysis.py b/bika/lims/browser/referenceanalysis.py index 9e01c50a3a..9aa5468957 100644 --- a/bika/lims/browser/referenceanalysis.py +++ b/bika/lims/browser/referenceanalysis.py @@ -5,26 +5,22 @@ # Copyright 2011-2016 by it's authors. # Some rights reserved. See LICENSE.txt, AUTHORS.txt. +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText from email.utils import formataddr from smtplib import SMTPRecipientsRefused from smtplib import SMTPServerDisconnected -from email.mime.multipart import MIMEMultipart -from email.mime.text import MIMEText -import tempfile -from bika.lims import bikaMessageFactory as _ -from bika.lims.utils import t -from bika.lims.interfaces import IResultOutOfRange -from bika.lims.utils import to_utf8 -from bika.lims.browser import BrowserView -from Products.CMFCore.utils import getToolByName from Products.CMFCore.WorkflowCore import WorkflowException -from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile -from bika.lims.utils import encode_header, createPdf -from os.path import join +from Products.CMFCore.utils import getToolByName from Products.CMFPlone.utils import safe_unicode -from bika.lims.utils import tmpID -import Globals +from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile +from bika.lims import bikaMessageFactory as _ +from bika.lims.browser import BrowserView +from bika.lims.interfaces import IResultOutOfRange +from bika.lims.interfaces.analysis import IRequestAnalysis +from bika.lims.utils import createPdf, encode_header +from bika.lims.utils import t from zope.component import getAdapters @@ -183,15 +179,17 @@ def getData(self): 'an_id': an.id, 'an_title': an.Title()} - if an.aq_parent and an.aq_parent.portal_type == 'AnalysisRequest': - item['ar'] = an.aq_parent - item['ar_url'] = an.aq_parent.absolute_url() - item['ar_id'] = an.aq_parent.getRequestID() - item['ar_html'] = "%s" \ - % (item['ar_url'], item['ar_id']) + if IRequestAnalysis.providedBy(an): + ar = an.getRequest() + item['ar'] = ar + item['ar_url'] = ar.absolute_url() + item['ar_id'] = ar.getId() + item['ar_html'] = \ + "%s" % (item['ar_url'], item['ar_id']) + ws = an.getBackReferences("WorksheetAnalysis") if ws and len(ws) > 0: - ws = ws[0] + wss = ws[0] item['ws'] = ws item['ws_url'] = ws.absolute_url() item['ws_id'] = ws.id diff --git a/bika/lims/browser/reports/administration_arsnotinvoiced.py b/bika/lims/browser/reports/administration_arsnotinvoiced.py index 47d55d93d6..e042b12b73 100644 --- a/bika/lims/browser/reports/administration_arsnotinvoiced.py +++ b/bika/lims/browser/reports/administration_arsnotinvoiced.py @@ -90,7 +90,7 @@ def __call__(self): dataitem = {'value': ar.aq_parent.Title()} dataline.append(dataitem) - dataitem = {'value': ar.getRequestID()} + dataitem = {'value': ar.getId()} dataline.append(dataitem) dataitem = {'value': ar.getSampleTypeTitle()} diff --git a/bika/lims/browser/reports/productivity_dataentrydaybook.py b/bika/lims/browser/reports/productivity_dataentrydaybook.py index 18cf4bd2a9..64d81ed83a 100644 --- a/bika/lims/browser/reports/productivity_dataentrydaybook.py +++ b/bika/lims/browser/reports/productivity_dataentrydaybook.py @@ -66,7 +66,7 @@ def __call__(self): anlcount = len(ar.getAnalyses()) dataline = { - "AnalysisRequestID": ar.getRequestID(), + "AnalysisRequestID": ar.getId(), "DateCreated": self.ulocalized_time(datecreated), "DateReceived": self.ulocalized_time(datereceived), "DatePublished": self.ulocalized_time(datepublished), @@ -82,7 +82,7 @@ def __call__(self): "Remarks": ar.getRemarks() } - datalines[ar.getRequestID()] = dataline + datalines[ar.getId()] = dataline totalreceivedcount += ar.getDateReceived() and 1 or 0 totalpublishedcount += 1 if datepublished else 0 diff --git a/bika/lims/browser/samplinground/analysisrequests.py b/bika/lims/browser/samplinground/analysisrequests.py index 4eb07d5399..f9b6092577 100644 --- a/bika/lims/browser/samplinground/analysisrequests.py +++ b/bika/lims/browser/samplinground/analysisrequests.py @@ -30,7 +30,7 @@ def __init__(self, context, request): 'toggle': True}, 'samplingRoundTemplate': {'title': _('Sampling Round Template'), 'toggle': True}, - 'getRequestID': {'title': _('Request ID'), + 'getId': {'title': _('Request ID'), 'index': 'getId'}, 'getSample': {'title': _("Sample"), 'toggle': True, }, @@ -66,7 +66,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -86,7 +86,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -102,7 +102,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -120,7 +120,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -134,7 +134,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -148,7 +148,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -166,7 +166,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -180,7 +180,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -205,7 +205,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', @@ -231,7 +231,7 @@ def __init__(self, context, request): 'custom_transitions': [], 'columns': ['partition', 'securitySealIntact', - 'getRequestID', + 'getId', 'samplingRoundTemplate', 'getSample', 'getDateSampled', diff --git a/bika/lims/browser/worksheet/ajax.py b/bika/lims/browser/worksheet/ajax.py index 6675d47b8b..2ea1144e7f 100644 --- a/bika/lims/browser/worksheet/ajax.py +++ b/bika/lims/browser/worksheet/ajax.py @@ -4,7 +4,7 @@ # # Copyright 2011-2016 by it's authors. # Some rights reserved. See LICENSE.txt, AUTHORS.txt. - +from bika.lims import logger from bika.lims.utils import t from operator import itemgetter from Products.Archetypes.config import REFERENCE_CATALOG @@ -14,6 +14,8 @@ import plone.protect import json +from bika.lims.workflow import getCurrentState + class GetServices(): """ When a Category is selected in the add_analyses search screen, this @@ -63,15 +65,10 @@ def __call__(self): analyses.append(i) rows = [] for analysis in analyses: - review_state = wf.getInfoFor(analysis, 'review_state', '') - if analysis.portal_type in ('Analysis', 'DuplicateAnalysis'): - if review_state not in attachable_states: - continue - parent = analysis.getRequestID() - elif analysis.portal_type == 'ReferenceAnalysis': - if review_state not in attachable_states: - continue - parent = analysis.aq_parent.Title() + review_state = getCurrentState(analysis) + if review_state not in attachable_states: + continue + parent = analysis.getParentTitle() rows.append({'analysis_uid': analysis.UID(), 'slot': analysis_to_slot[analysis.UID()], 'service': analysis.Title(), diff --git a/bika/lims/browser/worksheet/views/add_analyses.py b/bika/lims/browser/worksheet/views/add_analyses.py index 52e386f340..7f97ef9df8 100644 --- a/bika/lims/browser/worksheet/views/add_analyses.py +++ b/bika/lims/browser/worksheet/views/add_analyses.py @@ -64,11 +64,11 @@ def __init__(self, context, request): 'getClientOrderNumber': { 'title': _('Order'), 'index': 'getClientOrderNumber'}, - 'getRequestID': { + 'getId': { 'title': _('Request ID'), - 'attr': 'getRequestID', - 'replace_url': 'getAnalysisRequestURL', - 'index': 'getRequestID'}, + 'attr': 'getId', + 'replace_url': 'getRequestURL', + 'index': 'getId'}, 'CategoryTitle': { 'title': _('Category'), 'attr': 'getCategoryTitle', @@ -92,7 +92,7 @@ def __init__(self, context, request): 'columns':['Priority', 'Client', 'getClientOrderNumber', - 'getRequestID', + 'getId', 'CategoryTitle', 'Title', 'getDateReceived', diff --git a/bika/lims/browser/worksheet/views/printview.py b/bika/lims/browser/worksheet/views/printview.py index 65455d4024..8e54cb27de 100644 --- a/bika/lims/browser/worksheet/views/printview.py +++ b/bika/lims/browser/worksheet/views/printview.py @@ -510,7 +510,7 @@ def _ar_data(self, ar): if ar.portal_type == "AnalysisRequest": return {'obj': ar, - 'id': ar.getRequestID(), + 'id': ar.getId(), 'date_received': self.ulocalized_time( ar.getDateReceived(), long_format=0), 'date_sampled': self.ulocalized_time( diff --git a/bika/lims/browser/worksheet/workflow.py b/bika/lims/browser/worksheet/workflow.py index 1707471f6e..d07750a5d7 100644 --- a/bika/lims/browser/worksheet/workflow.py +++ b/bika/lims/browser/worksheet/workflow.py @@ -7,8 +7,6 @@ import json -import plone -from plone.protect import CheckAuthenticator from AccessControl import getSecurityManager from Products.Archetypes.config import REFERENCE_CATALOG from Products.CMFCore.utils import getToolByName @@ -23,6 +21,7 @@ from bika.lims.subscribers import doActionFor from bika.lims.subscribers import skip from bika.lims.utils import isActive +from plone.protect import CheckAuthenticator class WorksheetFolderWorkflowAction(WorkflowAction): @@ -92,7 +91,6 @@ def __call__(self): if action == 'submit': - # Submit the form. Saves the results, methods, etc. self.submit() @@ -109,7 +107,7 @@ def __call__(self): # consistent with the order of the ARs catalog = get_tool(CATALOG_ANALYSIS_LISTING) brains = catalog({'UID': analysis_uids, - 'sort_on': 'getRequestID'}) + 'sort_on': 'getRequestID'}) for brain in brains: analysis = brain.getObject() self.context.addAnalysis(analysis) diff --git a/bika/lims/catalog/analysis_catalog.py b/bika/lims/catalog/analysis_catalog.py index 9985638f2b..291aea8426 100644 --- a/bika/lims/catalog/analysis_catalog.py +++ b/bika/lims/catalog/analysis_catalog.py @@ -23,7 +23,7 @@ 'worksheetanalysis_review_state': 'FieldIndex', 'cancellation_state': 'FieldIndex', 'getParentUID': 'FieldIndex', - 'getAnalysisRequestUID': 'FieldIndex', + 'getRequestUID': 'FieldIndex', 'getDepartmentUID': 'FieldIndex', 'getDueDate': 'DateIndex', 'getDateSampled': 'DateIndex', @@ -62,12 +62,12 @@ 'getReferenceAnalysesGroupID', 'getResultCaptureDate', 'getParentURL', - 'getAnalysisRequestURL', + 'getRequestURL', 'getParentTitle', 'getParentUID', 'getClientTitle', 'getClientURL', - 'getAnalysisRequestTitle', + 'getRequestTitle', 'getResult', 'getCalculationUID', 'getUnit', diff --git a/bika/lims/catalog/indexers/baseanalysis.py b/bika/lims/catalog/indexers/baseanalysis.py index 776d2d8f9f..e8aa862f99 100644 --- a/bika/lims/catalog/indexers/baseanalysis.py +++ b/bika/lims/catalog/indexers/baseanalysis.py @@ -1,3 +1,4 @@ + from Products.CMFPlone.CatalogTool import sortable_title as _sortable_title from bika.lims.interfaces import IBaseAnalysis from plone.indexer import indexer diff --git a/bika/lims/content/abstractanalysis.py b/bika/lims/content/abstractanalysis.py index 1260263013..b864b4d884 100644 --- a/bika/lims/content/abstractanalysis.py +++ b/bika/lims/content/abstractanalysis.py @@ -203,14 +203,6 @@ def setVerificator(self, value): field.set(self, value) self.reindexObject() - @deprecated('[1705] Use Title() instead.') - @security.public - def getServiceTitle(self): - """Returns the Title of the associated service. Analysis titles are - always the same as the title of the service from which they are derived. - """ - return self.Title() - @security.public def getDefaultUncertainty(self, result=None): """Return the uncertainty value, if the result falls within @@ -1223,12 +1215,6 @@ def getInstrumentValid(self): """ return self.isInstrumentValid() - @deprecated('[1705] Orphan. Use getAttachmentUIDs') - @security.public - def hasAttachment(self): - attachments = self.getAttachmentUIDs() - return len(attachments) > 0 - @security.public def getAttachmentUIDs(self): """Used to populate metadata, so that we don't need full objects of @@ -1248,94 +1234,74 @@ def remove_duplicates(self, ws): and analysis.getAnalysis().UID() == self.UID(): ws.removeAnalysis(analysis) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.sample') @security.public def guard_sample_transition(self): return guards.sample(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.retract') @security.public def guard_retract_transition(self): return guards.retract(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.sample_prep') @security.public def guard_sample_prep_transition(self): return guards.sample_prep(self) - @deprecated('[1705] Use guards.sample_prep_complete from ' - 'bika.lims.workflow.analysis.guards.sample_prep_complete') @security.public def guard_sample_prep_complete_transition(self): return guards.sample_prep_complete(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.receive') @security.public def guard_receive_transition(self): return guards.receive(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.publish') @security.public def guard_publish_transition(self): return guards.publish(self) - @deprecated('[1705] Use guards.import_transition from ' - 'bika.lims.workflow.analysis.guards.import_transition') @security.public def guard_import_transition(self): return guards.import_transition(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.attach') @security.public def guard_attach_transition(self): return guards.attach(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.verify') @security.public def guard_verify_transition(self): return guards.verify(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.assign') @security.public def guard_assign_transition(self): return guards.assign(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.guards.unassign') @security.public def guard_unassign_transition(self): return guards.unassign(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.events.after_submit') @security.public def workflow_script_submit(self): events.after_submit(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.events.after_retract') @security.public def workflow_script_retract(self): events.after_retract(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.events.after_verify') @security.public def workflow_script_verify(self): events.after_verify(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.events.after_cancel') @security.public def workflow_script_cancel(self): events.after_cancel(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.events.after_reject') @security.public def workflow_script_reject(self): events.after_reject(self) - @deprecated('[1705] Use bika.lims.workflow.analysis.events.after_attach') @security.public def workflow_script_attach(self): events.after_attach(self) - @deprecated('[1705] Orphan. No alternative') @security.public def workflow_script_assign(self): # TODO Workflow Assign Analysis - Seems there is no reason to add an @@ -1343,7 +1309,6 @@ def workflow_script_assign(self): # assign and unassign from AR and Worksheet would eventually be removed pass - @deprecated('[1705] Orphan. No alternative') @security.public def workflow_script_unassign(self): # TODO Workflow UnAssign Analysis - Seems there is no reason to add an diff --git a/bika/lims/content/abstractroutineanalysis.py b/bika/lims/content/abstractroutineanalysis.py index 0c1e3c33b1..ca603d56b4 100644 --- a/bika/lims/content/abstractroutineanalysis.py +++ b/bika/lims/content/abstractroutineanalysis.py @@ -12,7 +12,6 @@ from Products.Archetypes.references import HoldingReference from Products.CMFCore.utils import getToolByName from bika.lims import bikaMessageFactory as _ -from bika.lims import deprecated from bika.lims.browser.fields import HistoryAwareReferenceField, \ InterimFieldsField, UIDReferenceField from bika.lims.browser.widgets import DecimalWidget, RecordsWidget @@ -319,27 +318,6 @@ def getCalculationUID(self): if calculation: return calculation.UID() - @security.public - @deprecated("[1709] Use getRequestID instead") - def getAnalysisRequestTitle(self): - """This is a catalog metadata column - """ - return self.getRequestID() - - @security.public - @deprecated("[1709] Use getRequestUID instead") - def getAnalysisRequestUID(self): - """This method is used to populate catalog values - """ - return self.getRequestUID() - - @security.public - @deprecated("[1709] Use getRequestURL instead") - def getAnalysisRequestURL(self): - """This is a catalog metadata column - """ - return self.getRequestURL() - @security.public def getSampleTypeUID(self): """Used to populate catalog values. @@ -422,7 +400,6 @@ def getResultsRange(self, specification=None): an = self if specification == 'ar' or specification is None: - request = self.getRequest() if an.aq_parent and an.aq_parent.portal_type == 'AnalysisRequest': rr = an.aq_parent.getResultsRange() rr = [r for r in rr if r.get('keyword', '') == an.getKeyword()] @@ -438,7 +415,6 @@ def getResultsRange(self, specification=None): rr['uid'] = self.UID() return rr - @security.public def getSiblings(self): """Return the siblings analyses, using the parent to which the current @@ -464,7 +440,7 @@ def getDependents(self): def getDependencies(self): """Return a list of siblings who we depend on to calculate our result. """ - calc = self.getCalculation() + calc = self.getCalculation() if not calc: return [] @@ -492,7 +468,6 @@ def getPrioritySortkey(self): title = title() return '{}.{}.{}'.format(ar_sort_key, ar_id, title) - @security.public def getHidden(self): """ Returns whether if the analysis must be displayed in results diff --git a/bika/lims/content/analysisrequest.py b/bika/lims/content/analysisrequest.py index 741ba998ee..b6bef7beb4 100644 --- a/bika/lims/content/analysisrequest.py +++ b/bika/lims/content/analysisrequest.py @@ -78,20 +78,6 @@ # SCHEMA DEFINITION schema = BikaSchema.copy() + Schema(( - StringField( - 'RequestID', - searchable=True, - mode="rw", - read_permission=permissions.View, - write_permission=permissions.ModifyPortalContent, - widget=StringWidget( - label=_("Request ID"), - description=_("The ID assigned to the client's request by the lab"), - visible={'view': 'invisible', - 'edit': 'invisible'}, - ), - ), - UIDReferenceField( 'Contact', required=1, @@ -1903,24 +1889,6 @@ def Description(self): descr = " ".join((self.getId(), self.aq_parent.Title())) return safe_unicode(descr).encode('utf-8') - @deprecated('[1703] Use getId() instead') - def getRequestID(self): - """ - Another way to return the object ID. It is used as a column and index. - :returns: The object ID - :rtype: str - """ - return self.getId() - - @deprecated('[1703] Use setId(new_id) instad') - def setRequestID(self, new_id, **kwargs): - """ - Delegates to setId() function - :param new_id: The new id to define - :type spec: str - """ - self.setId(new_id) - def getClient(self): if self.aq_parent.portal_type == 'Client': return self.aq_parent @@ -2994,134 +2962,90 @@ def isUserAllowedToVerify(self, member): if not a.isUserAllowedToVerify(member)] return not notallowed - @deprecated('[1705] Use guards.to_be_preserved from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_to_be_preserved(self): return guards.to_be_preserved(self) - @deprecated('[1705] Use guards.verify from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_verify_transition(self): return guards.verify(self) - @deprecated('[1705] Use guards.unassign from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_unassign_transition(self): return guards.unassign(self) - @deprecated('[1705] Use guards.assign from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_assign_transition(self): return guards.assign(self) - @deprecated('[1705] Use guards.receive from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_receive_transition(self): return guards.receive(self) - @deprecated('[1705] Use guards.sample_prep from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_sample_prep_transition(self): return guards.sample_prep(self) - @deprecated('[1705] Use guards.sample_prep_complete from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_sample_prep_complete_transition(self): return guards.sample_prep_complete(self) - @deprecated('[1705] Use guards.schedule_sampling from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_schedule_sampling_transition(self): return guards.schedule_sampling(self) - @deprecated('[1705] Use guards.publish from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_publish_transition(self): return guards.publish(self) - @deprecated('[1705] Use guards.prepublish from ' - 'bika.lims.workflow.analysisrequest') @security.public def guard_prepublish_transition(self): return guards.prepublish(self) - @deprecated('[1705] Use events.after_no_sampling_workflow from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_no_sampling_workflow(self): events.after_no_sampling_workflow(self) - @deprecated('[1705] Use events.after_sampling_workflow from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_sampling_workflow(self): events.after_sampling_workflow(self) - @deprecated('[1705] Use events.after_sample from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_sample(self): events.after_sample(self) - @deprecated('[1705] Use events.after_receive from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_receive(self): events.after_receive(self) - @deprecated('[1705] Use events.after_preserve from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_preserve(self): events.after_preserve(self) - @deprecated('[1705] Use events.after_attach from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_attach(self): events.after_attach(self) - @deprecated('[1705] Use events.after_verify from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_verify(self): events.after_verify(self) - @deprecated('[1705] Use events.after_publish from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_publish(self): events.after_publish(self) - @deprecated('[1705] Use events.after_reinstate from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_reinstate(self): events.after_reinstate(self) - @deprecated('[1705] Use events.after_cancel from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_cancel(self): events.after_cancel(self) - @deprecated('[1705] Use events.after_schedule_sampling from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_schedule_sampling(self): events.after_schedule_sampling(self) - @deprecated('[1705] Use events.after_reject from ' - 'bika.lims.workflow.anaysisrequest') @security.public def workflow_script_reject(self): events.after_reject(self) @@ -3142,25 +3066,25 @@ def SearchableText(self): # a list of accessor methods of the class plain_text_fields = ("getId", ) - def read(accessor): + def read(acc): """ Call a class accessor method to give a value for certain Archetypes field. """ try: - value = accessor() - except: + val = acc() + except Exception as e: message = \ - "Error getting the accessor parameter"\ - " in SearchableText from the Analysis Request Object {}"\ - .format(self.getId()) + "Error getting the accessor parameter in SearchableText " \ + "from the Analysis Request Object {}: {}"\ + .format(self.getId(), e.message) logger.error(message) - value = "" + val = "" - if value is None: - value = "" + if val is None: + val = "" - return value + return val # Concatenate plain text fields as they are for f in plain_text_fields: diff --git a/bika/lims/content/analysisspec.py b/bika/lims/content/analysisspec.py index 270a3a127e..cddfdb159c 100644 --- a/bika/lims/content/analysisspec.py +++ b/bika/lims/content/analysisspec.py @@ -215,22 +215,6 @@ def getSampleTypes(self): return DisplayList(sampletypes) - @deprecated('[1703] Orphan. No alternative') - def getAnalysisSpecsStr(self, keyword): - specstr = '' - specs = self.getResultsRangeDict() - if keyword in specs.keys(): - specs = specs[keyword] - smin = specs.get('min', '') - smax = specs.get('max', '') - if smin and smax: - specstr = '%s - %s' % (smin, smax) - elif smin: - specstr = '> %s' % specs['min'] - elif smax: - specstr = '< %s' % specs['max'] - return specstr - def getClientUID(self): return self.aq_parent.UID() diff --git a/bika/lims/content/attachment.py b/bika/lims/content/attachment.py index 4013d368d4..c6ca65545f 100644 --- a/bika/lims/content/attachment.py +++ b/bika/lims/content/attachment.py @@ -169,7 +169,7 @@ def getRequestID(self): """ ar = self.getRequest() if ar: - return ar.getRequestID() + return ar.getId() else: return None diff --git a/bika/lims/content/duplicateanalysis.py b/bika/lims/content/duplicateanalysis.py index 68749a92ad..4339ff606b 100644 --- a/bika/lims/content/duplicateanalysis.py +++ b/bika/lims/content/duplicateanalysis.py @@ -107,19 +107,13 @@ def setAnalysis(self, analysis): self.getField(key).set(self, val) self.getField('Analysis').set(self, analysis) - @deprecated('[1705] Use events.after_attach from ' - 'bika.lims.workflow.duplicateanalysis.events') def workflow_script_attach(self): events.after_attach(self) - @deprecated('[1705] Use events.after_retract from ' - 'bika.lims.workflow.duplicateanalysis.events') @security.public def workflow_script_retract(self): events.after_retract(self) - @deprecated('[1705] Use events.after_verify from ' - 'bika.lims.workflow.duplicateanalysis.events') @security.public def workflow_script_verify(self): events.after_verify(self) diff --git a/bika/lims/content/instrument.py b/bika/lims/content/instrument.py index b4add2734b..0dbc56ee74 100644 --- a/bika/lims/content/instrument.py +++ b/bika/lims/content/instrument.py @@ -419,14 +419,6 @@ def getManufacturers(self): items.sort(lambda x, y: cmp(x[1], y[1])) return DisplayList(items) - @deprecated('[1702] Orphan. No alternative') - def getMethodUID(self): - # TODO Avoid using this function. Returns first method's UID for now. - if self.getMethods(): - return self.getMethods()[0].UID() - else: - return '' - def getMethodUIDs(self): uids = [] if self.getMethods(): diff --git a/bika/lims/content/invoicebatch.py b/bika/lims/content/invoicebatch.py index 9438a11fab..89b0791d93 100644 --- a/bika/lims/content/invoicebatch.py +++ b/bika/lims/content/invoicebatch.py @@ -83,7 +83,7 @@ def createInvoice(self, client_uid, items): if item.portal_type == 'AnalysisRequest': lineitem['ItemDate'] = plone_view.toLocalizedTime( getTransitionDate(item, 'publish'), long_format=1) - lineitem['OrderNumber'] = item.getRequestID() + lineitem['OrderNumber'] = item.getId() lineitem['AnalysisRequest'] = item lineitem['SupplyOrder'] = '' description = get_invoice_item_description(item) diff --git a/bika/lims/content/labcontact.py b/bika/lims/content/labcontact.py index 157cf02815..2122df240e 100644 --- a/bika/lims/content/labcontact.py +++ b/bika/lims/content/labcontact.py @@ -48,26 +48,6 @@ "Upload a scanned signature to be used on printed analysis " "results reports. Ideal size is 250 pixels wide by 150 high"), )), - # TODO: Department'll be delated - atapi.ReferenceField('Department', - required = 0, - vocabulary_display_path_bound = sys.maxint, - allowed_types = ('Department',), - relationship = 'LabContactDepartment', - vocabulary = 'getDepartments', - referenceClass = HoldingReference, - widget = atapi.ReferenceWidget( - visible=False, - checkbox_bound = 0, - label=_("Department"), - description=_("The laboratory department"), - ), - ), - atapi.ComputedField('DepartmentTitle', - expression="context.getDepartment() and context.getDepartment().Title() or ''", - widget=atapi.ComputedWidget( - visible=False, - )), atapi.ReferenceField('Departments', required = 0, vocabulary_display_path_bound = sys.maxint, @@ -123,14 +103,6 @@ def hasUser(self): return self.portal_membership.getMemberById( self.getUsername()) is not None - @deprecated('[1612] Use getDepartments instead') - def getDepartment(self): - """ - This function is a mirror for getDepartments to maintain the - compability with the old version. - """ - return self.getDepartments()[0] if self.getDepartments() else None - def getDepartments_voc(self): """ Returns a vocabulary object with the available departments. diff --git a/bika/lims/content/referenceanalysis.py b/bika/lims/content/referenceanalysis.py index 1d4e990a95..1a7251e741 100644 --- a/bika/lims/content/referenceanalysis.py +++ b/bika/lims/content/referenceanalysis.py @@ -175,7 +175,6 @@ def getCalculationTitle(self): def getCalculationUID(self): return None - @deprecated('[1705] Use bika.lims.workflow.analysis.events.after_submit') @security.public def workflow_script_submit(self): """Method triggered after a 'submit' transition for the current diff --git a/bika/lims/content/sample.py b/bika/lims/content/sample.py index 3d075d895e..fd7a160cf7 100644 --- a/bika/lims/content/sample.py +++ b/bika/lims/content/sample.py @@ -855,99 +855,74 @@ def getSamplePartitions(self): partitions = self.objectValues('SamplePartition') return partitions - @deprecated('[1705] Use events.after_no_sampling_workflow from ' - 'bika.lims.workflow.sample') @security.public def workflow_script_no_sampling_workflow(self): events.after_no_sampling_workflow(self) - @deprecated('[1705] Use events.after_sampling_workflow from ' - 'bika.lims.workflow.sample') @security.public def workflow_script_sampling_workflow(self): events.after_sampling_workflow(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_sample') @security.public def workflow_script_sample(self): events.after_sample(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_sample_due') @security.public def workflow_script_sample_due(self): events.after_sample_due(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_receive') @security.public def workflow_script_receive(self): events.after_receive(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_preserve') @security.public def workflow_script_preserve(self): events.after_preserve(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_expire') @security.public def workflow_script_expire(self): events.after_expire(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_dispose') @security.public def workflow_script_dispose(self): events.after_dispose(self) - @deprecated('[1705] Use events.after_to_be_preserved from ' - 'bika.lims.workflow.sample') @security.public def workflow_script_to_be_preserved(self): events.after_to_be_preserved(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_reinstate') @security.public def workflow_script_reinstate(self): events.after_reinstate(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_cancel') @security.public def workflow_script_cancel(self): events.after_cancel(self) - @deprecated('[1705] Use bika.lims.workflow.sample.events.after_reject') @security.public def workflow_script_reject(self): events.after_reject(self) - @deprecated('[1705] Use events.after_schedule_sampling from ' - 'bika.lims.workflow.sample') @security.public def workflow_script_schedule_sampling(self): events.after_schedule_sampling(self) - @deprecated('[1705] Use guards.to_be_preserved from ' - 'bika.lims.workflow.sample') @security.public def guard_to_be_preserved(self): return guards.to_be_preserved(self) - @deprecated('[1705] Use bika.lims.workflow.sample.guards.receive') @security.public def guard_receive_transition(self): return guards.receive(self) - @deprecated('[1705] Use bika.lims.workflow.sample.guards.sample_prep') @security.public def guard_sample_prep_transition(self): return guards.sample_prep(self) - @deprecated('[1705] Use guards.sample_prep_complete from ' - 'bika.lims.workflow.sample') @security.public def guard_sample_prep_complete_transition(self): return guards.sample_prep_complete(self) - @deprecated('[1705] Use guards.schedule_sampling from ' - 'bika.lims.workflow.sample') @security.public def guard_schedule_sampling_transition(self): return guards.schedule_sampling(self) diff --git a/bika/lims/content/worksheet.py b/bika/lims/content/worksheet.py index 8675886db7..8bfe31611b 100644 --- a/bika/lims/content/worksheet.py +++ b/bika/lims/content/worksheet.py @@ -479,7 +479,7 @@ def applyWorksheetTemplate(self, wst): # instrument or method is not allowed continue - ar_id = brain.getRequestID + ar_id = brain.id if ar_id in ar_analyses: ar_analyses[ar_id].append(analysis) else: @@ -907,7 +907,6 @@ def isUserAllowedToVerify(self, member): if not a.isUserAllowedToVerify(member)] return not notallowed - @deprecated('[1705] Use bika.lims.workflow.worksheet.guards.verify') @security.public def guard_verify_transition(self): return guards.verify(self) @@ -927,17 +926,14 @@ def getObjectWorkflowStates(self): states[w.state_var] = state return states - @deprecated('[1705] Use bika.lims.workflow.worksheet.after_submit') @security.public def workflow_script_submit(self): events.after_submit(self) - @deprecated('[1705] Use bika.lims.workflow.worksheet.after_retract') @security.public def workflow_script_retract(self): events.after_retract(self) - @deprecated('[1705] Use bika.lims.workflow.worksheet.after_verify') @security.public def workflow_script_verify(self): events.after_verify(self) diff --git a/bika/lims/databasesanitize/analyses.py b/bika/lims/databasesanitize/analyses.py index a7407ca140..287e6f9863 100644 --- a/bika/lims/databasesanitize/analyses.py +++ b/bika/lims/databasesanitize/analyses.py @@ -25,7 +25,7 @@ def analyses_creation_date_recover(): logger.info("Analysis Requests to walk over: {}".format(total_ars)) total_modified = 0 for ar_brain in ar_brains: - ans_brains = ans_catalog({"getAnalysisRequestUID": ar_brain.UID}) + ans_brains = ans_catalog({"getRequestUID": ar_brain.UID}) analyses_modified = set_correct_created_date( ar_brain.created, ans_brains) total_modified += analyses_modified diff --git a/bika/lims/setuphandlers.py b/bika/lims/setuphandlers.py index c0348be34f..6a1d4031a4 100644 --- a/bika/lims/setuphandlers.py +++ b/bika/lims/setuphandlers.py @@ -314,7 +314,6 @@ def addColumn(cat, col): addIndex(bc, 'getInvoiced', 'FieldIndex') addIndex(bc, 'getPreserver', 'FieldIndex') addIndex(bc, 'getReferenceDefinitionUID', 'FieldIndex') - addIndex(bc, 'getRequestID', 'FieldIndex') addIndex(bc, 'getSampleID', 'FieldIndex') addIndex(bc, 'getSamplePointTitle', 'FieldIndex') addIndex(bc, 'getSamplePointUID', 'FieldIndex') @@ -342,7 +341,6 @@ def addColumn(cat, col): addColumn(bc, 'cancellation_state') addColumn(bc, 'getAnalysts') addColumn(bc, 'getSampleID') - addColumn(bc, 'getRequestID') addColumn(bc, 'getClientOrderNumber') addColumn(bc, 'getClientReference') addColumn(bc, 'getClientSampleID') diff --git a/bika/lims/skins/bika/bika_listing.css.dtml b/bika/lims/skins/bika/bika_listing.css.dtml index bd1f3e932a..c188b8acc4 100644 --- a/bika/lims/skins/bika/bika_listing.css.dtml +++ b/bika/lims/skins/bika/bika_listing.css.dtml @@ -196,7 +196,7 @@ table.bika-listing-table { .bika-listing-table th.column, .bika-listing-table td.interim, .bika-listing-table td.Result, -.bika-listing-table td.getRequestID, +.bika-listing-table td.getId, .bika-listing-table td.Title, .bika-listing-table td.ID { white-space:nowrap !important; diff --git a/bika/lims/skins/bika/portlet_to_be_verified.pt b/bika/lims/skins/bika/portlet_to_be_verified.pt index 3d49504bd9..370c6d02e6 100644 --- a/bika/lims/skins/bika/portlet_to_be_verified.pt +++ b/bika/lims/skins/bika/portlet_to_be_verified.pt @@ -20,7 +20,7 @@ portal_type='AnalysisRequest', review_state='to_be_verified', cancellation_state='active', - sort_on='getRequestID') or []; + sort_on='sortable_title') or []; ar_results python:[p.getObject() for p in ar[:5]]; rs python:ws_results + ar_results; results python:rs[:5];" diff --git a/bika/lims/skins/bika/reports.css.dtml b/bika/lims/skins/bika/reports.css.dtml index 36400cdaa3..53c2a6a784 100644 --- a/bika/lims/skins/bika/reports.css.dtml +++ b/bika/lims/skins/bika/reports.css.dtml @@ -117,7 +117,7 @@ table.bika-report-table { .bika-report-table .column, .bika-report-table .interim, .bika-report-table .Result, -.bika-report-table .getRequestID, +.bika-report-table .getId, .bika-report-table .Title, .bika-report-table .ID { white-space:nowrap !important; diff --git a/bika/lims/utils/analysisrequest.py b/bika/lims/utils/analysisrequest.py index d07095ddf8..d5f7698da3 100644 --- a/bika/lims/utils/analysisrequest.py +++ b/bika/lims/utils/analysisrequest.py @@ -311,7 +311,7 @@ def notify_rejection(analysisrequest): :param analysisrequest: Analysis Request to which the notification refers :returns: true if success """ - arid = analysisrequest.getRequestID() + arid = analysisrequest.getId() # This is the template to render for the pdf that will be either attached # to the email and attached the the Analysis Request for further access