Commit d5bcc417 authored by Jérome Perrin's avatar Jérome Perrin

Implement "delete bug lines after cloning a bug"

https://svn.erp5.org/?view=rev&revision=24758 in the class, because the user
may not have permissions to use manage_delObjects
Add test this time


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24830 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1a77135f
...@@ -57,6 +57,7 @@ class Bug(Ticket): ...@@ -57,6 +57,7 @@ class Bug(Ticket):
, PropertySheet.Movement , PropertySheet.Movement
, PropertySheet.Bug , PropertySheet.Bug
) )
def SearchableText(self): def SearchableText(self):
""" Used by the catalog for basic full text indexing """ """ Used by the catalog for basic full text indexing """
full_text = [] full_text = []
...@@ -67,3 +68,9 @@ class Bug(Ticket): ...@@ -67,3 +68,9 @@ class Bug(Ticket):
self.getDescription(), self.getDescription(),
' '.join(full_text)) ' '.join(full_text))
def manage_afterClone(self, item):
Ticket.manage_afterClone(self, item)
# delete existing bug lines
self.manage_delObjects(list(self.contentIds(
filter=dict(portal_type='Bug Line'))))
...@@ -304,9 +304,10 @@ class TestBug(ERP5TypeTestCase): ...@@ -304,9 +304,10 @@ class TestBug(ERP5TypeTestCase):
Create a dummy bug Create a dummy bug
""" """
bug_to_clone = sequence.get('bug') bug_to_clone = sequence.get('bug')
self.assertNotEquals(len(bug_to_clone.contentValues()), 0)
bug = bug_to_clone.Base_createCloneDocument(batch_mode=1) bug = bug_to_clone.Base_createCloneDocument(batch_mode=1)
self.assertEquals("#%s" % bug.getId(), bug.getReference()) self.assertEquals("#%s" % bug.getId(), bug.getReference())
#self.assertEquals(bug_message.getSourceTradeValue().getTitle(), 'dummy') self.assertEquals(len(bug.contentValues()), 0)
def stepOpenBug(self, sequence=None, sequence_list=None, **kw): def stepOpenBug(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -501,6 +502,7 @@ class TestBug(ERP5TypeTestCase): ...@@ -501,6 +502,7 @@ class TestBug(ERP5TypeTestCase):
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateBug', step_list = [ 'stepCreateBug',
'stepCheckBugInit', 'stepCheckBugInit',
'stepOpenBug',
'stepCloneAndCheckBug' 'stepCloneAndCheckBug'
] ]
sequence_string = ' '.join(step_list) sequence_string = ' '.join(step_list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment