Пример #1
0
    def __init__(self, context, request):
        super(AnalysisRequestsView, self).__init__(context, request)
        self.columns.update({
            'WorksOrderID': {
                'title': _('Works Order ID')
            },
            'BlendNumber': {
                'title': _('Blend Number')
            },
            'Cultivar': {
                'title': _('Cultivar')
            },
            'Vintage': {
                'title': _('Vintage')
            },
            'Tank': {
                'title': _('Tank')
            },
        })

        new_states = []
        for state in self.review_states:
            pos = state['columns'].index('BatchID') + 1
            state['columns'].insert(pos, 'BlendNumber')
            state['columns'].insert(pos, 'WorksOrderID')
            state['columns'].insert(pos, 'Tank')
            state['columns'].insert(pos, 'Vintage')
            state['columns'].insert(pos, 'Cultivar')
            new_states.append(state)
        self.review_states = new_states
Пример #2
0
    def __init__(self, context, request):
        super(RegionsView, self).__init__(context, request)
        self.catalog = "bika_setup_catalog"
        self.contentFilter = {"portal_type": "Country", "sort_on": "sortable_title"}
        self.context_actions = {
            _("Add country"): {"url": "createObject?type_name=Country", "icon": "++resource++bika.lims.images/add.png"}
        }
        self.icon = self.portal_url + "/++resource++bika.wine.images/region.png"
        self.title = self.context.translate(_("Regions"))
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25

        self.columns = {"Title": {"title": _("Country"), "index": "sortable_title"}}

        self.review_states = [
            {
                "id": "default",
                "title": _b("Active"),
                "contentFilter": {"inactive_state": "active"},
                "transitions": [{"id": "deactivate"}],
                "columns": ["Title"],
            },
            {
                "id": "inactive",
                "title": _b("Inactive"),
                "contentFilter": {"inactive_state": "inactive"},
                "transitions": [{"id": "activate"}],
                "columns": ["Title"],
            },
            {"id": "all", "title": _b("All"), "contentFilter": {}, "columns": ["Title"]},
        ]
Пример #3
0
    def __init__(self, context, request):
        super(BatchFolderContentsView, self).__init__(context, request)

        self.columns = {
            'BatchID': {'title': _('Batch ID')},
            'Title': {'title': _b('Title')},
            'WorksOrderID': {'title': _('Works Order ID')},
            'BlendNumber': {'title': _('Blend Name')},
            'Description': {'title': _b('Description')},
            'state_title': {'title': _b('State'), 'sortable': False},
        }

        self.review_states = [  # leave these titles and ids alone
            {'id': 'default',
             'title': _b('All'),
             'contentFilter': {},
             'columns': ['BatchID',
                         'Title',
                         'BlendNumber',
                         'WorksOrderID',
                         'Description',
                         'state_title', ]
             },
            {'id': 'open',  # in bika.lims, this is 'default'.
             'contentFilter': {'cancellation_state': 'active',
                               'review_state': ['open',
                                                'received',
                                                'to_be_verified',
                                                'verified']},
             'title': _b('Open'),
             'columns': ['BatchID',
                         'Title',
                         'BlendNumber',
                         'WorksOrderID',
                         'Description',
                         'state_title', ]
             },
            {'id': 'closed',
             'contentFilter': {'review_state': 'closed'},
             'title': _b('Closed'),
             'columns': ['BatchID',
                         'Title',
                         'BlendNumber',
                         'WorksOrderID',
                         'Description',
                         'state_title', ]
             },
            {'id': 'cancelled',
             'title': _b('Cancelled'),
             'contentFilter': {'cancellation_state': 'cancelled'},
             'columns': ['BatchID',
                         'Title',
                         'BlendNumber',
                         'WorksOrderID',
                         'Description',
                         'state_title', ]
             },
        ]
Пример #4
0
    def __init__(self, context, request):
        super(AnalysisRequestsView, self).__init__(context, request)
        self.columns.update({
            'WorksOrderID': {'title': _('Works Order ID')},
            'BlendNumber': {'title': _('Blend Number')},
        })

        new_states = []
        for state in self.review_states:
            pos = state['columns'].index('BatchID') + 1
            state['columns'].insert(pos, 'BlendNumber')
            state['columns'].insert(pos, 'WorksOrderID')
            new_states.append(state)
        self.review_states = new_states
Пример #5
0
    def __init__(self, context, request):
        super(SamplesView, self).__init__(context, request)
        self.columns.update({
            'Cultivar': {'title': _('Cultivar')},
            'Vintage': {'title': _('Vintage')},

        })

        new_states = []
        for state in self.review_states:
            pos = state['columns'].index('Requests') + 1
            state['columns'].insert(pos, 'Vintage')
            state['columns'].insert(pos, 'Cultivar')
            new_states.append(state)
        self.review_states = new_states
Пример #6
0
    def __init__(self, context, request):
        super(CountryRegionsView, self).__init__(context, request)
        self.catalog = 'bika_setup_catalog'
        path = "/".join(self.context.getPhysicalPath())
        self.contentFilter = {'portal_type': 'Region',
                              'sort_on': 'sortable_title',
                              'path': {'query': path, 'level': 0}
                              }
        self.context_actions = {
            _('Add Region'): {
                'url': 'createObject?type_name=Region',
                'icon': '++resource++bika.lims.images/add.png'
            }
        }
        self.icon = self.portal_url + \
            "/++resource++bika.wine.images/region.png"
        self.title = self.context.Title()
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25

        self.columns = {
            'Title': {'title': _('Region'),
                      'index': 'sortable_title'},
        }

        self.review_states = [
            {'id': 'default',
             'title': _b('Active'),
             'contentFilter': {'inactive_state': 'active'},
             'transitions': [{'id': 'deactivate'}, ],
             'columns': ['Title']},
            {'id': 'inactive',
             'title': _b('Inactive'),
             'contentFilter': {'inactive_state': 'inactive'},
             'transitions': [{'id': 'activate'}, ],
             'columns': ['Title']},
            {'id': 'all',
             'title': _b('All'),
             'contentFilter': {},
             'columns': ['Title']},
        ]

        return super(CountryRegionsView, self).__init__(context, request)
Пример #7
0
    def __init__(self, context, request):
        super(SamplesView, self).__init__(context, request)
        self.columns.update({
            'Cultivar': {
                'title': _('Cultivar')
            },
            'Vintage': {
                'title': _('Vintage')
            },
        })

        new_states = []
        for state in self.review_states:
            pos = state['columns'].index('Requests') + 1
            state['columns'].insert(pos, 'Vintage')
            state['columns'].insert(pos, 'Cultivar')
            new_states.append(state)
        self.review_states = new_states
Пример #8
0
    def __init__(self, context, request):
        super(CultivarsView, self).__init__(context, request)
        self.catalog = 'bika_setup_catalog'
        self.contentFilter = {'portal_type': 'Cultivar',
                              'sort_on': 'sortable_title'}
        self.context_actions = {
            _b('Add'): {
                'url': 'createObject?type_name=Cultivar',
                'icon': '++resource++bika.lims.images/add.png'
            }
        }
        self.icon = self.portal_url + \
            "/++resource++bika.wine.images/winetype_big.png"
        self.title = self.context.translate(_("Cultivars"))
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25

        self.columns = {
            'Title': {'title': _('Cultivar'),
                      'index': 'sortable_title'},
            'Description': {'title': _b('Description'),
                            'index': 'description',
                            'toggle': True},
        }

        self.review_states = [
            {'id': 'default',
             'title': _b('Active'),
             'contentFilter': {'inactive_state': 'active'},
             'transitions': [{'id': 'deactivate'}, ],
             'columns': ['Title', 'Description']},
            {'id': 'inactive',
             'title': _b('Inactive'),
             'contentFilter': {'inactive_state': 'inactive'},
             'transitions': [{'id': 'activate'}, ],
             'columns': ['Title', 'Description']},
            {'id': 'all',
             'title': _b('All'),
             'contentFilter': {},
             'columns': ['Title', 'Description']},
        ]
Пример #9
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
Пример #10
0
    def __init__(self, context, request):
        super(BatchFolderContentsView, self).__init__(context, request)

        self.columns = {
            'BatchID': {
                'title': _('Batch ID')
            },
            'Title': {
                'title': _b('Title')
            },
            'WorksOrderID': {
                'title': _('Works Order ID')
            },
            'BlendNumber': {
                'title': _('Blend Name')
            },
            'Description': {
                'title': _b('Description')
            },
            'state_title': {
                'title': _b('State'),
                'sortable': False
            },
        }

        self.review_states = [  # leave these titles and ids alone
            {
                'id':
                'default',
                'title':
                _b('All'),
                'contentFilter': {},
                'columns': [
                    'BatchID',
                    'Title',
                    'BlendNumber',
                    'WorksOrderID',
                    'Description',
                    'state_title',
                ]
            },
            {
                'id':
                'open',  # in bika.lims, this is 'default'.
                'contentFilter': {
                    'cancellation_state':
                    'active',
                    'review_state':
                    ['open', 'received', 'to_be_verified', 'verified']
                },
                'title':
                _b('Open'),
                'columns': [
                    'BatchID',
                    'Title',
                    'BlendNumber',
                    'WorksOrderID',
                    'Description',
                    'state_title',
                ]
            },
            {
                'id':
                'closed',
                'contentFilter': {
                    'review_state': 'closed'
                },
                'title':
                _b('Closed'),
                'columns': [
                    'BatchID',
                    'Title',
                    'BlendNumber',
                    'WorksOrderID',
                    'Description',
                    'state_title',
                ]
            },
            {
                'id':
                'cancelled',
                'title':
                _b('Cancelled'),
                'contentFilter': {
                    'cancellation_state': 'cancelled'
                },
                'columns': [
                    'BatchID',
                    'Title',
                    'BlendNumber',
                    'WorksOrderID',
                    'Description',
                    'state_title',
                ]
            },
        ]
    def __init__(self, context, request):
        super(TransportConditionsView, self).__init__(context, request)
        self.catalog = 'bika_setup_catalog'
        self.contentFilter = {
            'portal_type': 'TransportCondition',
            'sort_on': 'sortable_title'
        }
        self.context_actions = {
            _b('Add'): {
                'url': 'createObject?type_name=TransportCondition',
                'icon': '++resource++bika.lims.images/add.png'
            }
        }
        self.icon = self.portal_url + \
            "/++resource++bika.wine.images/transportcondition_big.png"
        self.title = self.context.translate(_("Transport conditions"))
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25

        self.columns = {
            'Title': {
                'title': _('Transport condition'),
                'index': 'sortable_title'
            },
            'Description': {
                'title': _b('Description'),
                'index': 'description',
                'toggle': True
            },
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _b('Active'),
                'contentFilter': {
                    'inactive_state': 'active'
                },
                'transitions': [
                    {
                        'id': 'deactivate'
                    },
                ],
                'columns': ['Title', 'Description']
            },
            {
                'id': 'inactive',
                'title': _b('Inactive'),
                'contentFilter': {
                    'inactive_state': 'inactive'
                },
                'transitions': [
                    {
                        'id': 'activate'
                    },
                ],
                'columns': ['Title', 'Description']
            },
            {
                'id': 'all',
                'title': _b('All'),
                'contentFilter': {},
                'columns': ['Title', 'Description']
            },
        ]
Пример #12
0
from AccessControl import ClassSecurityInfo
from Products.Archetypes.public import *
from bika.lims.content.bikaschema import BikaSchema
from bika.wine.interfaces import ICultivar
from bika.wine.config import PROJECTNAME
from zope.interface import implements
from bika.wine import bikaMessageFactory as _

schema = BikaSchema.copy() + Schema((
    StringField(
        'Code',
        required=0,
        mode="rw",
        widget=StringWidget(
            label=_("Cultivar Code"),
            description=_("Code to quickly identify the cultivar"),
            visible={'edit': 'visible',
                     'view': 'visible'},
        ),
    ),
))
schema.moveField('Code', before='title')
schema['description'].widget.visible = True
schema['description'].schemata = 'default'


class Cultivar(BaseContent):
    implements(ICultivar)
    security = ClassSecurityInfo()
    displayContentsTab = False
    schema = schema
Пример #13
0
class SampleTypeSchemaExtender(object):
    adapts(ISampleType)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtStringField(
            'Vintage',
            required=False,
            widget=StringWidget(label="Vintage", ),
        ),
        ExtReferenceField(
            'WineType',
            required=0,
            allowed_types=('WineType'),
            referenceClass=HoldingReference,
            relationship='SampleTypeWineType',
            format='select',
            widget=bikaReferenceWidget(
                label="Wine type",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'visible'
                },
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
            ),
        ),
        ExtReferenceField(
            'Cultivar',
            required=0,
            allowed_types=('Cultivar'),
            referenceClass=HoldingReference,
            relationship='SampleTypeCultivar',
            format='select',
            widget=bikaReferenceWidget(
                label="Cultivar",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'visible'
                },
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
            ),
        ),
        ExtFloatField(
            'LabelAlcohol',
            required=False,
            validators=('percentvalidator'),
            widget=bikaDecimalWidget(
                label="Label Alcohol",
                unit='%',
            ),
        ),
        ExtReferenceField(
            'Region',
            required=0,
            allowed_types=('Region', ),
            referenceClass=HoldingReference,
            relationship='SampleTypeRegion',
            format='select',
            widget=bikaReferenceWidget(
                label="Region",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'visible'
                },
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
                ui_item='Name',
                colModel=[
                    {
                        'columnName': 'Name',
                        'width': '100',
                        'label': _('Title'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'UID',
                        'hidden': True
                    },
                ],
            ),
        ),
        ExtReferenceField(
            'TransportConditions',
            multiValued=1,
            required=0,
            allowed_types=('TransportCondition'),
            referenceClass=HoldingReference,
            relationship='SampleTypeTransportCondition',
            format='select',
            widget=bikaReferenceWidget(
                label="TransportCondition",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'visible'
                },
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
            ),
        ),
        ExtReferenceField(
            'StorageConditions',
            multiValued=1,
            required=0,
            allowed_types=('StorageCondition'),
            referenceClass=HoldingReference,
            relationship='SampleTypeStorageCondition',
            format='select',
            widget=bikaReferenceWidget(
                label="StorageCondition",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'visible'
                },
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
            ),
        ),
        ExtStringField(
            'ShelfLifeType',
            required=False,
            widget=StringWidget(
                label="Shelf life type",
                description="Shelf life text to be printed on COA",
            ),
        ),
        ExtStringField(
            'ShelfLife',
            required=False,
            widget=StringWidget(
                label="Shelf life",
                description="Shelf life in months",
            ),
        ),
    ]

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

    def getOrder(self, schematas):
        default = schematas['default']
        # default.remove('...')
        # default.insert(default.index('Field'), 'NewField')
        schematas['default'] = default
        schematas['wine'] = [
            'WineType', 'Vintage', 'Cultivar', 'Region', 'LabelAlcohol',
            'TransportConditions', 'StorageConditions', 'ShelfLifeType',
            'ShelfLife'
        ]
        return schematas

    def getFields(self):
        return self.fields
Пример #14
0
    def __init__(self, context, request):
        super(CountryRegionsView, self).__init__(context, request)
        self.catalog = 'bika_setup_catalog'
        path = "/".join(self.context.getPhysicalPath())
        self.contentFilter = {
            'portal_type': 'Region',
            'sort_on': 'sortable_title',
            'path': {
                'query': path,
                'level': 0
            }
        }
        self.context_actions = {
            _('Add Region'): {
                'url': 'createObject?type_name=Region',
                'icon': '++resource++bika.lims.images/add.png'
            }
        }
        self.icon = self.portal_url + \
            "/++resource++bika.wine.images/region.png"
        self.title = self.context.Title()
        self.description = ""
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = True
        self.pagesize = 25

        self.columns = {
            'Title': {
                'title': _('Region'),
                'index': 'sortable_title'
            },
        }

        self.review_states = [
            {
                'id': 'default',
                'title': _b('Active'),
                'contentFilter': {
                    'inactive_state': 'active'
                },
                'transitions': [
                    {
                        'id': 'deactivate'
                    },
                ],
                'columns': ['Title']
            },
            {
                'id': 'inactive',
                'title': _b('Inactive'),
                'contentFilter': {
                    'inactive_state': 'inactive'
                },
                'transitions': [
                    {
                        'id': 'activate'
                    },
                ],
                'columns': ['Title']
            },
            {
                'id': 'all',
                'title': _b('All'),
                'contentFilter': {},
                'columns': ['Title']
            },
        ]

        return super(CountryRegionsView, self).__init__(context, request)
Пример #15
0
from AccessControl import ClassSecurityInfo
from Products.Archetypes.public import *
from bika.lims.content.bikaschema import BikaSchema
from bika.wine.interfaces import ICultivar
from bika.wine.config import PROJECTNAME
from zope.interface import implements
from bika.wine import bikaMessageFactory as _

schema = BikaSchema.copy() + Schema((StringField(
    'Code',
    required=0,
    mode="rw",
    widget=StringWidget(
        label=_("Cultivar Code"),
        description=_("Code to quickly identify the cultivar"),
        visible={
            'edit': 'visible',
            'view': 'visible'
        },
    ),
), ))
schema.moveField('Code', before='title')
schema['description'].widget.visible = True
schema['description'].schemata = 'default'


class Cultivar(BaseContent):
    implements(ICultivar)
    security = ClassSecurityInfo()
    displayContentsTab = False
    schema = schema