[FIX] knowledge: fix resequencing articles
Purpose ======= Properly display and resequence articles based on sequence field. Articles are currently not sorted based on sequence, and when moving articles outside of a parent resequencing is not applied. Specifications ============== Properly resequence articles not only if the parent_id value is non-false but also if it's in the vals and set to False (when moving an article to the root). Task-2883368 closes odoo/odoo#95078 X-original-commit: 6dde05e8779feb2ad6f8828e1bc2945fcf403248 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Thibault Delavallée
parent
ee689a5945
commit
9f39ca12ae
@@ -144,6 +144,25 @@ class TestKnowledgeArticleSequence(KnowledgeCommon):
|
||||
self.assertSortedSequence(article_private + article_private2)
|
||||
self.assertSortedSequence(article_children[2] + article_children[3] + article_children[1] + article_children[0])
|
||||
|
||||
@users('employee')
|
||||
def test_resequence_with_move_noparent(self):
|
||||
""" Test move resetting parent_id should also compute sequence """
|
||||
article_private = self.article_private.with_env(self.env)
|
||||
article_private_child = self.article_children[0].with_env(self.env)
|
||||
article_private2 = self.article_private2.with_env(self.env)
|
||||
article_root_noise = self.article_root_noise.with_env(self.env)
|
||||
|
||||
self.assertEqual(article_private_child.sequence, 0)
|
||||
article_private_child.move_to(parent_id=False)
|
||||
self.assertEqual(article_private_child.sequence, 6)
|
||||
self.assertSortedSequence(article_root_noise + article_private + article_private2 + article_private_child)
|
||||
article_private_child.move_to(
|
||||
parent_id=False,
|
||||
before_article_id=self.article_root_noise[0].id
|
||||
)
|
||||
self.assertEqual(article_private_child.sequence, 1)
|
||||
self.assertSortedSequence(article_private_child + article_root_noise + article_private + article_private2)
|
||||
|
||||
@users('employee')
|
||||
def test_resequence_with_parent(self):
|
||||
"""Checking the sequence of the articles"""
|
||||
|
||||
Reference in New Issue
Block a user