From e58f864fd75ad4b391ea9b768f7d3e93edc7dc0d Mon Sep 17 00:00:00 2001 From: Umesh Gupta Date: Fri, 3 Jun 2022 06:55:39 +0000 Subject: [PATCH] [FIX] knowledge: unarchive multiple articles Currently, when we unarchive a single article, it works properly by making it active again and redirecting user to that article. But when we try to unarchive multiple articles, it throws traceback. This commit fixes the issue by properly handling the action for unarchiving, which now will simply reload the same action in case of multiple articles. Note that behavior for unarchiving single article is still the same. taskID-2869659 closes odoo/odoo#92851 Signed-off-by: Thibault Delavallee (tde) --- addons/knowledge/models/knowledge_article.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/knowledge/models/knowledge_article.py b/addons/knowledge/models/knowledge_article.py index 9be97f701b8..d62d2bf59ce 100644 --- a/addons/knowledge/models/knowledge_article.py +++ b/addons/knowledge/models/knowledge_article.py @@ -716,8 +716,10 @@ class Article(models.Model): return self.with_context(res_id=False).action_home_page() def action_unarchive(self): - super(Article, self).action_unarchive() - return self.with_context(res_id=self.id).action_home_page() + res = super(Article, self).action_unarchive() + if len(self) == 1: + return self.with_context(res_id=self.id).action_home_page() + return res # ------------------------------------------------------------ # SEQUENCE / ORDERING