diff --git a/partner_tag_smart_assignation/__manifest__.py b/partner_tag_smart_assignation/__manifest__.py
index c8e661109c5..938425687d4 100644
--- a/partner_tag_smart_assignation/__manifest__.py
+++ b/partner_tag_smart_assignation/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Smart Tagger",
"summary": "Smart tagger, module to have smart tags who " "update themselves alone",
- "version": "16.0.1.0.0",
+ "version": "17.0.1.0.0",
"category": "Other",
"author": "Compassion CH, Odoo Community Association (OCA)",
"license": "AGPL-3",
diff --git a/partner_tag_smart_assignation/tests/test_smart_tagger.py b/partner_tag_smart_assignation/tests/test_smart_tagger.py
index d3fada1de28..7b4ac3505fe 100644
--- a/partner_tag_smart_assignation/tests/test_smart_tagger.py
+++ b/partner_tag_smart_assignation/tests/test_smart_tagger.py
@@ -2,12 +2,12 @@
from datetime import timedelta
from odoo import fields
-from odoo.tests.common import SavepointCase
+from odoo.tests.common import TransactionCase
logger = logging.getLogger(__name__)
-class TestSmartTagger(SavepointCase):
+class TestSmartTagger(TransactionCase):
@classmethod
def setUpClass(cls):
"""Load test data."""
@@ -23,6 +23,7 @@ def setUpClass(cls):
michel_fletcher + chao_wang + david_simpson + john_m_brown + charlie_bernard
)
cls.michel_fletcher = michel_fletcher
+ cls.david_simpson = david_simpson
def create_condition(self):
"""
@@ -34,7 +35,7 @@ def create_condition(self):
"user_id": False,
"model_id": "res.partner",
"active": True,
- "domain": '[["name","ilike","o"]]',
+ "domain": '[["name","like","o"]]',
"context": "{}",
"sort": "[]",
"name": "SmartTagTestCondition",
@@ -75,7 +76,7 @@ def test_create_tag(self):
self.assertFalse(partner in smart_tag.partner_ids)
for partner in smart_tag.partner_ids:
- self.assertTrue("o" in partner.name)
+ self.assertIn("o", partner.name)
def test_modify_partner(self):
"""
@@ -96,7 +97,7 @@ def test_modify_partner(self):
self.assertTrue(michael in smart_tag.partner_ids)
for partner in smart_tag.partner_ids:
- self.assertTrue("o" in partner.name)
+ self.assertIn("o", partner.name)
def test_smart_tag_sql(self):
"""Test query SQL for smart tags"""
@@ -130,16 +131,17 @@ def test_check_validity_dates(self):
"""
Test if the valid_until functionality works correctly
"""
-
# Create a new tag with a 'valid_until' date set to yesterday
yesterday = fields.Date.to_string(fields.Date.today() - timedelta(days=1))
expired_tag = self.create_tag()
expired_tag.update({"valid_until": yesterday})
- expired_tag.update_partner_tags()
- # Reload the tags from the database
- expired_tag.invalidate_cache()
+ # Run the method which is supposed to deactivate expired tags
+ self.env["res.partner.category"]._check_validity_dates()
+
+ # Invalidate cache for the specific record
+ expired_tag.invalidate_recordset()
# Check that the expired tag is now inactive
self.assertFalse(expired_tag.active)
@@ -154,8 +156,8 @@ def test_check_validity_dates(self):
# Run the method which is supposed to deactivate expired tags
self.env["res.partner.category"]._check_validity_dates()
- # Reload the tags from the database
- active_tag.invalidate_cache()
+ # Invalidate cache for the specific record
+ active_tag.invalidate_recordset()
# Check that the active tag is still active
self.assertTrue(active_tag.active)
diff --git a/partner_tag_smart_assignation/views/smart_tagger_view.xml b/partner_tag_smart_assignation/views/smart_tagger_view.xml
index ab9d2333ca7..4d3160129cc 100644
--- a/partner_tag_smart_assignation/views/smart_tagger_view.xml
+++ b/partner_tag_smart_assignation/views/smart_tagger_view.xml
@@ -9,10 +9,7 @@
-
+
@@ -44,26 +41,20 @@
-
-
+
+