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

Setting in setup for auto-reception of samples upon creation #1436

Merged
merged 4 commits into from
Sep 20, 2019
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
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog

**Added**

- #1436 Setting in setup for auto-reception of samples upon creation
- #1433 Added Submitter column in Sample's analyses listing
- #1441 Added Auto ID Behavior for Dexterity Contents
- #1431 Added Submitter column in Sample's analyses listing
- #1422 Notify user with failing addresses when emailing of results reports
Expand Down
13 changes: 13 additions & 0 deletions bika/lims/content/bikasetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,19 @@ def getCounterTypes(self, instance=None):
" when 'Sampling workflow' is active")
),
),
BooleanField(
"AutoreceiveSamples",
schemata="Sampling",
default=False,
widget=BooleanWidget(
label=_("Auto-receive samples"),
description=_(
"Select to receive the samples automatically when created by "
"lab personnel and sampling workflow is disabled. Samples "
"created by client contacts won't be received automatically"
),
),
),
BooleanField(
'ShowPartitions',
schemata="Appearance",
Expand Down
13 changes: 13 additions & 0 deletions bika/lims/workflow/analysisrequest/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from bika.lims.interfaces import IVerified
from bika.lims.utils import changeWorkflowState
from bika.lims.utils.analysisrequest import create_retest
from bika.lims.workflow import doActionFor as do_action_for
from bika.lims.workflow import get_prev_status_from_history
from bika.lims.workflow.analysisrequest import AR_WORKFLOW_ID
from bika.lims.workflow.analysisrequest import do_action_to_analyses
Expand All @@ -45,6 +46,18 @@ def before_sample(analysis_request):
analysis_request.setSampler(api.get_current_user().id)


def after_no_sampling_workflow(analysis_request):
"""Function triggered after "no_sampling_workflow transition for the
Analysis Request passed in is performed
"""
setup = api.get_setup()
if setup.getAutoreceiveSamples():
# Auto-receive samples is enabled. Note transition to "received" state
# will only take place if the current user has enough privileges (this
# is handled by do_action_for already).
do_action_for(analysis_request, "receive")


def after_reject(analysis_request):
"""Method triggered after a 'reject' transition for the Analysis Request
passed in is performed. Cascades the transition to descendants (partitions)
Expand Down