Python 2.7 Plone:新顺序中的字段数与架构中的字段数不同

Python 2.7 Plone:新顺序中的字段数与架构中的字段数不同,python-2.7,widget,plone,plone-4.x,Python 2.7,Widget,Plone,Plone 4.x,我有一个batch.py文件,其中有许多字段。因此,我正试图根据我的要求在batch.py中添加一个新的ReferenceField ExtReferenceField('Asfield', required = 0, multiValued=1, allowed_types = ('AnalysisService',), referenceClass = HoldingReference, relationship

我有一个batch.py文件,其中有许多字段。因此,我正试图根据我的要求在batch.py中添加一个新的ReferenceField

ExtReferenceField('Asfield',
        required = 0,
        multiValued=1,
        allowed_types = ('AnalysisService',),
        referenceClass = HoldingReference,
        relationship = 'BatchAsfield',
        widget=SearchAnalysisWidget(
            label=_("AS Search"),
            description="",
            render_own_label=False,
            visible={'edit': 'visible', 'view': 'visible'},
            #visible=True,
            base_query={'inactive_state': 'active'},
            catalog_name='portal_catalog',
            showOn=True,
            colModel = [{'columnName':'AsCode','width':'20','label':_('Code')},
                        {'columnName':'AsName','width':'80','label':_('Name')},
                        {'columnName':'AsDate','width':'80','label':_('Date')},
                        {'columnName':'AsTat','width':'80','label':_('TAT')},
                        {'columnName':'AsLocation','width':'80','label':_('Location')},
                        ],
        ),
    ),
它给我的错误如下:

ValueError:新顺序中的字段数与 架构中的字段数


我得到了这个错误的解决方案。出现此错误是因为我没有在batch.py文件的getOrder方法中添加我的Asfield

实际上,我们的小部件需要在浏览器中显示特定的顺序。因此,通过使用getOrder方法,我们可以在浏览器中维护所有小部件(字段)的顺序。此getOrder在同一文件batch.py中定义

def getOrder(self, schematas):
        schematas['default'] = ['id',
                                'title',
                                'description',
                                'BatchID',
                                'ClientPatientID',
                                'Patient',
                                'Client',
                                'Doctor',
                                'Asfield',
                                'ClientBatchID',
                                'ReceiptNo',
                                'AmountPaid',
                                'BatchDate',
                                'OnsetDate',
                                'PatientAgeAtCaseOnsetDate',

                                 ]
        return schematas
我只是在医生之后添加Asfield(ReferenceField)(在浏览器中,这个Referencewidget将在医生之后显示)。您可以在需要的地方添加小部件

这是解决此值错误的简单方法