From 72c92658c5cf62d6e23241b6f408b28845c53c57 Mon Sep 17 00:00:00 2001 From: Lunga Baliwe Date: Thu, 9 Nov 2017 15:07:31 +0200 Subject: [PATCH 1/3] AN-145: Set Initial value of Batch Title to empty string --- bika/lims/content/batch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bika/lims/content/batch.py b/bika/lims/content/batch.py index 82da54de00..368518955e 100644 --- a/bika/lims/content/batch.py +++ b/bika/lims/content/batch.py @@ -222,9 +222,12 @@ def _renameAfterCreation(self, check_auto_id=False): def Title(self): """ Return the Batch ID if title is not defined """ titlefield = self.Schema().getField('title') - if titlefield.widget.visible: + titlevalue = titlefield.get(self) + if titlefield.widget.visible and titlevalue: return safe_unicode(self.title).encode('utf-8') else: + if self.id.startswith('batch.'): + return '' return safe_unicode(self.id).encode('utf-8') def _getCatalogTool(self): From a31ef3a581794f9cca3c7fe647a918ffee599f04 Mon Sep 17 00:00:00 2001 From: Lunga Baliwe Date: Thu, 9 Nov 2017 15:10:07 +0200 Subject: [PATCH 2/3] Changelog --- docs/CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f2892ff114..f823768c18 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -1,6 +1,7 @@ 3.4.0 (unreleased) ------------------ +- AN-145: Set Initial value of Batch Title to empty string - Issue-2268: Show the Unit in Manage Analyses View - BC-147: Default empty WS view should list on due date - Issue-2103: WS Templates not offered for selection From 7a9ba434b85aeb9d61ea246871f3246eeb3e00ca Mon Sep 17 00:00:00 2001 From: Lunga Baliwe Date: Sat, 9 Dec 2017 20:12:41 +0200 Subject: [PATCH 3/3] Using isIDAutoGenerated from plone_utils when setting initial value of batch --- bika/lims/content/batch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bika/lims/content/batch.py b/bika/lims/content/batch.py index 368518955e..e3c95dd7e0 100644 --- a/bika/lims/content/batch.py +++ b/bika/lims/content/batch.py @@ -226,7 +226,8 @@ def Title(self): if titlefield.widget.visible and titlevalue: return safe_unicode(self.title).encode('utf-8') else: - if self.id.startswith('batch.'): + pu = api.portal.get_tool("plone_utils") + if pu.isIDAutoGenerated(self.getId()): return '' return safe_unicode(self.id).encode('utf-8')