Removed required attribute on key-number "number" property
authorThierry Florac <thierry.florac@onf.fr>
Mon, 13 May 2019 16:08:34 +0200
changeset 1307 8a0e2bc64193
parent 1306 fe17a8ef8900
child 1308 4dd7d89350e0
Removed required attribute on key-number "number" property
src/pyams_content/component/keynumber/interfaces.py
src/pyams_content/component/keynumber/zmi/__init__.py
--- a/src/pyams_content/component/keynumber/interfaces.py	Mon May 13 15:10:46 2019 +0200
+++ b/src/pyams_content/component/keynumber/interfaces.py	Mon May 13 16:08:34 2019 +0200
@@ -49,7 +49,7 @@
 
     number = TextLine(title=_("Number"),
                       description=_("Key number value"),
-                      required=True)
+                      required=False)
 
     unit = I18nTextLineField(title=_('key-number-unit', default="Unit"),
                              description=_("Displayed unit"),
--- a/src/pyams_content/component/keynumber/zmi/__init__.py	Mon May 13 15:10:46 2019 +0200
+++ b/src/pyams_content/component/keynumber/zmi/__init__.py	Mon May 13 16:08:34 2019 +0200
@@ -173,6 +173,9 @@
     attrName = 'number'
     weight = 20
 
+    def getValue(self, obj):
+        return super(KeyNumbersTableNameColumn, self).getValue(obj) or '--'
+
 
 @adapter_config(name='unit', context=(IKeyNumberContainer, IPyAMSLayer, KeyNumbersTable), provides=IColumn)
 class KeyNumbersTableUnitColumn(I18nColumn, I18nAttrColumn):