RecordsField('Partitions', schemata = 'Sample Partitions', required = 0, type = 'artemplate_parts', subfields = ('part_id', 'Container', 'Preservation', 'container_uid', 'preservation_uid'), subfield_labels = {'part_id': _('Partition'), 'Container': _('Container'), 'Preservation': _('Preservation')}, subfield_sizes = {'part_id': 15, 'Container': 35, 'Preservation': 35}, subfield_hidden = {'preservation_uid': True, 'container_uid': True}, default = [{'part_id':'part-1', 'Container':'', 'Preservation':'', 'container_uid':'', 'preservation_uid':''}], widget=ARTemplatePartitionsWidget( label = _("Sample Partitions"), description = _("Configure the sample partitions and preservations " + \ "for this template. Assign analyses to the different " + \ "partitions on the template's Analyses tab"), combogrid_options={ 'Container': { 'colModel': [ {'columnName':'container_uid', 'hidden':True}, {'columnName':'Container', 'width':'30', 'label':_('Container')}, {'columnName':'Description', 'width':'70', 'label':_('Description')}], 'url': 'getcontainers', 'showOn': True, 'width': '550px' }, 'Preservation': { 'colModel': [ {'columnName':'preservation_uid', 'hidden':True}, {'columnName':'Preservation', 'width':'30', 'label':_('Preservation')}, {'columnName':'Description', 'width':'70', 'label':_('Description')}], 'url': 'getpreservations', 'showOn': True, 'width': '550px' }, }, ), ),
RecordsField('ResultsRange', # schemata = 'Specifications', required = 1, type = 'analysisspec', subfields = ('keyword', 'min', 'max', 'error', 'hidemin', 'hidemax', 'rangecomment'), required_subfields = ('keyword', 'error'), subfield_validators = {'min':'analysisspecs_validator', 'max':'analysisspecs_validator', 'error':'analysisspecs_validator',}, subfield_labels = {'keyword': _('Analysis Service'), 'min': _('Min'), 'max': _('Max'), 'error': _('% Error'), 'hidemin': _('< Min'), 'hidemax': _('> Max'), 'rangecomment': _('Range Comment')}, widget = AnalysisSpecificationWidget( checkbox_bound = 0, label = _("Specifications"), description = _("Click on Analysis Categories (against shaded background) " "to see Analysis Services in each category. Enter minimum " "and maximum values to indicate a valid results range. " "Any result outside this range will raise an alert. " "The % Error field allows for an % uncertainty to be " "considered when evaluating results against minimum and " "maximum values. A result out of range but still in range " "if the % error is taken into consideration, will raise a " "less severe alert. If the result is below '< Min' " "the result will be shown as '< [min]'. The same " "applies for results above '> Max'"), ), ),
from bika.lims.config import ANALYSIS_TYPES, PROJECTNAME from bika.lims.content.bikaschema import BikaSchema schema = BikaSchema.copy() + Schema(( RecordsField( 'Layout', schemata='Layout', required=1, type='templateposition', subfields=('pos', 'type', 'blank_ref', 'control_ref', 'dup'), required_subfields=('pos', 'type'), subfield_labels={ 'pos': _('Position'), 'type': _('Analysis Type'), 'blank_ref': _('Reference'), 'control_ref': _('Reference'), 'dup': _('Duplicate Of') }, widget=WorksheetTemplateLayoutWidget( label=_("Worksheet Layout"), description= _("Specify the size of the Worksheet, e.g. corresponding to a " "specific instrument's tray size. Then select an Analysis 'type' " "per Worksheet position. Where QC samples are selected, also select " "which Reference Sample should be used. If a duplicate analysis is " "selected, indicate which sample position it should be a duplicate of" ), )), BooleanField( 'RemoveTrailingEmptySlots', schemata='Layout', required=False,
from Products.ATExtensions.field.records import RecordsField schema = BikaSchema.copy() + Schema(( RecordsField( "Layout", schemata="Layout", required=1, type="templateposition", subfields=("pos", "type", "blank_ref", "control_ref", "dup"), required_subfields=("pos", "type"), subfield_labels={ "pos": _("Position"), "type": _("Analysis Type"), "blank_ref": _("Reference"), "control_ref": _("Reference"), "dup": _("Duplicate Of") }, widget=WorksheetTemplateLayoutWidget( label=_("Worksheet Layout"), description=_( "Specify the size of the Worksheet, e.g. corresponding to a " "specific instrument's tray size. " "Then select an Analysis 'type' per Worksheet position." "Where QC samples are selected, also select which Reference " "Sample should be used." "If a duplicate analysis is selected, indicate which sample " "position it should be a duplicate of"), )), ReferenceField( "Service", schemata="Analyses",
RecordsField( 'ResultsRange', # schemata = 'Specifications', required=1, type='resultsrange', subfields=('keyword', 'min_operator', 'min', 'max_operator', 'max', 'warn_min', 'warn_max', 'hidemin', 'hidemax', 'rangecomment'), required_subfields=('keyword', 'min', 'max'), subfield_validators={ 'min': 'analysisspecs_validator', 'max': 'analysisspecs_validator', }, subfield_labels={ 'keyword': _('Analysis Service'), 'min_operator': _('Min operator'), 'min': _('Min'), 'max_operator': _('Max operator'), 'max': _('Max'), 'warn_min': _('Min warn'), 'warn_max': _('Max warn'), 'hidemin': _('< Min'), 'hidemax': _('> Max'), 'rangecomment': _('Range Comment'), }, widget=AnalysisSpecificationWidget( checkbox_bound=0, label=_("Specifications"), description=_( "'Min' and 'Max' values indicate a valid results range. Any " "result outside this results range will raise an alert. 'Min " "warn' and 'Max warn' values indicate a shoulder range. Any " "result outside the results range but within the shoulder " "range will raise a less severe alert. If the result is out of " "range, the value set for '< Min' or '< Max' will be displayed " "in lists and results reports instead of the real result.")), ),
label=_('Remarks'), append_only=True, ), ), RecordsField( 'Partitions', schemata='Sample Partitions', required=0, type='artemplate_parts', subfields=('part_id', 'container_uid', 'preservation_uid'), subfield_labels={ 'part_id': _('Partition'), 'container_uid': _('Container'), 'preservation_uid': _('Preservation') }, default=[{ 'part_id': 'part-1', 'container_uid': '', 'preservation_uid': '' }], widget=ARTemplatePartitionsWidget( label=_("Sample Partitions"), description=_( "Configure the sample partitions and preservations " "for this template. Assign analyses to the different " "partitions on the template's Analyses tab"), )), ReferenceField( 'AnalysisProfile', schemata='Analyses', required=0,
), )) + \ BikaSchema.copy() + \ Schema(( RecordsField('ResultsRange', schemata = PMF('Reference Results'), required = 1, type = 'analysisspec', subfields = ('keyword', 'min', 'max', 'error'), required_subfields = ('keyword', 'min', 'max', 'error'), subfield_labels = {'keyword': _('Analysis Service'), 'min': _('Min'), 'max': _('Max'), 'error': _('% Error')}, widget = SpecWidget( checkbox_bound = 1, label = _("Reference Results"), description = _("Click on Analysis Categories (against shaded background) " "to see Analysis Services in each category. Enter minimum " "and maximum values to indicate a valid results range. " "Any result outside this range will raise an alert. " "The % Error field allows for an % uncertainty to be " "considered when evaluating results against minimum and " "maximum values. A result out of range but still in range " "if the % error is taken into consideration, will raise a " "less severe alert."), ), ), ComputedField('ClientUID', expression = "context.aq_parent.UID()", widget = ComputedWidget( visible = False,