label=_("Model"), description=_("The instrument's model number"), )), StringField( 'SerialNo', widget=StringWidget( label=_("Serial No"), description=_( "The serial number that uniquely identifies the instrument"), )), UIDReferenceField( 'Method', vocabulary='_getAvailableMethods', allowed_types=('Method', ), required=0, widget=SelectionWidget( format='select', label=_("Method"), visible=False, ), ), ReferenceField( 'Methods', vocabulary='_getAvailableMethods', allowed_types=('Method', ), relationship='InstrumentMethods', required=0, multiValued=1, widget=PicklistWidget( size=10, label=_("Methods"),
modes=("view"), ), ), # Calculations associated to this method. The analyses services # with this method assigned will use the calculation selected here. UIDReferenceField( "Calculation", vocabulary="_getCalculations", allowed_types=("Calculation", ), accessor="getCalculationUID", widget=SelectionWidget( visible={ "edit": "visible", "view": "visible" }, format="select", checkbox_bound=0, label=_("Calculation"), description=_( "If required, select a calculation for the The analysis " "services linked to this method. Calculations can be " "configured under the calculations item in the LIMS set-up"), catalog_name="bika_setup_catalog", base_query={"is_active": True}, )), BooleanField( "Accredited", schemata="default", default=True, widget=BooleanWidget( label=_("Accredited"),
from bika.lims.content.clientawaremixin import ClientAwareMixin from bika.lims.content.reflexrule import doReflexRuleAction from bika.lims.interfaces import IAnalysis from bika.lims.interfaces import ICancellable from bika.lims.interfaces import IDynamicResultsRange from bika.lims.interfaces import IInternalUse from bika.lims.interfaces import IRoutineAnalysis from bika.lims.interfaces.analysis import IRequestAnalysis from bika.lims.workflow import getTransitionDate # True if the analysis is created by a reflex rule IsReflexAnalysis = BooleanField('IsReflexAnalysis', default=False, required=0) # This field contains the original analysis which was reflected OriginalReflexedAnalysis = UIDReferenceField('OriginalReflexedAnalysis', required=0, allowed_types=('Analysis', )) # This field contains the analysis which has been reflected following # a reflex rule ReflexAnalysisOf = UIDReferenceField('ReflexAnalysisOf', required=0, allowed_types=('Analysis', )) # Which is the Reflex Rule action that has created this analysis ReflexRuleAction = StringField('ReflexRuleAction', required=0, default=0) # Which is the 'local_id' inside the reflex rule ReflexRuleLocalID = StringField('ReflexRuleLocalID', required=0, default=0) # Reflex rule triggered actions which the current analysis is responsible for.
schema = Organisation.schema.copy() + Schema(( StringField('LabURL', schemata = 'Address', write_permission = ManageBika, widget = StringWidget( size = 60, label=_("Lab URL"), description=_("The Laboratory's web address"), ), ), UIDReferenceField( 'Supervisor', required=0, allowed_types=('LabContact',), vocabulary='_getLabContacts', write_permission = ManageBika, widget=UIDSelectionWidget( format='select', label=_("Supervisor"), description=_("Supervisor of the Lab") ) ), IntegerField('Confidence', schemata = 'Accreditation', widget = IntegerWidget( label=_("Confidence Level %"), description=_("This value is reported at the bottom of all published results"), ), ), BooleanField('LaboratoryAccredited', default = False, schemata = 'Accreditation',
from bika.lims.catalog.bikasetup_catalog import SETUP_CATALOG from bika.lims.config import PROJECTNAME from bika.lims.content.bikaschema import BikaSchema from bika.lims.content.clientawaremixin import ClientAwareMixin from bika.lims.content.sampletype import SampleTypeAwareMixin from bika.lims.interfaces import IAnalysisSpec from bika.lims.interfaces import IDeactivable schema = Schema(( UIDReferenceField( 'SampleType', allowed_types=('SampleType', ), required=1, widget=ReferenceWidget( label=_("Sample Type"), showOn=True, catalog_name=SETUP_CATALOG, base_query=dict(is_active=True, sort_on="sortable_title", sort_order="ascending"), ), ), UIDReferenceField( 'DynamicAnalysisSpec', allowed_types=('DynamicAnalysisSpec', ), required=0, widget=ReferenceWidget( label=_("Dynamic Analysis Specification"), showOn=True, catalog_name=SETUP_CATALOG, base_query=dict(sort_on="sortable_title", sort_order="ascending"),
schemata="Address", write_permission=ManageBika, widget=StringWidget( size=60, label=_("Lab URL"), description=_("The Laboratory's web address"), ), ), UIDReferenceField("Supervisor", required=0, allowed_types=("LabContact", ), write_permission=ManageBika, widget=ReferenceWidget( label=_("Supervisor"), description=_("Supervisor of the Lab"), showOn=True, catalog_name=SETUP_CATALOG, base_query=dict( is_active=True, sort_on="sortable_title", sort_order="ascending", ), )), IntegerField( "Confidence", schemata="Accreditation", widget=IntegerWidget( label=_("Confidence Level %"), description=_("This value is reported at the bottom of all " "published results"), ),
# Behavior of AnalysisServices controlled by js depending on # ManualEntry/Instruments: # - Populate dynamically with selected Instruments # - If InstrumentEntry checked, set first selected instrument # - If InstrumentEntry not checked, hide and set None # See browser/js/bika.lims.analysisservice.edit.js Instrument = UIDReferenceField( "Instrument", read_permission=View, write_permission=FieldEditAnalysisResult, schemata="Method", searchable=True, required=0, vocabulary="_getAvailableInstrumentsDisplayList", allowed_types=("Instrument", ), accessor="getInstrumentUID", widget=SelectionWidget( format="select", label=_("Default Instrument"), description=_( "This is the instrument that is assigned to tests from this type " "of analysis in manage results view. The method associated to " "this instrument will be assigned as the default method too.Note " "the instrument's method will prevail over any of the methods " "choosen if the 'Instrument assignment is not required' option is " "enabled."))) # Default method to be used. This field is used in Analysis Service # Edit view, use getMethod() to retrieve the Method to be used in # this Analysis Service. # Gets populated with the methods selected in the multiselection # box above or with the default instrument's method.
"used for this analysis service"), ) ) # The preservation for this service; If multiple services share the same # preservation, then it's possible that they can be performed on the same # sample partition. Preservation = UIDReferenceField( 'Preservation', schemata='Container and Preservation', allowed_types=('Preservation',), vocabulary='getPreservations', required=0, multiValued=0, widget=ReferenceWidget( checkbox_bound=0, label=_("Default Preservation"), description=_( "Select a default preservation for this analysis service. If the " "preservation depends on the sample type combination, specify a " "preservation per sample type in the table below"), catalog_name='bika_setup_catalog', base_query={'inactive_state': 'active'}, ) ) # The container or containertype for this service's analyses can be specified. # If multiple services share the same container or containertype, then it's # possible that their analyses can be performed on the same partitions Container = UIDReferenceField( 'Container', schemata='Container and Preservation',
vocabulary="_departmentsVoc", referenceClass=HoldingReference, multiValued=1, widget=ReferenceWidget( checkbox_bound=0, label=_("Departments"), description=_("The laboratory departments"), ), ), UIDReferenceField( "DefaultDepartment", required=0, vocabulary_display_path_bound=sys.maxint, vocabulary="_defaultDepsVoc", accessor="getDefaultDepartmentUID", widget=SelectionWidget( visible=True, format="select", label=_("Default Department"), description=_("Default Department"), ), ), )) schema["JobTitle"].schemata = "default" # Don't make title required - it will be computed from the Person's Fullname schema["title"].required = 0 schema["title"].widget.visible = False schema["Department"].required = 0 schema["Department"].widget.visible = False
vocabulary_display_path_bound=sys.maxint, allowed_types=('Department',), relationship='LabContactDepartment', vocabulary='_departmentsVoc', referenceClass=HoldingReference, multiValued=1, widget=atapi.ReferenceWidget( checkbox_bound=0, label=_("Departments"), description=_("The laboratory departments"), )), UIDReferenceField('DefaultDepartment', required=0, vocabulary_display_path_bound=sys.maxint, vocabulary='_defaultDepsVoc', widget=SelectionWidget( visible=True, format='select', label=_("Default Department"), description=_("Default Department"), )), )) schema['JobTitle'].schemata = 'default' # Don't make title required - it will be computed from the Person's Fullname schema['title'].required = 0 schema['title'].widget.visible = False schema['Department'].required = 0 schema['Department'].widget.visible = False class LabContact(Contact):
widget=BikaRecordsWidget( label=_("Calculation Interim Fields"), description=_( "Define interim fields such as vessel mass, dilution factors, " "should your calculation require them. The field title specified " "here will be used as column headers and field descriptors where " "the interim fields are displayed. If 'Apply wide' is enabled " "the field ill be shown in a selection box on the top of the " "worksheet, allowing to apply a specific value to all the " "corresponding fields on the sheet."), ) ), UIDReferenceField( 'DependentServices', multiValued=1, allowed_types=('AnalysisService',), widget=ReferenceWidget( visible=False, ), ), TextField('Formula', schemata='Calculation', validators=('formulavalidator',), default_content_type='text/plain', allowable_content_types=('text/plain',), widget = TextAreaWidget( label=_("Calculation Formula"), description=_( "calculation_formula_description", "<p>The formula you type here will be dynamically calculated " "when an analysis using this calculation is displayed.</p>" "<p>To enter a Calculation, use standard maths operators, "
from bika.lims.content.bikaschema import BikaSchema from bika.lims.interfaces import IARReport from plone.app.blob.field import BlobField from Products.Archetypes import atapi from Products.Archetypes.public import BaseFolder from Products.Archetypes.public import Schema from Products.Archetypes.public import StringField from Products.Archetypes.references import HoldingReference from Products.ATExtensions.ateapi import RecordsField from zope.interface import implements schema = BikaSchema.copy() + Schema(( UIDReferenceField( "AnalysisRequest", allowed_types=("AnalysisRequest",), referenceClass=HoldingReference, required=1, ), BlobField( "Pdf",), StringField( "SMS",), RecordsField( "Recipients", type="recipients", subfields=( "UID", "Username", "Fullname", "EmailAddress", "PublicationModes"
modes=('view'), ), ), # Calculations associated to this method. The analyses services # with this method assigned will use the calculation selected here. UIDReferenceField( 'Calculation', vocabulary='_getCalculations', allowed_types=('Calculation', ), widget=UIDSelectionWidget( visible={ 'edit': 'visible', 'view': 'visible' }, format='select', checkbox_bound=0, label=_("Calculation"), description=_( "If required, select a calculation for the The analysis " "services linked to this method. Calculations can be " "configured under the calculations item in the LIMS set-up"), catalog_name='bika_setup_catalog', base_query={'inactive_state': 'active'}, )), BooleanField( 'Accredited', schemata="default", default=True, widget=BooleanWidget( label=_("Accredited"),
from bika.lims.config import PROJECTNAME from bika.lims.content.abstractroutineanalysis import AbstractRoutineAnalysis from bika.lims.content.abstractroutineanalysis import schema from bika.lims.content.analysisspec import ResultsRangeDict from bika.lims.interfaces import IDuplicateAnalysis from bika.lims.interfaces.analysis import IRequestAnalysis from bika.lims.subscribers import skip from bika.lims.workflow import in_state from bika.lims.workflow.analysis import STATE_RETRACTED, STATE_REJECTED from bika.lims.workflow.duplicateanalysis import events from zope.interface import implements # A reference back to the original analysis from which this one was duplicated. Analysis = UIDReferenceField( 'Analysis', required=1, allowed_types=('Analysis', 'ReferenceAnalysis'), ) # TODO Analysis - Duplicates shouldn't have this attribute, only ReferenceAns ReferenceAnalysesGroupID = StringField('ReferenceAnalysesGroupID', ) schema = schema.copy() + Schema(( Analysis, ReferenceAnalysesGroupID, )) class DuplicateAnalysis(AbstractRoutineAnalysis): implements(IDuplicateAnalysis) security = ClassSecurityInfo()
from bika.lims.browser.widgets import DateTimeWidget from DateTime import DateTime from bika.lims.config import PROJECTNAME from bika.lims.content.bikaschema import BikaSchema from plone.app.blob.field import FileField schema = BikaSchema.copy() + Schema( ( # It comes from blob FileField( 'AttachmentFile', widget=atapi.FileWidget(label=_("Attachment"), ), ), UIDReferenceField( 'AttachmentType', required=0, allowed_types=('AttachmentType', ), widget=ReferenceWidget(label=_("Attachment Type"), ), ), atapi.StringField( 'AttachmentKeys', searchable=True, widget=atapi.StringWidget(label=_("Attachment Keys"), ), ), DateTimeField( 'DateLoaded', required=1, default_method='current_date', widget=DateTimeWidget(label=_("Date Loaded"), ), ), ), )
from bika.lims.content.bikaschema import BikaSchema from bika.lims.interfaces import IARReport from plone.app.blob.field import BlobField from Products.Archetypes import atapi from Products.Archetypes.public import BaseFolder from Products.Archetypes.public import Schema from Products.Archetypes.references import HoldingReference from Products.ATExtensions.ateapi import RecordField from Products.ATExtensions.ateapi import RecordsField from zope.interface import implements schema = BikaSchema.copy() + Schema(( UIDReferenceField( "AnalysisRequest", allowed_types=("AnalysisRequest",), referenceClass=HoldingReference, required=1, ), UIDReferenceField( "ContainedAnalysisRequests", multiValued=True, allowed_types=("AnalysisRequest",), relationship="ARReportAnalysisRequest", widget=ReferenceWidget( label=_("Contained Analysis Requests"), render_own_label=False, size=20, description=_("Referenced Analysis Requests in the PDF"), visible={ "edit": "visible", "view": "visible",
from Products.Archetypes.public import ReferenceWidget from Products.Archetypes.public import Schema from Products.Archetypes.utils import DisplayList from Products.ATContentTypes.lib.historyaware import HistoryAwareMixin from Products.ATExtensions.field.records import RecordsField from Products.CMFCore.utils import getToolByName from Products.CMFPlone.utils import safe_unicode from zope.i18n import translate from zope.interface import implements schema = Schema(( UIDReferenceField( 'SampleType', vocabulary="getSampleTypes", allowed_types=('SampleType', ), widget=ReferenceWidget( checkbox_bound=0, label=_("Sample Type"), ), ), ComputedField( 'SampleTypeTitle', expression= "context.getSampleType().Title() if context.getSampleType() else ''", widget=ComputedWidget(visible=False, ), ), ComputedField( 'SampleTypeUID', expression= "context.getSampleType().UID() if context.getSampleType() else ''", widget=ComputedWidget(visible=False, ),
schema = Organisation.schema.copy() + Schema(( StringField( "LabURL", schemata="Address", write_permission=ManageBika, widget=StringWidget( size=60, label=_("Lab URL"), description=_("The Laboratory's web address"), ), ), UIDReferenceField("Supervisor", required=0, allowed_types=("LabContact", ), vocabulary="_getLabContacts", write_permission=ManageBika, accessor="getSupervisorUID", widget=SelectionWidget( format="select", label=_("Supervisor"), description=_("Supervisor of the Lab"))), IntegerField( "Confidence", schemata="Accreditation", widget=IntegerWidget( label=_("Confidence Level %"), description=_("This value is reported at the bottom of all " "published results"), ), ), BooleanField( "LaboratoryAccredited",
allowed_types=('Container', ), relationship='SamplePartitionContainer', required=1, multiValued=0, ), ReferenceField( 'Preservation', allowed_types=('Preservation', ), relationship='SamplePartitionPreservation', required=0, multiValued=0, ), BooleanField('Separate', default=False), UIDReferenceField( 'Analyses', allowed_types=('Analysis', ), required=0, multiValued=1, ), DateTimeField('DatePreserved', ), StringField('Preserver', searchable=True), DurationField('RetentionPeriod', ), ComputedField( 'DisposalDate', expression='context.disposal_date()', widget=ComputedWidget(visible=False, ), ), )) schema['title'].required = False
from bika.lims.utils.analysis import get_significant_digits from bika.lims.workflow import doActionFor from bika.lims.workflow import getTransitionActor from bika.lims.workflow import getTransitionDate from bika.lims.workflow import isBasicTransitionAllowed from bika.lims.workflow import isTransitionAllowed from bika.lims.workflow import wasTransitionPerformed from bika.lims.workflow import skip from bika.lims.workflow.analysis import events from bika.lims.workflow.analysis import guards from plone.api.user import has_permission from zope.interface import implements # A link directly to the AnalysisService object used to create the analysis AnalysisService = UIDReferenceField( 'AnalysisService' ) # Attachments which are added manually in the UI, or automatically when # results are imported from a file supplied by an instrument. Attachment = UIDReferenceField( 'Attachment', multiValued=1, allowed_types=('Attachment',) ) # The final result of the analysis is stored here. The field contains a # String value, but the result itself is required to be numeric. If # a non-numeric result is needed, ResultOptions can be used. Result = StringField( 'Result'
from bika.lims.permissions import EditWorksheet, ManageWorksheets from bika.lims.permissions import Verify as VerifyPermission from bika.lims.utils import changeWorkflowState, tmpID from bika.lims.utils import to_utf8 as _c from bika.lims.workflow import doActionFor from bika.lims.workflow import getCurrentState from bika.lims.workflow import skip from bika.lims.workflow.worksheet import events from bika.lims.workflow.worksheet import guards from plone import api from zope.interface import implements schema = BikaSchema.copy() + Schema( ( UIDReferenceField( 'WorksheetTemplate', allowed_types=('WorksheetTemplate', ), ), RecordsField( 'Layout', required=1, subfields=('position', 'type', 'container_uid', 'analysis_uid'), subfield_types={'position': 'int'}, ), # all layout info lives in Layout; Analyses is used for back references. ReferenceField( 'Analyses', required=1, multiValued=1, allowed_types=('Analysis', 'DuplicateAnalysis', 'ReferenceAnalysis', 'RejectAnalysis'), relationship='WorksheetAnalysis',