diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py index ebc57c6918c70caed4014570a8becde4c9a273fe..ebfcdc1f206e1f74230e7e4d73fb68812ecc4845 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py @@ -150,8 +150,13 @@ def addProperty(tr, entity, propertyCode, section, propertyLabel, dataType, voca if propertyCode in propertiesCache: property = propertiesCache[propertyCode]; else: - property = createProperty(tr, propertyCode, dataType, propertyLabel, propertyDescription, vocabularyCode); + property = createProperty(tr, propertyCode, dataType); + property.setDescription(propertyDescription); + property.setLabel(propertyLabel); + if dataType == DataType.CONTROLLEDVOCABULARY: + property.setVocabulary(vocabulariesCache[vocabularyCode]); + propertyAssignment = tr.assignPropertyType(entity, property); #If the assignment already exists, returns the existing one propertyAssignment.setSection(section); propertyAssignment.setShownEdit(True); @@ -166,13 +171,9 @@ def addProperty(tr, entity, propertyCode, section, propertyLabel, dataType, voca propertyAssignment.setShownEdit(False); propertyAssignment.setScriptName(dynamicScript); -def createProperty(tr, propertyCode, dataType, propertyLabel, propertyDescription, vocabularyCode): +def createProperty(tr, propertyCode, dataType): property = tr.getOrCreateNewPropertyType(propertyCode, dataType); - property.setDescription(propertyDescription); - property.setLabel(propertyLabel); propertiesCache[propertyCode] = property; - if dataType == DataType.CONTROLLEDVOCABULARY: - property.setVocabulary(vocabulariesCache[vocabularyCode]); return property; def getAnnotationsScript(tr, sampleTypeCode):