def __call__(self, context):
        # Just an example list of content for our vocabulary,
        # this can be any static or dynamic data, a catalog result for example.
        items = [
            VocabItem(u'pending', _(u'Pending')),
            VocabItem(u'active', _(u'Active')),
            VocabItem(u'cancelled', _(u'Cancelled')),
            VocabItem(u'terminated', _(u'Terminated')),
        ]

        # Fix context if you are using the vocabulary in DataGridField.
        # See https://github.com/collective/collective.z3cform.datagridfield/issues/31:  # NOQA: 501
        if not IDexterityContent.providedBy(context):
            req = getRequest()
            context = req.PARENTS[0]

        # create a list of SimpleTerm items:
        terms = []
        for item in items:
            terms.append(
                SimpleTerm(
                    value=item.token,
                    token=str(item.token),
                    title=item.value,
                ))
        # Create a SimpleVocabulary from the terms list and return it:
        return SimpleVocabulary(terms)
    def __call__(self, context):
        # An award moves through multiple states. Releases over time can update
        # the status of an award.
        # https://standard.open-contracting.org/latest/en/schema/codelists/#award-status

        items = [
            VocabItem(u'pending', _(u'Pending')),
            VocabItem(u'active', _(u'Active')),
            VocabItem(u'cancelled', _(u'Cancelled')),
            VocabItem(u'uncessfull', _(u'Unsuccessful')),
        ]

        # Fix context if you are using the vocabulary in DataGridField.
        # See https://github.com/collective/collective.z3cform.datagridfield/issues/31:  # NOQA: 501
        if not IDexterityContent.providedBy(context):
            req = getRequest()
            context = req.PARENTS[0]

        # create a list of SimpleTerm items:
        terms = []
        for item in items:
            terms.append(
                SimpleTerm(
                    value=item.token,
                    token=str(item.token),
                    title=item.value,
                ))
        # Create a SimpleVocabulary from the terms list and return it:
        return SimpleVocabulary(terms)
class IOCDSRelease(model.Schema):
    """ Marker interface and Dexterity Python Schema for OCDSRelease
    """

    # directives.widget(level=RadioFieldWidget)
    # level = schema.Choice(
    #     title=_(u'Sponsoring Level'),
    #     vocabulary=LevelVocabulary,
    #     required=True
    # )

    dexteritytextindexer.searchable('notes')
    notes = RichText(title=_(u'Notes'),
                     description=_(u'''
            Notes about this procurement process
            '''),
                     required=False)
Exemple #4
0
class IDocumentType(model.Schema):
    """
    """

    directives.widget(DocumentType=SelectFieldWidget)
    DocumentType = schema.List(
                title=_(u'Document Type'),
                description=_(u'''
                OCDS classification of the document
                '''),

                default=[],
                value_type=schema.Choice(
                    vocabulary='ocds.DocumentType'
                    ),
                required=False,
                )
    def __call__(self, context):
        # Just an example list of content for our vocabulary,
        # this can be any static or dynamic data, a catalog result for example.
        items = [
            VocabItem(u'construction', _(u'Construction')),
            VocabItem(u'rehabilitation', _(u'Rehabilitation')),
            VocabItem(u'replacement', _(u'Replacement')),
        ]

        terms = []
        for item in items:
            terms.append(
                SimpleTerm(
                    value=item.token,
                    token=str(item.token),
                    title=item.value,
                ))
        # Create a SimpleVocabulary from the terms list and return it:
        return SimpleVocabulary(terms)
    def test_vocab_tender_status(self):
        vocab_name = 'ocds.contenttypes.TenderStatus'
        factory = getUtility(IVocabularyFactory, vocab_name)
        self.assertTrue(IVocabularyFactory.providedBy(factory))

        vocabulary = factory(self.portal)
        self.assertTrue(IVocabularyTokenized.providedBy(vocabulary))
        self.assertEqual(
            vocabulary.getTerm('sony-a7r-iii').title,
            _(u'Sony Aplha 7R III'),
        )
Exemple #7
0
    def test_vocab_submission_method(self):
        vocab_name = 'ocds.contenttypes.SubmissionMethod'
        factory = getUtility(IVocabularyFactory, vocab_name)
        self.assertTrue(IVocabularyFactory.providedBy(factory))

        vocabulary = factory(self.portal)
        self.assertTrue(IVocabularyTokenized.providedBy(vocabulary))
        self.assertEqual(
            vocabulary.getTerm('sony-a7r-iii').title,
            _(u'Sony Aplha 7R III'),
        )
Exemple #8
0
class IRelatedAwards(model.Schema):
    """
    """

    # awards

    directives.widget('related_awards',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    related_awards = RelationList(
        title=u'Related Contract Awards',
        description=_(u'''
            Related Contract Awards
            '''),
        default=[],
        value_type=RelationChoice(source=CatalogSource(portal_type='Award'), ),
        required=False,
    )
Exemple #9
0
class IRelatedOCDSReleases(model.Schema):
    """
    """

    # related OCDS releases or procurement process

    directives.widget('related_releases',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    related_releases = RelationList(
        title=u'Related Procurement or Contracting Process',
        description=_(u'''
            '''),
        default=[],
        value_type=RelationChoice(
            source=CatalogSource(portal_type='OCDS Release'), ),
        required=False,
    )
Exemple #10
0
class IInfrastructureProject(model.Schema):
    """ Marker interface and Dexterity Python Schema for InfrastructureProject
    """
    # If you want, you can load a xml model created TTW here
    # and customize it in Python:

    # model.load('infrastructure_project.xml')

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'''
                The title of the project.
                '''),
        required=True,
    )
    dexteritytextindexer.searchable('description')
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'''
                A description of this project. This should usually be no
                longer than a single paragraph.
                '''),
        required=False,
    )

    id_reference = schema.TextLine(
        title=_(u'Identifier or Reference'),
        description=_(u'''
                A unique identifier or reference number for this
                infrastructure project.
                '''),
        required=False,
    )

    # status
    # https://standard.open-contracting.org/infrastructure/latest/en/reference/codelists/#projectstatus

    directives.widget(project_status=SelectFieldWidget)
    project_status = schema.Choice(
        title=_(u'Project Status'),
        description=_(u'''
        The current phase or status of this project
        '''),
        required=False,
        vocabulary='ocds.ProjectStatus',
    )

    # Project Period as fieldset

    # startDate
    project_startDate = schema.Date(
        title=_(u'Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    project_endDate = schema.Date(
        title=_(u'End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate

    project_maxExtentDate = schema.Date(
        title=_(u'Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    # period_durationInDays
    # Implemented as view

    # Project Sector
    # https://standard.open-contracting.org/infrastructure/latest/en/reference/codelists/#projectsector

    directives.widget(project_sector=SelectFieldWidget)
    project_sector = schema.Choice(
        title=_(u'Project Sector'),
        required=False,
        vocabulary='ocds.sector',
    )

    purpose = schema.Text(
        title=_(u'Project purpose'),
        description=_(u'The socioeconomic purpose of this project'),
        required=False,
    )

    # additionalClassifications

    # project_type

    directives.widget(project_sector=SelectFieldWidget)
    project_sector = schema.Choice(
        title=_(u'Project Sector'),
        required=False,
        vocabulary='ocds.sector',
    )
    directives.widget(project_type=SelectFieldWidget)
    project_type = schema.Choice(
        title=_(u'Project Type'),
        required=False,
        vocabulary='ocds.projecttypes',
    )

    # AssetLifeTime
    # assetLifeTime_start_date
    # assetLifeTime_end_date
    # assetLifeTime_maxExtentDate
    # assetLifeTime_durationInDays

    # Asset startDate
    assetLifetime_startDate = schema.Date(
        title=_(u'Asset Start Date'),
        description=_(u'''
        The start date for the asset. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # Asset endDate
    assetLifetime_endDate = schema.Date(
        title=_(u'Asset End Date'),
        description=_(u'''
        The end date for the period. When known, a precise asset end
        date must always be provided.
        '''),
        required=False,
    )

    # Asset period_maxExtentDate

    assetLifetime_maxExtentDate = schema.Date(
        title=_(u'Asset Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    fieldset('Asset Lifetime',
             fields=[
                 'assetLifetime_startDate',
                 'assetLifetime_endDate',
                 'assetLifetime_maxExtentDate',
             ])

    # locations

    # budget

    budget_amount = schema.Decimal(
        title=_(u'Budget Amount'),
        description=_(u'''
            The projected costs or allocated budget for
            the project'''),
        required=False,
    )

    # budget_currency
    directives.widget(budget_currency=SelectFieldWidget)
    budget_currency = schema.Choice(
        title=u'Budget Currency',
        description=u'Currency of the budget amount',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    budget_approvalDate = schema.Date(
        title=_(u'Budget Approval Date'),
        description=_(u'''
            The date on which the project budget was approved. Where
            documentary evidence for this exists, it may be included
            amongst the project documents with the documentType set to
            ‘budgetApproval’.
            '''),
        required=False,
    )

    # budget_breakdown
    # implemented as content type

    # Parties
    # Implemented as a Behaviour

    # Contracting Processes
    # Implemented as content type

    # completion_endDate

    completion_endDate = schema.Date(
        title=_(u'Completion Date'),
        description=_(u'''
        The actual completion date for the project (compare with the
        endDate in project period.
            '''),
        required=False,
    )

    completion_endDate_details = RichText(
        title=_(u'Completion End Date Details'),
        description=_(u'''
        Details related to the endDate. This may be a justification for
        the contract’s completion date being different than in the
        original contract.
        '''),
        required=False,
    )

    # completion_endDateDetails
    completion_finalValue_amount = schema.Decimal(
        title=_(u'Final Value'),
        description=_(u'The total cost of this project at completion.'),
        required=False,
    )

    directives.widget(completion_finalValue_currency=SelectFieldWidget)
    completion_finalValue_currency = schema.Choice(
        title=u'Final  Currency',
        description=u'Currency of the budget amount',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    completion_finalValue_details = RichText(
        title=_(u'Final value details'),
        description=_(u'''
        Details related to the final value. This may be a justification
        for the completed project’s value being different than in the
        original or latest revised budget.
        '''),
        required=False,
    )

    completion_finalScope = schema.Text(
        title=_(u'Final Scope'),
        description=_(u'''
        A short description of the final scope of the project at
        completion.
        '''),
        required=False,
    )

    completion_finalScopeDetails = RichText(
        title=_(u'Final scope details'),
        description=_(u'''
        A reason, explanation or justification for any variation between
        the anticipated scope (compare to the projectScope document) and
        the final scope at completion. If appropriate, additional
        details may be included in the documents section, with a title
        indicating that these documents will describe and differences
        between the planned and completed scope of work.
        '''),
        required=False,
    )

    fieldset('Completion',
             fields=[
                 'completion_endDate',
                 'completion_endDate_details',
                 'completion_finalValue_amount',
                 'completion_finalValue_currency',
                 'completion_finalValue_details',
                 'completion_finalScope',
                 'completion_finalScopeDetails',
             ])
Exemple #11
0
class IAward(model.Schema):
    """ Marker interface and Dexterity Python Schema for Award
    """
    # If you want, you can load a xml model created TTW here
    # and customize it in Python:

    # model.load('award.xml')

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'''
                Award title
                '''),
        required=True,
    )
    dexteritytextindexer.searchable('description')
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'''
                Award description
                '''),
        required=False,
    )

    # Award Status

    directives.widget(award_status=SelectFieldWidget)
    award_status = schema.List(
        title=_(u'Award Status'),
        description=_(u'''
                The current status of the award
                '''),
        default=[],
        value_type=schema.Choice(vocabulary='ocds.AwardStatus'),
        required=False,
    )

    # Award date
    award_date = schema.Date(
        title=_(u'Award Date'),
        description=_(u'''
        The date of the contract award. This is usually the date on
        which a decision to award was made.
        '''),
        required=False,
    )

    # Value

    award_amount = schema.Float(
        title=_(u'Contract value'),
        description=_(u'''
            The total value of this award. In the case of a framework
            contract this may be the total estimated lifetime value, or
            maximum value, of the agreement. There may be more than one
            award per procurement. A negative value indicates that the
            award may involve payments from the supplier to the buyer
            (commonly used in concession contracts).
                '''),
        required=False,
    )

    directives.widget(award_currency=SelectFieldWidget)
    award_currency = schema.Choice(
        title=u'Contract Value Currency',
        description=u'Currency of the contract amount',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    # Suppliers

    directives.widget('suppliers',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basepath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })
    suppliers = RelationList(
        title=u'Suppliers',
        description=_(u'''
            Entities awarded or contracted to provide goods, works or
            services.
            '''),
        default=[],
        value_type=RelationChoice(
            source=CatalogSource(portal_type='Organization'), ),
        required=False,
    )

    # Items Awarded

    # Contract period

    # startDate
    contractPeriod_startDate = schema.Date(
        title=_(u'Contract Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    contractPeriod_endDate = schema.Date(
        title=_(u'Contract End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    contractPeriod_maxExtentDate = schema.Date(
        title=_(u'Contract Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )
Exemple #12
0
class IContractingProcess(model.Schema):
    """ Marker interface and Dexterity Python Schema for ContractingProcess
    """
    # If you want, you can load a xml model created TTW here
    # and customize it in Python:

    # model.load('contracting_process.xml')

    # Infrastructure Project
    directives.widget('InfrastructureProject',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    InfrastructureProject = RelationChoice(
        title=u'Infrasructure Project',
        description=_(u'''
            Infrastructure Project this contract is part of
            '''),
        source=CatalogSource(portal_type='Infrastructure Project'),
        required=False,
    )

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'''
                The formal name of this contracting process. Once set,
                this should not normally by changed.
                '''),
        required=True,
    )
    dexteritytextindexer.searchable('description')
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'''
                The description should summarise the purpose of this
                contract and the scope of work to be undertaken.
                '''),
        required=False,
    )

    ExternalReference = schema.TextLine(
        title=_(u'External Reference'),
        description=_(u'''
                If this contracting process is identified by some
                external reference number it may be recorded here.
                '''),
        required=False,
    )

    directives.widget(project_nature=SelectFieldWidget)
    project_nature = schema.List(
        title=_(u'Nature'),
        description=_(u'''
                Whether this contracting process relates to the design,
                construction and/or supervision of the project, from the
                contractNature codelist. More than one value may be
                provided if the contract is for both design and
                construction, or both design and supervision, etc.
                '''),
        default=[],
        value_type=schema.Choice(vocabulary='ocds.ContractNature'),
        required=False,
    )

    directives.widget(project_status=SelectFieldWidget)
    project_status = schema.Choice(
        title=_(u'Project Status'),
        description=_(u'''
        The current phase or status of this project
        '''),
        required=False,
        vocabulary='ocds.ProjectStatus',
    )

    # Tender Process

    directives.widget(procurementMethod=SelectFieldWidget)
    procurementMethod = schema.Choice(
        title=_(u'Procurement Method'),
        description=_(u'''
        '''),
        required=False,
        vocabulary='ocds.Method',
    )

    procurementMethodDetails = RichText(
        title=_(u'Procurement method details'),
        description=_(u'''
        Additional detail on the procurement method used. This field
        should be used to record an agreed list of procurement process
        types, such as: International Competitive Bidding, National
        Competitive Bidding, Donor Procurement Rules, Framework or
        Direct Award.
        '''),
        required=False,
    )

    costEstimate_amount = schema.Float(
        title=_(u'Cost estimate'),
        description=_(u'Amount as a number'),
        required=False,
    )

    directives.widget(costEstimate_currency=SelectFieldWidget)
    costEstimate_currency = schema.Choice(
        title=u'Cost Estimate Currency',
        description=u'Currency of the estimate amount',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    numberOfTenderers = schema.Int(
        title=_(u'Number of tenderers'),
        required=False,
    )

    # procuringEntity
    directives.widget('procuringEntity',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    procuringEntity = RelationChoice(
        title=u'Procuring Entity',
        description=_(u'''
            The entity managing the procurement. This can be different
            from the buyer who pays for, or uses, the items being
            procured.
            '''),
        source=CatalogSource(portal_type='Organization'),
        required=False,
    )

    # suppliers
    directives.widget('suppliers',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    # administrativeEntity
    directives.widget('administrativeEntity',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    administrativeEntity = RelationChoice(
        title=u'Administrative Entity',
        description=_(u'''
            The name and identifier of the entity responsible for
            contract administration if this is different from the
            procuring entity.administrativeEntity
            '''),
        source=CatalogSource(portal_type='Organization'),
        required=False,
    )

    # suppliers
    directives.widget('suppliers',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    suppliers = RelationList(
        title=u'Suppliers',
        description=_(u'''
            Entities awarded or contracted to provide goods, works or
            services.
            '''),
        default=[],
        value_type=RelationChoice(
            source=CatalogSource(portal_type='Organization'), ),
        required=False,
    )

    contractValue_amount = schema.Float(
        title=_(u'Contract value'),
        description=_(u'The initial value of the contract'),
        required=False,
    )

    directives.widget(contractValue_currency=SelectFieldWidget)
    contractValue_currency = schema.Choice(
        title=u'Contract Value Currency',
        description=u'Currency of the contract amount',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    # startDate
    contractPeriod_startDate = schema.Date(
        title=_(u'Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    contractPeriod_endDate = schema.Date(
        title=_(u'End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    contractPeriod_maxExtentDate = schema.Date(
        title=_(u'Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    finalValue_amount = schema.Float(
        title=_(u'Final value'),
        description=_(u'''
            This should be provided when the contracting process is
            complete. This may be derived from the sum of
            contract.implementation.transactions values in linked OCDS
            data where available. In other cases, it may need to be
            identified and entered manually based on other project
            documentation.
            '''),
        required=False,
    )

    directives.widget(finalValue_currency=SelectFieldWidget)
    finalValue_currency = schema.Choice(
        title=u'Final Contract Value Currency',
        description=u'Currency of the final contract amount',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )
Exemple #13
0
    def __call__(self, context):
        # Just an example list of content for our vocabulary,
        # this can be any static or dynamic data, a catalog result for example.
        items = [
            VocabItem(u'needsAssessment', _(u'Needs Assessment')),
            VocabItem(u'valueForMoneyAnalysis',
                      _(u'Value for money analysis')),
            VocabItem(u'technicalSpecifications',
                      _(u'Technical Specifications')),
            VocabItem(u'serviceDescription', _(u'Service Description')),
            VocabItem(u'estimatedDemand', _(u'Estimated Demand')),
            VocabItem(u'contractDraft', _(u'Contract Draft')),
            VocabItem(u'contractSchedule', _(u'Contract Schedule')),
            VocabItem(u'contractSigned', _(u'Contract Signed')),
            VocabItem(u'feasibilityStudy', _(u'Feasibility Study')),
            VocabItem(u'environmentalImpact', _(u'Environmental Impact')),
            VocabItem(u'finalAudit', _(u'Final Audit')),
            VocabItem(u'tenderNotice', _(u'Tender Notice')),
            VocabItem(u'evaluationCommittee',
                      _(u'Evaluation Committee Details')),
            VocabItem(u'requestForQualification',
                      _(u'Request for Qualification')),
            VocabItem(u'evaluationCriteria', _(u'Evaluation Criteria')),
            VocabItem(u'minutes', _(u'Minutes')),
            VocabItem(u'shortlistedFirms', _(u'Shortedlisted Firms')),
            VocabItem(u'registrationParameters',
                      _(u'Registration Parameters')),
            VocabItem(u'evaluationReports', _(u'Evaluation Reports')),
            VocabItem(u'contractGuarantees', _(u'Guarantees')),
            VocabItem(u'defaultEvents', _(u'Defaults')),
            VocabItem(u'termination', _(u'Termination')),
            VocabItem(u'performanceReport', _(u'Performance report')),
            VocabItem(u'awardNotice', _(u'Award Notice')),
            VocabItem(u'contractNotice', _(u'Contract Notice')),
            VocabItem(u'completionCertificate', _(u'Completion certificate')),
            VocabItem(u'procurementPlan', _(u'Procurement Plan')),
            VocabItem(u'biddingDocuments', _(u'Bidding Documents')),
            VocabItem(u'contractArrangements', _(u'Contract Arrangements')),
            VocabItem(u'physicalProgressReport',
                      _(u'Physical progress reports')),
            VocabItem(u'financialProgressReport',
                      _(u'Financial progress reports')),
            VocabItem(u'hearingNotice', _(u'Public Hearing Notice')),
            VocabItem(u'marketStudies', _(u'Market Studies')),
            VocabItem(u'eligibilityCriteria', _(u'Eligibility Criteria')),
            VocabItem(u'clarifications',
                      _(u'Clarifications to bidders questions')),
            VocabItem(
                u'assetAndLiabilityAssessment',
                _(u'Assessment of governents\' assets and ' + 'liabilities')),
            VocabItem(
                u'riskProvisions',
                _(u'''
                      Provisions for management of risks and liabilities
                      ''')),
            VocabItem(
                u'winningBid',
                _(u'''
                      Wining Bid
                      ''')),
            VocabItem(
                u'complaints',
                _(u'''
                      Complaints and decisions
                      ''')),
            VocabItem(
                u'contractAnnexe',
                _(u'''
                      Annexes to the Contract
                      ''')),
            VocabItem(
                u'subContract',
                _(u'''
                      Subcontracts
                      ''')),
            VocabItem(
                u'projectPlan',
                _(u'''
                      Project Plan
                      ''')),
            VocabItem(
                u'billOfQuantity',
                _(u'''
                      Bill Of Quantity
                      ''')),
            VocabItem(
                u'bidders',
                _(u'''
                      Information on bidders
                      ''')),
            VocabItem(
                u'conflictOfInterest',
                _(u'''
                      Conflict of Interest
                      ''')),
            VocabItem(
                u'debarments',
                _(u'''
                      Debarments
                      ''')),
            VocabItem(
                u'illustration',
                _(u'''
                      Illustrations
                      ''')),
            VocabItem(
                u'submissionDocuments',
                _(u'''
                      Bid Submission Documents
                      ''')),
            VocabItem(
                u'contractSummary',
                _(u'''
                      Contract Summary
                      ''')),
            VocabItem(
                u'cancellationDetails',
                _(u'''
                      Cancellation Details
                      ''')),
            VocabItem(
                u'projectScope',
                _(u'''
                      Project scope
                      ''')),
            VocabItem(
                u'landAndSettlementImpact',
                _(u'''
                      Land and Settlement Impact
                      ''')),
            VocabItem(
                u'projectEvaluation',
                _(u'''
                      Project evaluation
                      ''')),
            VocabItem(
                u'budgetApproval',
                _(u'''
                      Budget approval 
                      ''')),
        ]

        # Fix context if you are using the vocabulary in DataGridField.
        # See https://github.com/collective/collective.z3cform.datagridfield/issues/31:  # NOQA: 501
        if not IDexterityContent.providedBy(context):
            req = getRequest()
            context = req.PARENTS[0]

        # create a list of SimpleTerm items:
        terms = []
        for item in items:
            terms.append(
                SimpleTerm(
                    value=item.token,
                    token=str(item.token),
                    title=item.value,
                ))
        # Create a SimpleVocabulary from the terms list and return it:
        return SimpleVocabulary(terms)
Exemple #14
0
class ITender(model.Schema):
    """ Marker interface and Dexterity Python Schema for Tender
    """
    # If you want, you can load a xml model created TTW here
    # and customize it in Python:

    # model.load('tender.xml')

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'''
                A title for this tender. This will often be used by
                applications as a headline to attract interest, and to
                help analysts understand the nature of this procurement.
                '''),
        required=True,
    )
    dexteritytextindexer.searchable('description')
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'''
                A summary description of the tender. This complements
                any structured information provided using the items
                array. Descriptions should be short and easy to read.
                Avoid using ALL CAPS.
                '''),
        required=False,
    )

    # procuringEntity
    directives.widget('procuringEntity',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    procuringEntity = RelationChoice(
        title=u'Procuring Entity',
        description=_(u'''
            The entity managing the procurement. This can be different
            from the buyer who pays for, or uses, the items being
            procured.
            '''),
        source=CatalogSource(portal_type='Organization'),
        required=False,
    )

    # Items

    # Value

    tender_value = schema.Float(
        title=_(u'Tender value'),
        description=_(u'''
            The total upper estimated value of the procurement. a
            negative value indicates that the contracting process may
            involve payments from the supplier to the buyer (commonly
            used in concession contracts).
                '''),
        required=False,
    )

    directives.widget(tender_value_currency=SelectFieldWidget)
    tender_value_currency = schema.Choice(
        title=u'Tender Value Currency',
        description=u'Currency of the tender amount',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    tender_minValue = schema.Float(
        title=_(u'Tender Minumum Value'),
        description=_(u'''
            The minimum estimated value of the procurement. A negative
            value indicates that the contracting process may involve
            payments from the supplier to the buyer (commonly used in
                concession contracts).
                '''),
        required=False,
    )

    directives.widget(tender_minValue_currency=SelectFieldWidget)
    tender_minValue_currency = schema.Choice(
        title=u'Tender Minimum Value Currency',
        description=u'Currency of the minimum tender value',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    # Procurement Method

    directives.widget(procurementMethod=SelectFieldWidget)
    procurementMethod = schema.Choice(
        title=_(u'Procurement Method'),
        description=_(u'''
        The procurement method
        '''),
        required=False,
        vocabulary='ocds.Method',
    )

    dexteritytextindexer.searchable('procurementMethodDetails')
    procurementMethodDetails = RichText(
        title=_(u'Procurement method details'),
        description=_(u'''
        Additional detail on the procurement method used. This field
        should be used to record an agreed list of procurement process
        types, such as: International Competitive Bidding, National
        Competitive Bidding, Donor Procurement Rules, Framework or
        Direct Award.
        '''),
        required=False,
    )

    dexteritytextindexer.searchable('procurementMethodRationale')
    procurementMethodRationale = RichText(
        title=_(u'Procurement method rationale'),
        description=_(u'''
        Rationale for the chosen procurement method. This is especially
        important to provide a justification in the case of limited
        tenders or direct awards.
        '''),
        required=False,
    )

    directives.widget(mainProcurementCategory=SelectFieldWidget)
    mainProcurementCategory = schema.Choice(
        title=_(u'Main procurement category'),
        description=_(u'''
        The primary category describing the main object of this
        contracting process.
        '''),
        required=False,
        vocabulary='ocds.ProjectCategory',
    )

    directives.widget(mainProcurementCategory=SelectFieldWidget)
    mainProcurementCategory = schema.Choice(
        title=_(u'Main procurement category'),
        description=_(u'''
        The primary category describing the main object of this
        contracting process
        '''),
        required=False,
        vocabulary='ocds.ProcurementCategory',
    )

    directives.widget(awardCriteria=SelectFieldWidget)
    awardCriteria = schema.Choice(
        title=_(u'Award criteria'),
        description=_(u'''
        The award criteria for the procurement
        '''),
        required=False,
        vocabulary='ocds.AwardCriteria',
    )

    dexteritytextindexer.searchable('awardCriteriaDetails')
    awardCriteriaDetails = RichText(
        title=_(u'Award criteria details'),
        description=_(u'''
        Any detailed or further information on the award or selection criteria.
        '''),
        required=False,
    )

    directives.widget(submissionMethod=SelectFieldWidget)
    submissionMethod = schema.Choice(
        title=_(u'Submission method'),
        description=_(u'''
        The methods by which bids are submitted
        '''),
        required=False,
        vocabulary='ocds.SubmissionMethod',
    )

    dexteritytextindexer.searchable('submissionMethodDetails')
    awardCriteriaDetails = RichText(
        title=_(u'Submission method details'),
        description=_(u'''
        Any detailed or further information on the submission method. This can
        include the address, e-mail address or online service to which bids are
        submitted, and any special requirements to be followed for submissions.
        '''),
        required=False,
    )

    # Tender Period

    # startDate
    tenderPeriod_startDate = schema.Date(
        title=_(u'Tender Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    tenderPeriod_endDate = schema.Date(
        title=_(u'Tender End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    tenderPeriod_maxExtentDate = schema.Date(
        title=_(u'Tender Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    # Enquiry Period

    # startDate
    enquiryPeriod_startDate = schema.Date(
        title=_(u'Enquiry Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    enquiryPeriod_endDate = schema.Date(
        title=_(u'Enquiry End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    enquiryPeriod_maxExtentDate = schema.Date(
        title=_(u'Enquiry Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    # Has Enquiries
    hasEnquiries = schema.Bool(
        title=_(u'Has enquiries?'),
        description=_(u'''
            Check if true.
            '''),
        required=False,
    )

    dexteritytextindexer.searchable('elegibilityCriteria')
    elegibilityCriteria = RichText(
        title=_(u'Elegibility Criteria'),
        description=_(u'''
        A description of any eligibility criteria for potential suppliers.
        '''),
        required=False,
    )

    # Evaluation Award Period

    # startDate
    awardPeriod_start = schema.Date(
        title=_(u'Evaluation and Award Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    awardPeriod_endDate = schema.Date(
        title=_(u'Evaluation and Award End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    awardPeriod_maxExtentDate = schema.Date(
        title=_(u'Evaluation and Award Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    # Contract period

    # startDate

    contractPeriod_startDate = schema.Date(
        title=_(u'Contract Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    contractPeriod_endDate = schema.Date(
        title=_(u'Contract End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    contractPeriod_maxExtentDate = schema.Date(
        title=_(u'Contract Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    # Number of tenderers
    numberOfTenderers = schema.Int(
        title=_(u'Number of tenderers'),
        description=_(u'''
            The number of parties who submit a bid.
            '''),
        required=False,
    )

    # Tenderers
    directives.widget('tenderers',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    tenderers = RelationList(
        title=u'Tenderers',
        description=_(u'''
            All entities who submit a tender.
            '''),
        default=[],
        value_type=RelationChoice(
            source=CatalogSource(portal_type='Organization'), ),
        required=False,
    )
Exemple #15
0
class IModification(model.Schema):
    """ Marker interface and Dexterity Python Schema for Modification
    """
    # If you want, you can load a xml model created TTW here
    # and customize it in Python:

    # model.load('modification.xml')

    # ContractingProcess
    directives.widget('ContractingProcess',
                      RelatedItemsFieldWidget,
                      pattern_options={
                          'basePath': '/',
                          'mode': 'auto',
                          'favourites': [],
                      })

    ContractingProcess = RelationChoice(
        title=u'Constracting Process',
        description=_(u'''
            Contracting Process this modification is for
            '''),
        source=CatalogSource(portal_type='Contracting Process'),
        required=False,
    )

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'''
                Modification title
                '''),
        required=True,
    )
    dexteritytextindexer.searchable('description')
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'''
                Details of the modification.
                '''),
        required=False,
    )

    rationale = RichText(title=_(u'Rationale'),
                         description=_(u'''
         A summary of the reasons which have led to this modification to
         the originally planned scope, period or value.
         '''),
                         required=False)

    directives.widget(modificationType=SelectFieldWidget)
    modificationType = schema.List(title=_(u'Type'),
                                   description=_(u'''
         Indicates whether the modification relates to the duration,
         value, scope or other aspect of the contract.
        '''),
                                   required=False,
                                   default=[],
                                   value_type=schema.Choice(
                                       vocabulary='ocds.ModificationType', ))

    # OCDS Release ID (not used yet)

    oldContractValue = schema.Decimal(
        title=_(u'Old Contract Value'),
        description=_(u'''
            Contract value before the modification, taking into account
            any prior modifications.
            '''),
        required=False,
    )

    directives.widget(oldContractValue_currency=SelectFieldWidget)
    oldContractValue_currency = schema.Choice(
        title=u'Old Contract Value Currency',
        description=u'Currency of the old contract value',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    newContractValue = schema.Decimal(
        title=_(u'New Contract Value'),
        description=_(u'''
            Contract value after the modification, taking into account
            any prior modifications.
            '''),
        required=False,
    )

    directives.widget(newContractValue_currency=SelectFieldWidget)
    newContractValue_currency = schema.Choice(
        title=u'New Contract Value Currency',
        description=u'Currency of the new contract value',
        required=False,
        vocabulary='collective.vocabularies.iso.currencies',
    )

    # startDate
    oldContractPeriod_startDate = schema.Date(
        title=_(u'Old Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    oldContractPeriod_endDate = schema.Date(
        title=_(u'Old End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    oldContractPeriod_maxExtentDate = schema.Date(
        title=_(u'Old Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )

    # startDate
    newContractPeriod_startDate = schema.Date(
        title=_(u'New Start Date'),
        description=_(u'''
        The start date for the period. When known, a precise start date
        must always be provided.
        '''),
        required=False,
    )

    # endDate
    newContractPeriod_endDate = schema.Date(
        title=_(u'New End Date'),
        description=_(u'''
        The end date for the period. When known, a precise end date must
        always be provided.
        '''),
        required=False,
    )

    # period_maxExtentDate
    newContractPeriod_maxExtentDate = schema.Date(
        title=_(u'New Maximum extent'),
        description=_(u'''
            The period cannot be extended beyond this date. This field
            is optional, and can be used to express the maximum
            available data for extension or renewal of this period.
            '''),
        required=False,
    )
Exemple #16
0
    def __call__(self, context):

        items = [
            VocabItem(u'education', _(u'Education')),
            VocabItem(u'health', _(u'Health')),
            VocabItem(u'energy', _(u'Energy')),
            VocabItem(u'communications', _(u'Communications')),
            VocabItem(u'waterAndWaste', _(u'Water and waste')),
            VocabItem(u'governance', _(u'Governance')),
            VocabItem(u'economy', _(u'Economy')),
            VocabItem(u'cultureSportsAndRecreation',
                      _(u'Culture, sports and recreation')),
            VocabItem(u'transport', _(u'Transport')),
            VocabItem(u'transport.air', _(u'Air transport')),
            VocabItem(u'transport.water', _(u'Water transport')),
            VocabItem(u'transport.rail', _(u'Transport rail')),
            VocabItem(u'transport.road', _(u'Transport road')),
            VocabItem(u'transport.urban', _(u'Transport urban')),
            VocabItem(u'socialHousing', _(u'Social housing')),
        ]

        # Fix context if you are using the vocabulary in DataGridField.
        # See https://github.com/collective/collective.z3cform.datagridfield/issues/31:  # NOQA: 501
        if not IDexterityContent.providedBy(context):
            req = getRequest()
            context = req.PARENTS[0]

        # create a list of SimpleTerm items:
        terms = []
        for item in items:
            terms.append(
                SimpleTerm(
                    value=item.token,
                    token=str(item.token),
                    title=item.value,
                ))
        # Create a SimpleVocabulary from the terms list and return it:
        return SimpleVocabulary(terms)