def workflow_action_default(self, action, came_from): if came_from in ['workflow_action', 'edit']: # If a single item was acted on we will create the item list # manually from this item itself. Otherwise, bika_listing will # pass a list of selected items in the requyest. items = [ self.context, ] else: # normal bika_listing. items = self._get_selected_items().values() if items: trans, dest = self.submitTransition(action, came_from, items) if trans: message = _('Changes saved.') self.context.plone_utils.addPortalMessage(message, 'info') if dest: self.request.response.redirect(dest) return else: message = _('No items selected') self.context.plone_utils.addPortalMessage(message, 'warn') self.request.response.redirect(self.destination_url) return
class ISupplier(model.Schema): Website = schema.TextLine( title=_(u'Website'), required=False) directives.fieldset( 'bank', label=_(u'Bank Details'), fields=('NIB','IBN','SWIFTcode'), ) NIB = schema.TextLine( title=_(u"NIB"), required=False, ) IBN = schema.TextLine( title=_(u"IBN"), required=False, ) SWIFTcode = schema.TextLine( title=_(u"SWIFT Code"), required=False, )
def getStates(self): """ Available review states """ return [ {'id':'default', 'title': self.context.translate(_('Active')), 'contentFilter': {'inactive_state': 'active'}, 'transitions': [{'id':'deactivate', 'title': _('Deactivate')}, ], 'columns': ['title', 'description', 'instruments', 'manual']}, {'id':'inactive', 'title': self.context.translate(_('Dormant')), 'contentFilter': {'inactive_state': 'inactive'}, 'transitions': [{'id':'activate', 'title': _('Activate')}, ], 'columns': ['title', 'description', 'instruments', 'manual']}, {'id':'all', 'title': self.context.translate(_('All')), 'contentFilter':{}, 'columns': ['title', 'description', 'instruments', 'manual']}, ]
class IAddress(model.Schema): street = schema.TextLine(title=_(u'Street Address'), description=_(u'Street Address.'), required=False, default=None) postal = schema.TextLine(title=_(u'Zip Code'), description=_(u'Zip or Postal Code.'), required=False, default=None)
class IPerson(model.Schema): JobTitle = schema.TextLine(title=_(u'Job Title')) Department = schema.TextLine(title=_(u'Department')) fieldset('address', label=_(u'Address'), fields=['PhysicalAddress', 'PostalAddress']) PhysicalAddress = schema.Object(title=_(u'Physical Address'), schema=IAddress) PostalAddress = schema.Object(title=_(u'Postal Address'), schema=IAddress)
def getColumns(self): """ Columns definition """ return { 'title': { 'title': _('Supplier'), 'index': 'sortable_title', 'toggle': False}, 'description': { 'title': _('Description'), 'toggle': True}, }
class IOrganization(model.Schema): TaxNumber = schema.TextLine(title=_(u'VAT Number'), required=False) fieldset('address', label=_(u'Address'), fields=['EmailAddress', 'PhysicalAddress', 'PostalAddress']) EmailAddress = Email(title=_(u'Email Address'), required=False) PhysicalAddress = schema.Object(title=_(u'Physical Address'), required=False, schema=IAddress) PostalAddress = schema.Object(title=_(u'Postal Address'), required=False, schema=IAddress)
def getColumns(self): """ Columns definition """ return { 'title': {'title': _('Method'), 'index': 'sortable_title', 'toggle': False}, 'description': {'title': _('Description'), 'toggle': True}, 'instruments': {'title': _('Instruments'), 'toggle': True}, 'manual': {'title': _('Manual'), 'toggle': True}, }
class IProcedure(model.Schema): directives.fieldset( 'procedure', label=_(u'Procedure'), fields=('inlab', ), ) inlab = schema.Text( title=_(u"In-lab calibration procedure"), description=_(u"Instructions for in-labe regular calibration ruotines " u"indented for analysts"), required=False, )
def __call__(self): mtool = api.portal.get_tool(name='portal_membership') if mtool.checkPermission(AddSupplier, self.context): self.context_actions[_('Add')] = { 'url': self.base_url + '/++add++Supplier' } return super(SuppliersView, self).__call__()
def __init__(self, context, request): super(InstrumentsView, self).__init__( context,request,settings=u'mx.lims.InstrumentListSettings') self.contentFilter = {'portal_type': 'Instrument'} self.icon = self.image_url + '/instrument_big.png' self.title = self.context.translate(_('Instruments')) self.description = ""
def __init__(self, context, request): super(SuppliersView, self).__init__(context, request, settings=u'mx.lims.SupplierListSettings') self.contentFilter = {'portal_type': 'Supplier'} self.icon = self.image_url + '/supplier_big.png' self.title = self.context.translate(_('Suppliers')) self.description = ""
def __init__(self, context, request): super(MethodsView, self).__init__(context, request, settings=u'mx.lims.MethodListSettings') self.contentFilter = { 'portal_type': 'Method', 'sort_on': 'sortable_title' } self.icon = self.image_url + '/method_big.png' self.title = self.context.translate(_('Methods')) self.description = ""
class IMethod(model.Schema): """Dexterity Schema for Method """ Instructions = schema.Text( title=_(u'Method Instructions'), description=_(u'Technical description and instructions intended for analysts.')) ManualEntryOfResults = schema.Bool( title=_(u'Manual entry of results'), description=_(u"The results for the Analysis Services that use this method can " u"be set manually"), default=False) Accredited = schema.Bool( title=_(u'Accredited'), description=_(u"Check if the method has been accredited"), default=True)
class FolderSettings: columns = { 'obj_type': { 'title': _('Type') }, 'id': { 'title': _('ID') }, 'title_or_id': { 'title': _('Title') }, 'modified': { 'title': _('Last modified') }, 'state_title': { 'title': _('State') }, } # review_state # # A list of dictionaries, specifying parameters for listing filter buttons. # - If review_state[x]['transitions'] is defined it's a list of dictionaries: # [{'id':'x'}] # Transitions will be ordered by and restricted to, these items. # # - If review_state[x]['custom_actions'] is defined. it's a list of dict: # [{'id':'x'}] # These transitions will be forced into the list of workflow actions. # They will need to be handled manually in the appropriate WorkflowAction # subclass. review_states = [ { 'id': 'default', 'contentFilter': {}, 'title': _('All'), 'columns': ['obj_type', 'title_or_id', 'modified', 'state_title'] }, ]
class ILimsSetup(model.Schema): """Dexterity Schema for Lims Setup """ fieldset( 'security', label=_(u'Security'), fields=['PasswordLifetime', 'AutoLogOff', 'AllowClerksToEditClients']) PasswordLifetime = schema.Int( title=_(u'Password lifetime'), description=_(u'The number of days before a password expires. ' u'0 disables password expiry'), required=True, default=0) AutoLogOff = schema.Int( title=_(u'Automatic log-off'), description=_( u'The number of minutes before a user is automatically logged off.' u'0 disables automatic log-off'), required=True, default=0) AllowClerksToEditClients = schema.Bool( title=_(u'Allow Lab Clerks to create and edit clients'), default=False) fieldset('accounting', label=_(u'Accounting'), fields=['ShowPrices', 'Currency']) ShowPrices = schema.Bool( title=_(u'Include and display pricing information'), default=True) Currency = schema.Choice( title=_(u'Currency'), description=_( u"Select the currency the site will use to display prices."), vocabulary=u'mx.lims.vocabularies.Currencies', required=True) fieldset('analyses', label=_(u'Analyses'), fields=[ 'SamplingWorkflowEnabled', 'ScheduleSamplingEnabled', 'ShowPartitions' ]) SamplingWorkflowEnabled = schema.Bool( title=_(u'Enable the Sampling workflow'), description=_( u'Select this to activate the sample collection workflow steps.'), default=False) ScheduleSamplingEnabled = schema.Bool( title=_(u'Enable the Schedule a Sampling functionality'), description=_( u"Select this to allow a Sampling Coordinator to" u" schedule a sampling. This functionality only takes effect" u" when 'Sampling workflow' is active"), default=False) ShowPartitions = schema.Bool( title=_(u'Display individual sample partitions'), description=_( u'Turn this on if you want to work with sample partitions'), default=True)
class IOrganization(model.Schema): TaxNumber = schema.TextLine(title=_(u'VAT Number'), required=False) directives.fieldset('address', label=_(u'Address'), fields=[ 'EmailAddress', 'PhysicalAddress', 'PostalAddress', 'BillingAddress' ]) EmailAddress = Email(title=_(u'Email Address'), required=False) PhysicalAddress = schema.Object(title=_(u'Physical Address'), required=False, schema=IAddress) PostalAddress = schema.Object(title=_(u'Postal Address'), required=False, schema=IAddress) BillingAddress = schema.Object(title=_(u'Billing Address'), required=False, schema=IAddress) directives.fieldset( 'bank', label=_(u'Bank Details'), fields=('AccountType', 'AccountName', 'AccountNumber', 'BankName', 'BankBranch'), ) AccountType = schema.TextLine( title=_(u"Account Type"), required=False, ) AccountName = schema.TextLine( title=_(u"Account Name"), required=False, ) AccountNumber = schema.TextLine( title=_(u"Account Number"), required=False, ) BankName = schema.TextLine( title=_(u"Bank Name"), required=False, ) BankBranch = schema.TextLine( title=_(u"Bank Branch"), required=False, )