Hi everyone,
Is it possible to change Sample Type?
Any usergroups cant change.
Thanks.
Hi,
I think it canāt be changed, as the sampleID is related to sampletype(prefix).
But why you want to change it?
You can have other alternative way. Ex.
-āCopy to newā to register a new sample with the right sampletype, most of field contents are automatically pre-filled.
-then āCancelā the sample with āwrongā sampletype.
Deng
Hi,
@fengyun.deng is right. Sample Type is one of the few attributes that can never be changed after creation.
So creating new samples by copying is the easiest way.
Unluckily sometimes we notice a wrong sample type after all work was done.
So hereās another workaround keeping the original SampleID:
HTH
Hi everyone,
@grulisco 's suggestion was exactly what we needed. Indeed, sometimes we realize the wrong sample type after tests have progressed and been concluded, and we want to preserve those protocols. We have lists and records kept within the laboratory according to those protocol numbers. gruliscoās workaround was helpful for us.
Thank you everyone for your messages.
Actually, there is another similar situation: changing the client. Have you encountered a situation where you needed to change the client? What would you do in that case?
Thanks in advance for your help.
Changing Client?
Worse Situationā¦ Thereās No Trick for this, iām afraid.
Best solution: Copying Samples, Change Client, but getting new IDs.
I want to thank the community and @grulisco for the response. Since the majority of our sample registration and acceptance is done within our own laboratory, we very rarely make incorrect client entries, but we do notice it during reporting. As you mentioned, we apply the suggested method.
Wishing everyone all the best.
Do you know if this constraint automatically disappear after removing the Sample Type from the ID Server?
We can alter our Sample Type after creation:
But we also removed SampleType from the ID Server formula:
I havenāt tested to see if that automatically flags the configuration, but it appears that way .
Hi @faytrow
we removed {SampleType} in our ID server, too - with no effect.
So Iām really surprised, that you can alter the sample type afterwards.
I havenāt enough knowledge about the coding, but I would like to have this ability for myself.
Ah, I found where it was added in.
You can a modify the widget using an adapter on the AnalysisRequest to make that field editable (in addition to removing it from the ID Server).
If you have your own custom Plone add-on for Senaite, you can put this in an adapter with your specified lims layer:
from archetypes.schemaextender.interfaces import ISchemaModifier
from bika.lims.interfaces import IAnalysisRequest
from your.lims.interfaces import IYourLimsLayer #This is for your add-on
from Products.CMFCore.permissions import View #Consider a different permission
class AnalysisRequestSchemaModifier(object):
adapts(IAnalysisRequest)
implements(ISchemaModifier)
layer = IYourLimsLayer
def __init__(self, context):
self.context = context
def fiddle(self, schema):
schema['SampleType'].widget.visible={
'edit':'visible',
'view':'visible',
'add':'edit',
'header_table':'visible',
}
schema['SampleType'].write_permission = View #This lets ANYONE edit it
return schema
Also make sure the register the adapter in a .zcml
file that is part of your GenericSetup:
<!-- Schema extender for ARs -->
<adapter
name="your.lims.analysisrequest.schemaextender"
factory=".your_module.AnalysisRequestSchemaExtender"
provides="archetypes.schemaextender.interfaces.ISchemaExtender"
/>
Note: This will be obsolete once Archetypes are no longer used for AnalysisRequests.