[damned-lies] [vertimus] Update state date when posting comment (Fixes #656800)



commit 0d8fb673e7b1913c03fbae92189c4c0b10885ca0
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Aug 18 10:22:19 2011 +0200

    [vertimus] Update state date when posting comment (Fixes #656800)

 vertimus/models.py         |    3 +++
 vertimus/tests/__init__.py |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/vertimus/models.py b/vertimus/models.py
index f22d954..46d5038 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -410,6 +410,9 @@ class Action(ActionAbstract):
                 # Committed is the last state of the workflow, archive actions
                 arch_action = self.new_by_name('AA', person=self.person)
                 arch_action.apply_on(self.state_db)
+        else:
+            # Force updated state date to be updated
+            self.state_db.save()
 
     def get_previous_action_with_po(self):
         """
diff --git a/vertimus/tests/__init__.py b/vertimus/tests/__init__.py
index 4b01580..c5bb0ab 100644
--- a/vertimus/tests/__init__.py
+++ b/vertimus/tests/__init__.py
@@ -192,12 +192,14 @@ class VertimusTest(TeamsAndRolesTests):
     def test_action_wc(self):
         state = StateNone(branch=self.b, domain=self.d, language=self.l)
         state.save()
+        prev_updated = state.updated
 
         action = Action.new_by_name('WC', person=self.pt, comment="Hi!")
         action.apply_on(state)
         # Test that submitting a comment without text generates a validation error
         form = ActionForm([('WC', u'Write a comment')], QueryDict('action=WC&comment='))
         self.assertTrue("A comment is needed" in str(form.errors))
+        self.assertNotEqual(state.updated, prev_updated)
 
     def test_action_rt(self):
         state = StateNone(branch=self.b, domain=self.d, language=self.l)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]