From 030f349b42e7f2a395674d8ce8bda79e7162d64a Mon Sep 17 00:00:00 2001 From: bosd Date: Wed, 14 Feb 2024 19:54:51 +0100 Subject: [PATCH 1/2] [FIX] base_tier_validation: Do not write review fields in pending state --- base_tier_validation/models/tier_validation.py | 2 -- base_tier_validation/tests/test_tier_validation.py | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/base_tier_validation/models/tier_validation.py b/base_tier_validation/models/tier_validation.py index 947f21a20c..459085df70 100644 --- a/base_tier_validation/models/tier_validation.py +++ b/base_tier_validation/models/tier_validation.py @@ -339,8 +339,6 @@ def _validate_tier(self, tiers=False): waiting_reviews.write( { "status": "pending", - "done_by": self.env.user.id, - "reviewed_date": fields.Datetime.now(), } ) diff --git a/base_tier_validation/tests/test_tier_validation.py b/base_tier_validation/tests/test_tier_validation.py index 3daa872520..24bed2a681 100644 --- a/base_tier_validation/tests/test_tier_validation.py +++ b/base_tier_validation/tests/test_tier_validation.py @@ -514,12 +514,20 @@ def test_19_waiting_tier(self): # first reviewer does not want notifications # chatter should be empty self.assertFalse(test_record.message_ids) + self.assertTrue(review_1.done_by.id is False) + self.assertTrue(review_1.reviewed_date is False) self.assertTrue(review_2.status == "waiting") + self.assertTrue(review_2.done_by.id is False) + self.assertTrue(review_2.reviewed_date is False) record = test_record.with_user(self.test_user_1.id) record.invalidate_model() record.validate_tier() self.assertTrue(review_1.status == "approved") + self.assertFalse(review_1.reviewed_date is False) + self.assertTrue(review_1.done_by.id == self.test_user_1.id) self.assertTrue(review_2.status == "pending") + self.assertTrue(review_2.done_by.id is False) + self.assertTrue(review_2.reviewed_date is False) def test_20_no_sequence(self): # Create new test record From ed9c4492065b8cdf0907e2a4cd35571ec74eeada Mon Sep 17 00:00:00 2001 From: bosd Date: Wed, 14 Feb 2024 20:13:37 +0100 Subject: [PATCH 2/2] [IMP] base_tier_validation: Test created notification body --- base_tier_validation/tests/test_tier_validation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base_tier_validation/tests/test_tier_validation.py b/base_tier_validation/tests/test_tier_validation.py index 24bed2a681..73eca3d1fa 100644 --- a/base_tier_validation/tests/test_tier_validation.py +++ b/base_tier_validation/tests/test_tier_validation.py @@ -420,6 +420,8 @@ def test_15_review_user_count(self): self.assertEqual(len(count), 1) # False Review self.assertFalse(self.test_record._calc_reviews_validated(False)) + # test notification message bodies + self.assertIn("created", self.test_record._notify_created_review_body()) self.assertIn("requested", self.test_record._notify_requested_review_body()) self.assertIn("rejected", self.test_record._notify_rejected_review_body()) self.assertIn("accepted", self.test_record._notify_accepted_reviews_body())