fix flake

This commit is contained in:
Florent THOMAS 2022-02-10 08:31:25 +01:00
parent 6104844287
commit 741544cb8e
2 changed files with 5 additions and 5 deletions

View File

@ -119,7 +119,7 @@ class DocumentPage(models.Model):
child_ids = self child_ids = self
if vals.get("color", False) and len(vals) == 1: if vals.get("color", False) and len(vals) == 1:
child_ids = self.search( child_ids = self.search(
[("type", "=", "category"), [("type", "=", "category"),
("parent_id", "child_of", self.ids)] ("parent_id", "child_of", self.ids)]
) )
res = super(DocumentPage, child_ids).write(vals) res = super(DocumentPage, child_ids).write(vals)
@ -185,8 +185,8 @@ class DocumentPage(models.Model):
@api.multi @api.multi
def _inverse_content(self): def _inverse_content(self):
for rec in self: for rec in self:
if rec.type == "content" and \ if rec.type == "content" \
rec.content != rec.history_head.content: and rec.content != rec.history_head.content:
rec._create_history( rec._create_history(
{ {
"name": rec.draft_name, "name": rec.draft_name,

View File

@ -32,14 +32,14 @@ class TestDocumentPage(common.TransactionCase):
def test_page_history_diff(self): def test_page_history_diff(self):
page = self.page_obj.create({ page = self.page_obj.create({
"name": "Test Page 3", "name": "Test Page 3",
"content": "Test content"}) "content": "Test content"})
page.content = "New content" page.content = "New content"
self.assertIsNotNone(page.history_ids[0].diff) self.assertIsNotNone(page.history_ids[0].diff)
def test_page_link(self): def test_page_link(self):
page = self.page_obj.create({ page = self.page_obj.create({
"name": "Test Page 3", "name": "Test Page 3",
"content": "Test content"}) "content": "Test content"})
self.assertEqual( self.assertEqual(
page.backend_url, page.backend_url,