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

Fix error when invalidating samples with copies of analyses (1.3.x) #1866

Merged
merged 3 commits into from
Nov 2, 2021

Conversation

xispa
Copy link
Member

@xispa xispa commented Nov 2, 2021

Description of the issue/feature this PR addresses

This Pull Requests makes the invalidation transition aware of samples with copies of same analysis, so no error arises when creating the sample retest on invalidation.

Current behavior before PR

A traceback arises when invalidating a Sample with more than one copy of same analysis:

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module bika.lims.browser.workflow, line 143, in __call__
  Module bika.lims.browser.workflow.analysisrequest, line 156, in __call__
  Module bika.lims.browser.workflow, line 173, in do_action
  Module bika.lims.workflow, line 123, in doActionFor
  Module Products.CMFCore.WorkflowTool, line 241, in doActionFor
  Module Products.CMFCore.WorkflowTool, line 552, in _invokeWithNotification
  Module Products.DCWorkflow.DCWorkflow, line 282, in doActionFor
  Module Products.DCWorkflow.DCWorkflow, line 421, in _changeStateOf
  Module Products.DCWorkflow.DCWorkflow, line 531, in _executeTransition
  Module zope.event, line 31, in notify
  Module zope.component.event, line 24, in dispatch
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module zope.component.event, line 32, in objectEventNotify
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module bika.lims.workflow, line 186, in AfterTransitionEventHandler
  Module bika.lims.workflow, line 161, in call_workflow_event
  Module bika.lims.workflow.analysisrequest.events, line 86, in after_invalidate
  Module bika.lims.utils.analysisrequest, line 311, in create_retest
  Module Products.CMFPlone.utils, line 340, in _createObjectByType
  Module Products.CMFCore.TypesTool, line 552, in _constructInstance
  Module OFS.ObjectManager, line 325, in _setObject
  Module Products.CMFCore.PortalFolder, line 310, in _checkId
  Module OFS.ObjectManager, line 116, in checkValidId

Desired behavior after PR is merged

No traceback arises

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

xispa added 3 commits November 2, 2021 09:37
Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module bika.lims.browser.workflow, line 143, in __call__
  Module bika.lims.browser.workflow.analysisrequest, line 156, in __call__
  Module bika.lims.browser.workflow, line 173, in do_action
  Module bika.lims.workflow, line 123, in doActionFor
  Module Products.CMFCore.WorkflowTool, line 241, in doActionFor
  Module Products.CMFCore.WorkflowTool, line 552, in _invokeWithNotification
  Module Products.DCWorkflow.DCWorkflow, line 282, in doActionFor
  Module Products.DCWorkflow.DCWorkflow, line 421, in _changeStateOf
  Module Products.DCWorkflow.DCWorkflow, line 531, in _executeTransition
  Module zope.event, line 31, in notify
  Module zope.component.event, line 24, in dispatch
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module zope.component.event, line 32, in objectEventNotify
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module bika.lims.workflow, line 186, in AfterTransitionEventHandler
  Module bika.lims.workflow, line 161, in call_workflow_event
  Module bika.lims.workflow.analysisrequest.events, line 86, in after_invalidate
  Module bika.lims.utils.analysisrequest, line 311, in create_retest
  Module Products.CMFPlone.utils, line 340, in _createObjectByType
  Module Products.CMFCore.TypesTool, line 552, in _constructInstance
  Module OFS.ObjectManager, line 325, in _setObject
  Module Products.CMFCore.PortalFolder, line 310, in _checkId
  Module OFS.ObjectManager, line 116, in checkValidId
@ramonski ramonski merged commit 339d0db into 1.3.x Nov 2, 2021
@ramonski ramonski deleted the error-invalidate branch November 2, 2021 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 P0: Critical Version 1.3 SENAITE Core Version 1.3.x
Development

Successfully merging this pull request may close these issues.

2 participants