Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
    def get(self, instance, **kwargs):
        an_interims = RecordsField.get(self, instance, **kwargs) or []
        if not IAnalysisService.providedBy(instance):
            return an_interims

        # This instance implements IAnalysisService
        calculation = instance.getCalculation()
        if not calculation:
            return an_interims

        # Ensure the service includes the interims from the calculation
        an_keys = map(lambda interim: interim['keyword'], an_interims)
        # Avoid references from the service interims to the calculation interims
        calc_interims = copy.deepcopy(calculation.getInterimFields())
        calc_interims = filter(lambda inter: inter['keyword'] not in an_keys,
                               calc_interims)
        return an_interims + calc_interims
Exemplo n.º 4
0
from bika.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
Exemplo n.º 5
0
from baobab.lims.interfaces import IKitTemplate

schema = BikaSchema.copy() + Schema((
    RecordsField(
        'ProductList',
        schemata='Product List',
        type='productList',
        subfields=('product', 'quantity', 'product_uid'),
        subfield_hidden = {'product_uid': True},
        required_subfields=('product', 'quantity', 'product_uid'),
        subfield_sizes={'product': 50, 'quantity': 5,},
        subfield_labels={'product': _('Product'),
                         'quantity': _('Quantity'),
        },
        widget=RecordsWidget(
            label = _("Product List"),
            description=_("Select complete list of the components required to create this kit"),
            combogrid_options={
                 'product': {
                     'colModel': [{'columnName':'product', 'width':'30', 'label':_('Title')},
                                  {'columnName':'Description', 'width':'70', 'label':_('Description')},
                                  {'columnName': 'product_uid', 'hidden': True}],
                     'url': 'getproducts',
                     'showOn': True,
                     'width': '550px'
                 },
            },
        ),
    ),
    FixedPointField(
        'Cost',
        schemata='Accounting',
Exemplo n.º 6
0
schema = BikaSchema.copy() + Schema((
    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,
    ),
    # TODO Remove. Instruments must be assigned directly to each analysis.
    ReferenceField('Instrument',
        required = 0,
Exemplo n.º 7
0
         ],
     ),
 ),
 RecordField(
     "Metadata",
     multiValued=True,
 ),
 BlobField(
     "Pdf",
 ),
 RecordsField(
     "Recipients",
     type="recipients",
     subfields=(
         "UID",
         "Username",
         "Fullname",
         "EmailAddress",
         "PublicationModes"
     ),
 ),
 DateTimeField(
     "DatePrinted",
     mode="rw",
     widget=DateTimeWidget(
         label=_("Date Printed"),
         visible={
             "edit": "visible",
             "view": "visible",
         }
     ),
Exemplo n.º 8
0
            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,
Exemplo n.º 9
0
     ),
 ),
 StringField(
     'IDServerURL',
     schemata="ID Server",
     widget=StringWidget(
         label=_("ID Server URL"),
         description=_("The full URL: http://URL/path:port")
     ),
 ),
 RecordsField(
     'RejectionReasons',
     schemata="Analyses",
     widget=RejectionSetupWidget(
         label=_("Enable the rejection workflow"),
         description=_("Select this to activate the rejection workflow "
                       "for Samples and Analysis Requests. A 'Reject' "
                       "option will be displayed in the actions menu for "
                       "these objects.")
     ),
 ),
 BooleanField(
     'NotifyOnRejection',
     schemata="Analyses",
     default=False,
     widget=BooleanWidget(
         label=_("Email notification on rejection"),
         description=_("Select this to activate automatic notifications "
                       "via email to the Client when a Sample or Analysis "
                       "Request is rejected.")
     ),
Exemplo n.º 10
0
        "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"),
        ),
    ),
))
Exemplo n.º 11
0
        widget=ReferenceWidget(visible={
            'edit': 'invisible',
            'view': 'invisible',
        }, ),
    ),
))

TrailingSchema = Schema((
    RecordsField(
        'identifiers',
        searchable=0,
        required=0,
        languageIndependent=1,
        is_duplicates_criterion=False,
        subfields=('label', 'value'),
        subfield_labels={'label': 'Identifier'},
        subfield_vocabularies={
            'label': 'publicationIdentifiers',
        },
        widget=RecordsWidget(
            i18n_domain="cmfbibliographyat",
            label=u"Identifiers",
        ),
    ),
    LinesField(
        'keywords',
        searchable=1,
        required=0,
        languageIndependent=1,
        is_duplicates_criterion=False,
        multiValued=1,
        widget=KeywordWidget(
Exemplo n.º 12
0
from bika.lims.browser.widgets import RecordsWidget
from bika.lims.content.bikaschema import BikaSchema
from bika.health.config import PROJECTNAME
from Products.Archetypes.public import *
from Products.ATExtensions.ateapi import RecordsField
from zope.interface import implements

schema = BikaSchema.copy() + Schema((RecordsField(
    'AetiologicAgentSubtypes',
    type='aetiologicagentsubtypes',
    subfields=('Subtype', 'SubtypeRemarks'),
    subfield_labels={
        'Subtype': _('Subtype'),
        'SubtypeRemarks': _('Remarks')
    },
    subfield_sizes={
        'Subtype': 10,
        'SubtypeRemarks': 25
    },
    widget=RecordsWidget(
        label='Subtypes',
        description=_("A list of aetiologic agent subtypes."),
        visible=True,
    ),
), ))
schema['description'].widget.visible = True
schema['description'].schemata = 'default'


class AetiologicAgent(BaseContent):
    security = ClassSecurityInfo()
    displayContentsTab = False
Exemplo n.º 13
0
     type="metadata",
     subfields=(
         "paperformat",
         "timestamp",
         "orientation",
         "template",
         "contained_requests",
     ),
 ),
 RecordsField(
     "SendLog",
     type="sendlog",
     subfields=(
         "actor",
         "actor_fullname",
         "email_send_date",
         "email_recipients",
         "email_responsibles",
         "email_subject",
         "email_body",
         "email_attachments",
     ),
 ),
 TextField(
     "Html"
 ),
 BlobField(
     "Pdf",
     default_content_type="application/pdf",
 ),
 RecordsField(
     "Recipients",
Exemplo n.º 14
0
Uncertainties = RecordsField(
    'Uncertainties',
    schemata="Uncertainties",
    type='uncertainties',
    subfields=('intercept_min', 'intercept_max', 'errorvalue'),
    required_subfields=('intercept_min', 'intercept_max', 'errorvalue'),
    subfield_sizes={
        'intercept_min': 10,
        'intercept_max': 10,
        'errorvalue': 10,
    },
    subfield_labels={
        'intercept_min': _('Range min'),
        'intercept_max': _('Range max'),
        'errorvalue': _('Uncertainty value'),
    },
    subfield_validators={
        'intercept_min': 'uncertainties_validator',
        'intercept_max': 'uncertainties_validator',
        'errorvalue': 'uncertainties_validator',
    },
    widget=RecordsWidget(
        label=_("Uncertainty"),
        description=_(
            "Specify the uncertainty value for a given range, e.g. for "
            "results in a range with minimum of 0 and maximum of 10, "
            "where the uncertainty value is 0.5 - a result of 6.67 will be "
            "reported as 6.67 +- 0.5. You can also specify the uncertainty "
            "value as a percentage of the result value, by adding a '%' to "
            "the value entered in the 'Uncertainty Value' column, e.g. for "
            "results in a range with minimum of 10.01 and a maximum of 100, "
            "where the uncertainty value is 2% - a result of 100 will be "
            "reported as 100 +- 2. Please ensure successive ranges are "
            "continuous, e.g. 0.00 - 10.00 is followed by 10.01 - 20.00, "
            "20.01 - 30 .00 etc."),
    ))
Exemplo n.º 15
0
     'BirthDate',
     required=1,
     validators=('isDateFormat', ),
     widget=DateTimeWidget_bl(
         label=_('Birth date'),
         datepicker_nofuture=1,
     ),
 ),
 BooleanField(
     'BirthDateEstimated',
     default=False,
     widget=BooleanWidget(label=_('Birth date is estimated'), ),
 ),
 RecordsField(
     'AgeSplitted',
     required=1,
     widget=SplittedDateWidget(label=_('Age'), ),
 ),
 ComputedField(
     'AgeSplittedStr',
     expression="context.getAgeSplittedStr()",
     widget=ComputedWidget(visible=False),
 ),
 AddressField(
     'CountryState',
     widget=AddressWidget(
         searchable=True,
         label=_("Country and state"),
         showLegend=True,
         showDistrict=True,
         showCopyFrom=False,
Exemplo n.º 16
0
 def set(self, instance, rules_list, **kwargs):
     """
     Set the reflexrule field.
     :rules_list: is a list of dictionaries with the following format:
     [{'actions': [{'act_row_idx': 0,
                    'action': 'repeat',
                    'an_result_id': 'rep-1',
                    'analyst': '',
                    'otherWS': 'current',
                    'setresultdiscrete': '',
                    'setresulton': 'original',
                    'setresultvalue': '',
                    'worksheettemplate': ''}],
       'conditions': [{'analysisservice': '52853cf7d5114b5aa8c159afad2f3da1',
                       'and_or': 'no',
                       'cond_row_idx': 0,
                       'discreteresult': '',
                       'range0': '11',
                       'range1': '12'}],
       'mother_service_uid': '52853cf7d5114b5aa8c159afad2f3da1',
       'rulenumber': '0',
       'trigger': 'submit'},
      {'actions': [{'act_row_idx': 0,
                    'action': 'repeat',
                    'an_result_id': 'rep-2',
                    'analyst': '',
                    'otherWS': 'current',
                    'setresultdiscrete': '',
                    'setresulton': 'original',
                    'setresultvalue': '',
                    'worksheettemplate': ''},
                   {'act_row_idx': 1,
                    'action': 'repeat',
                    'an_result_id': 'rep-4',
                    'analyst': 'analyst1',
                    'otherWS': 'to_another',
                    'setresultdiscrete': '',
                    'setresulton': 'original',
                    'setresultvalue': '',
                    'worksheettemplate': '70d48adfb34c4231a145f76a858e94cf'},
                   {'act_row_idx': 2,
                    'action': 'repeat',
                    'an_result_id': 'rep-5',
                    'analyst': '',
                    'otherWS': 'create_another',
                    'setresultdiscrete': '',
                    'setresulton': 'original',
                    'setresultvalue': '',
                    'worksheettemplate': ''},
                   {'act_row_idx': 3,
                    'action': 'repeat',
                    'an_result_id': 'rep-6',
                    'analyst': '',
                    'otherWS': 'no_ws',
                    'setresultdiscrete': '',
                    'setresulton': 'original',
                    'setresultvalue': '',
                    'worksheettemplate': ''}],
       'conditions': [{'analysisservice': 'rep-1',
                       'and_or': 'no',
                       'cond_row_idx': 0,
                       'discreteresult': '',
                       'range0': '12',
                       'range1': '12'}],
       'mother_service_uid': '52853cf7d5114b5aa8c159afad2f3da1',
       'rulenumber': '1',
       'trigger': 'submit'},
      {'actions': [{'act_row_idx': 0,
                    'action': 'repeat',
                    'an_result_id': 'rep-3',
                    'analyst': '',
                    'otherWS': 'current',
                    'setresultdiscrete': '',
                    'setresulton': 'original',
                    'setresultvalue': '',
                    'worksheettemplate': ''}],
       'conditions': [{'analysisservice': 'rep-1',
                       'and_or': 'and',
                       'cond_row_idx': 0,
                       'discreteresult': '',
                       'range0': '12',
                       'range1': '12'},
                      {'analysisservice': 'rep-2',
                       'and_or': 'or',
                       'cond_row_idx': 1,
                       'discreteresult': '',
                       'range0': '115',
                       'range1': '115'},
                      {'analysisservice': 'rep-1',
                       'and_or': 'no',
                       'cond_row_idx': 2,
                       'discreteresult': '',
                       'range0': '14',
                       'range1': '14'}],
       'mother_service_uid': '52853cf7d5114b5aa8c159afad2f3da1',
       'rulenumber': '2',
       'trigger': 'submit'}]
     This list of dictionaries is how the system will store the reflexrule
     field info. This dictionaries must be in sync with the
     browser/widgets/reflexrulewidget.py/process_form() dictionaries format.
     """
     for d in rules_list:
         # Checking if all dictionary items are correct
         if not _check_set_values(instance, d):
             RecordsField.set(self, instance, [], **kwargs)
     RecordsField.set(self, instance, rules_list, **kwargs)
Exemplo n.º 17
0
# This field is not editable and is generated automatically based on the rows,
# columns and occupied positions. It returns a list of dicts. Each dict
# represents an object stored within this container at the given 'column' and
# 'row' keys. The UID of the object is stored as a value for the key 'uid'.
# "capacity" refers to the number of samples the contained object can store
# directly or indirectly (through other child containers). "utilization" field
# refers to the number of sample the contained object actually stores directly
# or indirectly.
# The total capacity and utilization of this container is the sum of values of
# the capacity and utilization of the objects this container stores.
PositionsLayout = RecordsField(name="PositionsLayout",
                               subfields=("row", "column", "uid",
                                          "samples_capacity",
                                          "samples_utilization"),
                               subfield_types={
                                   "row": "int",
                                   "column": "int",
                                   "samples_capacity": "int",
                                   "samples_utilization": "int"
                               },
                               widget=RecordsWidget(visible=False))

AvailablePositions = LinesField(name="AvailablePositions",
                                required=0,
                                subfields=("row", "column"),
                                widget=LinesWidget(visible=False))

schema = BikaFolderSchema.copy() + Schema((
    Rows,
    Columns,
    PositionsLayout,
Exemplo n.º 18
0
 RecordsField(
     'AdmittedStickerTemplates',
     subfields=(
         'admitted',
         SMALL_DEFAULT_STICKER,
         LARGE_DEFAULT_STICKER,
         ),
     subfield_labels={
         'admitted': _(
             'Admitted stickers for the sample type'),
         SMALL_DEFAULT_STICKER: _(
             'Default small sticker'),
         LARGE_DEFAULT_STICKER: _(
             'Default large sticker')},
     subfield_sizes={
         'admitted': 6,
         SMALL_DEFAULT_STICKER: 1,
         LARGE_DEFAULT_STICKER: 1},
     subfield_types={
         'admitted': 'selection',
         SMALL_DEFAULT_STICKER: 'selection',
         LARGE_DEFAULT_STICKER: 'selection'
                     },
     subfield_vocabularies={
         'admitted': sticker_templates(),
         SMALL_DEFAULT_STICKER: '_sticker_templates_vocabularies',
         LARGE_DEFAULT_STICKER: '_sticker_templates_vocabularies',
     },
     required_subfields={
         'admitted': 1,
         SMALL_DEFAULT_STICKER: 1,
         LARGE_DEFAULT_STICKER: 1},
     default=[{}],
     fixedSize=1,
     widget=SampleTypeStickersWidget(
         label=_("Admitted sticker templates"),
         description=_(
             "Defines the stickers to use for this sample type."),
         allowDelete=False,
     ),
 ),
Exemplo n.º 19
0
     searchable = True,
     widget = ComputedWidget(
         visible = False,
     ),
 ),
 RecordsField('Uncertainties',
     schemata = "Uncertainties",
     type = 'uncertainties',
     subfields = ('intercept_min', 'intercept_max', 'errorvalue'),
     required_subfields = ('intercept_min', 'intercept_max', 'errorvalue'),
     subfield_sizes = {'intercept_min': 10,
                        'intercept_max': 10,
                        'errorvalue': 10,
                        },
     subfield_labels = {'intercept_min': _('Range min'),
                        'intercept_max': _('Range max'),
                        'errorvalue': _('Uncertainty value'),
                        },
     widget = RecordsWidget(
         label = _("Uncertainty"),
         description = _("Specify the uncertainty value for a given range, e.g. for results "
                         "in a range with minimum of 0 and maximum of 10, the uncertainty "
                         "value is 0.5 - a result of 6.67 will be reported as 6.67 +- 0.5. "
                         "Please ensure successive ranges are continuous, e.g. 0.00 - 10.00 "
                         "is followed by 10.01 - 20.00, 20.01 - 30 .00 etc."),
     ),
 ),
 RecordsField('ResultOptions',
     schemata = "Result Options",
     type = 'resultsoptions',
     subfields = ('ResultValue','ResultText'),
     required_subfields = ('ResultValue','ResultText'),
Exemplo n.º 20
0
         default='',
         visible=True,
     ),
 ),
 RecordsField(
     'ResultFilesFolder',
     subfields=('InterfaceName', 'Folder'),
     subfield_labels={
         'InterfaceName': _('Interface Code'),
         'Folder': _('Folder that results will be saved')
     },
     subfield_readonly={
         'InterfaceName': True,
         'Folder': False
     },
     widget=RecordsWidget(
         label=_("Result files folders"),
         description=_("For each interface of this instrument, \
                   you can define a folder where \
                   the system should look for the results files while \
                   automatically importing results. Having a folder \
                   for each Instrument and inside that folder creating \
                   different folders for each of its Interfaces \
                   can be a good approach. You can use Interface codes \
                   to be sure that folder names are unique."),
         visible=True,
     ),
 ),
 RecordsField(
     'DataInterfaceOptions',
     type='interfaceoptions',
     subfields=('Key', 'Value'),
        ),
    ),                                

    StringField('Type',
        vocabulary = "getTaskTypes",
        widget = ReferenceWidget(
            checkbox_bound = 1,
            label = _("Task type",
                      "Type"),
        ),
    ),
                                     
    RecordsField('ScheduleCriteria',
        required=1,
        type='schedulecriteria',
        widget=ScheduleInputWidget(
            label=_('Criteria'),
        ),
    ),
                                         
    TextField('Considerations',
        default_content_type = 'text/x-web-intelligent',
        allowable_content_types = ('text/x-web-intelligent',),
        default_output_type="text/html",
        widget = TextAreaWidget(
            label = _("Considerations"),
            description = _("Remarks to take into account before performing the task"),
        ),
    ),
))