def set(self, instance, value, **kwargs): _field = instance.Schema().getField('InheritedObjects') uids = [] if value: bc = getToolByName(instance, 'bika_catalog') ids = [x['ObjectID'] for x in value] if ids: proxies = bc(id=ids) if proxies: uids = [x.UID for x in proxies] RecordsField.set(self, instance, value) return _field.set(instance, uids)
( HistoryAwareReferenceField( 'WorksheetTemplate', allowed_types=('WorksheetTemplate', ), relationship='WorksheetAnalysisTemplate', ), ComputedField( 'WorksheetTemplateTitle', searchable=True, expression= "context.getWorksheetTemplate() and context.getWorksheetTemplate().Title() or ''", widget=ComputedWidget(visible=False, ), ), 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', ), StringField( 'Analyst', searchable=True, ),
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'"), ), ),
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' }, }, ), ),
'InstrumentUID', expression= 'context.getInstrument() and context.getInstrument().UID() or None', widget=ComputedWidget(visible=False, ), ), StringField( 'Type', vocabulary="getTaskTypes", widget=ReferenceWidget( checkbox_bound=0, label=_("Task type", "Type"), ), ), RecordsField( 'ScheduleCriteria', required=1, type='schedulecriteria', widget=ScheduleInputWidget(label=_("Criteria"), ), ), TextField( 'Considerations', default_content_type='text/plain', allowed_content_types=('text/plain', ), default_output_type="text/plain", widget=TextAreaWidget( label=_("Considerations"), description=_( "Remarks to take into account before performing the task"), ), ), ))
from dependencies.dependency import implements import sys 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', required=1,
vocabulary = "getDataInterfacesList", widget = ReferenceWidget( checkbox_bound = 0, label=_("Data Interface"), description=_("Select an Import/Export interface for this instrument."), visible = False, ), ), #TODO: To be removed? RecordsField('DataInterfaceOptions', type = 'interfaceoptions', subfields = ('Key','Value'), required_subfields = ('Key','Value'), subfield_labels = {'OptionValue': _('Key'), 'OptionText': _('Value'),}, widget = RecordsWidget( label=_("Data Interface Options"), description=_("Use this field to pass arbitrary parameters to the export/import modules."), visible = False, ), ), # References to all analyses performed with this instrument. # Includes regular analyses, QC analyes and Calibration tests. ReferenceField('Analyses', required = 0, multiValued = 1, allowed_types = ('ReferenceAnalysis', 'DuplicateAnalysis', 'Analysis'), relationship = 'InstrumentAnalyses', widget = ReferenceWidget(
allowable_content_types = ('text/plain', ), default_output_type="text/plain", widget = TextAreaWidget( macro = "bika_widgets/remarks", label = _("Remarks"), append_only = True, ), ), # Custom settings for the assigned analysis services # https://jira.bikalabs.com/browse/LIMS-1324 # Fields: # - uid: Analysis Service UID # - hidden: True/False. Hide/Display in results reports RecordsField('AnalysisServicesSettings', required=0, subfields=('uid', 'hidden',), widget=ComputedWidget(visible=False), ), StringField('CommercialID', searchable=1, required=0, schemata='Accounting', widget=StringWidget( visible={'view': 'visible', 'edit': 'visible'}, label=_('Commercial ID'), description=_("The profile's commercial ID for accounting purposes."), ), ), # When it's set, the system uses the analysis profile's price to quote and the system's VAT is overridden by the # the analysis profile's specific VAT BooleanField('UseAnalysisProfilePrice',
from lims.content.bikaschema import BikaSchema schema = BikaSchema.copy() + Schema(( ReferenceField( 'AnalysisRequest', allowed_types=('AnalysisRequest', ), relationship='ReportAnalysisRequest', referenceClass=HoldingReference, required=1, ), BlobField('Pdf', ), StringField('Html', ), StringField('SMS', ), RecordsField( 'Recipients', type='recipients', subfields=('UID', 'Username', 'Fullname', 'EmailAddress', 'PublicationModes'), ), )) schema['id'].required = False schema['title'].required = False class ARReport(BaseFolder): security = ClassSecurityInfo() displayContentsTab = False schema = schema _at_rename_after_creation = True