コード例 #1
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Project',
            vocabulary_display_path_bound=sys.maxsize,
            allowed_types=('Project',),
            referenceClass=HoldingReference,
            relationship='AnalysisRequestProject',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bikaReferenceWidget(
                label=_("Project"),
                description=_("Select the project of the AR."),
                size=20,
                visible={'edit': 'invisible',
                         'view': 'visible',
                         'add': 'edit',
                         'header_table': 'visible',
                         'sample_due': {'view': 'visible', 'edit': 'invisible'},
                         'sample_received': {'view': 'visible', 'edit': 'invisible'},
                         'to_be_verified': {'view': 'visible', 'edit': 'invisible'},
                         'verified': {'view': 'visible', 'edit': 'invisible'},
                         'published': {'view': 'visible', 'edit': 'invisible'},
                         'invalid': {'view': 'visible', 'edit': 'invisible'},
                         'rejected': {'view': 'visible', 'edit': 'invisible'},
                         },
                catalog_name='bika_catalog',
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
コード例 #2
0
class SampleSchemaExtender(object):
    adapts(ISample)
    implements(IOrderableSchemaExtender)

    fields = [
        BestBeforeDateField(
            'BestBeforeDate',
            widget=bikaDateTimeWidget(
                label="Best Before Date",
                visible={'view': 'visible',
                         'edit': 'visible',
                         'header_table': 'visible'},
                modes=('view', 'edit')
            ),
        ),
        ExtStringField(
            'Vintage',
            required=False,
            widget=StringWidget(
                label="Vintage",
                render_own_label=True,
                size=20,
                visible={'edit': 'visible',
                         'view': 'visible',
                         'header_table': 'visible',
                         'sample_registered': {'view': 'visible',
                                               'edit': 'visible',
                                               'add': 'edit'},
                         'to_be_sampled': {'view': 'visible',
                                           'edit': 'visible'},
                         'sampled': {'view': 'visible',
                                     'edit': 'visible'},
                         'to_be_preserved': {'view': 'visible',
                                             'edit': 'visible'},
                         'sample_due': {'view': 'visible',
                                        'edit': 'visible'},
                         'sample_received': {'view': 'visible',
                                             'edit': 'visible'},
                         'published': {'view': 'visible',
                                       'edit': 'invisible'},
                         'invalid': {'view': 'visible',
                                     'edit': 'invisible'},
                         },
            ),
        ),
        ExtReferenceField(
            'Cultivar',
            required=0,
            allowed_types=('Cultivar'),
            relationship='SampleTypeCultivar',
            format='select',
            widget=bikaReferenceWidget(
                label="Cultivar",
                render_own_label=True,
                size=20,
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
                visible={'edit': 'visible',
                         'view': 'visible',
                         'header_table': 'visible',
                         'sample_registered': {'view': 'visible',
                                               'edit': 'visible',
                                               'add': 'edit'},
                         'to_be_sampled': {'view': 'visible',
                                           'edit': 'visible'},
                         'sampled': {'view': 'visible',
                                     'edit': 'visible'},
                         'to_be_preserved': {'view': 'visible',
                                             'edit': 'visible'},
                         'sample_due': {'view': 'visible',
                                        'edit': 'visible'},
                         'sample_received': {'view': 'visible',
                                             'edit': 'visible'},
                         'published': {'view': 'visible',
                                       'edit': 'invisible'},
                         'invalid': {'view': 'visible',
                                     'edit': 'invisible'},
                         },
            ),
        ),
        ExtStringField(
            'Tank',
            widget=StringWidget(
                label=_("Tank"),
                description=_("Tank identifier"),
                visible={'edit': 'visible',
                         'view': 'visible',
                         'header_table': 'visible',
                         'sample_registered': {'view': 'visible',
                                               'edit': 'visible',
                                               'add': 'edit'},
                         'to_be_sampled': {'view': 'visible',
                                           'edit': 'visible'},
                         'sampled': {'view': 'visible',
                                     'edit': 'visible'},
                         'to_be_preserved': {'view': 'visible',
                                             'edit': 'visible'},
                         'sample_due': {'view': 'visible',
                                        'edit': 'visible'},
                         'sample_received': {'view': 'visible',
                                             'edit': 'visible'},
                         'published': {'view': 'visible',
                                       'edit': 'invisible'},
                         'invalid': {'view': 'visible',
                                     'edit': 'invisible'},
                         },
                render_own_label=True,
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        default = schematas['default']
        # after SamplingDate
        if 'BestBeforeDate' in default:
            default.remove('BestBeforeDate')
        default.insert(default.index('SamplingDate'), 'BestBeforeDate')
        # after SampleID
        pos = default.index('SampleID')
        default.insert(pos, 'Vintage')
        default.insert(pos, 'Cultivar')
        default.insert(pos, 'Tank')
        return schematas

    def getFields(self):
        return self.fields
コード例 #3
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender)

    fields = [
        # This is included here but refers to the sample
        BestBeforeDateField(
            'BestBeforeDate',
            widget=bikaDateTimeWidget(label="Best Before Date",
                                      visible={
                                          'view': 'visible',
                                          'edit': 'visible'
                                      },
                                      modes=('view', 'edit')),
        ),
        VintageField(
            'Vintage',
            required=False,
            widget=StringWidget(
                label="Vintage",
                render_own_label=True,
                size=20,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'secondary': 'disabled',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible',
                        'add': 'edit'
                    },
                    'to_be_sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_preserved': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'attachment_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'published': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'invalid': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
            ),
        ),
        CultivarField(
            'Cultivar',
            required=0,
            allowed_types=['Cultivar'],
            relationship='SampleTypeCultivar',
            format='select',
            widget=bikaReferenceWidget(
                label="Cultivar",
                render_own_label=True,
                size=20,
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
                search_fields=('Title', 'description', 'Code'),
                colModel=[
                    {
                        'columnName': 'Code',
                        'width': '20',
                        'label': _('Code'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'Title',
                        'width': '25',
                        'label': _('Title'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'Description',
                        'width': '55',
                        'label': _('Description'),
                        'align': 'left'
                    },
                    # UID is required in colModel
                    {
                        'columnName': 'UID',
                        'hidden': True
                    },
                ],
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'secondary': 'disabled',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible',
                        'add': 'edit'
                    },
                    'to_be_sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_preserved': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'attachment_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'published': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'invalid': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
            ),
        ),
        TankField(
            'Tank',
            widget=StringWidget(
                label=_("Tank"),
                description=_("Tank identifier"),
                render_own_label=True,
                size=20,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'secondary': 'disabled',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible',
                        'add': 'edit'
                    },
                    'to_be_sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_preserved': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'attachment_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'published': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'invalid': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        default = schematas['default']
        # After SamplingDate
        if 'BestBeforeDate' in default:
            default.remove('BestBeforeDate')
        default.insert(default.index('SamplingDate'), 'BestBeforeDate')
        # After SampleType
        pos = schematas['default'].index('SampleType')
        schematas['default'].insert(pos, 'Vintage')
        schematas['default'].insert(pos, 'Cultivar')
        schematas['default'].insert(pos, 'Tank')
        return schematas

    def getFields(self):
        return self.fields
コード例 #4
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Project',
            vocabulary_display_path_bound=sys.maxsize,
            allowed_types=('Project',),
            referenceClass=HoldingReference,
            relationship='AnalysisRequestProject',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bikaReferenceWidget(
                label=_("Project"),
                description=_("Select the project of the AR."),
                size=20,
                visible={'edit': 'invisible',
                         'view': 'visible',
                         'add': 'edit',
                         'header_table': 'visible',
                         'sample_due': {'view': 'visible', 'edit': 'invisible'},
                         'sample_received': {'view': 'visible', 'edit': 'invisible'},
                         'to_be_verified': {'view': 'visible', 'edit': 'invisible'},
                         'verified': {'view': 'visible', 'edit': 'invisible'},
                         'published': {'view': 'visible', 'edit': 'invisible'},
                         'invalid': {'view': 'visible', 'edit': 'invisible'},
                         'rejected': {'view': 'visible', 'edit': 'invisible'},
                         },
                catalog_name='bika_catalog',
            ),
        ),
        ExtReferenceField(
            'Sample',
            allowed_types=('VirusSample', 'Sample'),
            referenceClass=HoldingReference,
            relationship='AnalysisRequestSample',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bikaReferenceWidget(
                label=_("Sample"),
                description=_("Select a sample to create a secondary AR"),
                size=20,
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible',
                    'sample_registered': {'view': 'visible', 'edit': 'visible', 'add': 'edit'},
                    'to_be_sampled': {'view': 'visible', 'edit': 'invisible'},
                    'scheduled_sampling': {'view': 'visible', 'edit': 'invisible'},
                    'sampled': {'view': 'visible', 'edit': 'invisible'},
                    'to_be_preserved': {'view': 'visible', 'edit': 'invisible'},
                    'sample_due': {'view': 'visible', 'edit': 'invisible'},
                    'sample_prep': {'view': 'visible', 'edit': 'invisible'},
                    'sample_received': {'view': 'visible', 'edit': 'invisible'},
                    'attachment_due': {'view': 'visible', 'edit': 'invisible'},
                    'to_be_verified': {'view': 'visible', 'edit': 'invisible'},
                    'verified': {'view': 'visible', 'edit': 'invisible'},
                    'published': {'view': 'visible', 'edit': 'invisible'},
                    'invalid': {'view': 'visible', 'edit': 'invisible'},
                    'rejected': {'view': 'visible', 'edit': 'invisible'},
                },
                showOn=True,
                catalog_name='portal_catalog',
                base_query={'object_provides': ISample.__identifier__},
            ),
        ),
        ExtFixedPointField(
            'Volume',
            required=1,
            default="0.00",
            widget=DecimalWidget(
                label=_("Volume"),
                size=15,
                description=_("The sample volume needed for the analyses."),
                visible={'edit': 'visible',
                         'view': 'visible',
                         'add': 'edit',
                         'header_table': 'visible',
                         'sample_due': {'view': 'visible', 'edit': 'invisible'},
                         'sample_received': {'view': 'visible', 'edit': 'invisible'},
                         'to_be_verified': {'view': 'visible', 'edit': 'invisible'},
                         'verified': {'view': 'visible', 'edit': 'invisible'},
                         'published': {'view': 'visible', 'edit': 'invisible'},
                         'invalid': {'view': 'visible', 'edit': 'invisible'},
                         'rejected': {'view': 'visible', 'edit': 'invisible'},
                         },
                render_own_label=True,
            )
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        sch = schematas['default']
        sch.remove('Volume')
        sch.insert(sch.index('Batch'), 'Volume')
        return schematas

    def getFields(self):
        return self.fields
コード例 #5
0
ファイル: sample.py プロジェクト: rockfruit/ace.lims
class SampleSchemaExtender(object):
    adapts(ISample)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Strain',
            required=True,
            allowed_types=('Strain'),
            relationship='SampleTypeStrain',
            format='select',
            widget=bikaReferenceWidget(
                label="Strain",
                render_own_label=True,
                size=20,
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible',
                        'add': 'edit'
                    },
                    'to_be_sampled': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'to_be_preserved': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'published': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'invalid': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
            ),
        ),
        ExtStringField('Lot',
                       mode="rw",
                       read_permission=permissions.View,
                       write_permission=permissions.ModifyPortalContent,
                       widget=StringWidget(label=_("Lot"),
                                           description="",
                                           visible={
                                               'view': 'visible',
                                               'edit': 'visible',
                                               'header_table': 'visible',
                                               'add': 'edit'
                                           },
                                           render_own_label=True,
                                           size=20)),
        ExtStringField('CultivationBatch',
                       mode="rw",
                       read_permission=permissions.View,
                       write_permission=permissions.ModifyPortalContent,
                       widget=StringWidget(label=_("Cultivation Batch"),
                                           description="",
                                           visible={
                                               'view': 'visible',
                                               'edit': 'visible',
                                               'header_table': 'visible',
                                               'add': 'edit'
                                           },
                                           render_own_label=True,
                                           size=20)),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        default = schematas['default']
        default.append('Strain')
        default.append('Lot')
        default.append('CultivationBatch')
        return schematas

    def getFields(self):
        return self.fields