From 4f6c1ff67139aad6c9936038c22886e0c31b42fe Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Wed, 8 Mar 2017 10:58:24 +0100 Subject: [PATCH] [FIX] help_online: avoid removal of exported pages Always use the '__export__' prefix when generating the xmlid of pages exported by the export wizard to avoid autmomatic removal of these pages by Odoo on system update (-u) --- help_online/tests/test_export_help_wizard.py | 4 ++-- help_online/wizards/export_help_wizard.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/help_online/tests/test_export_help_wizard.py b/help_online/tests/test_export_help_wizard.py index fb0ec1f2..933ca3cb 100644 --- a/help_online/tests/test_export_help_wizard.py +++ b/help_online/tests/test_export_help_wizard.py @@ -27,7 +27,7 @@ class TestExportHelpWizard(TestWizardCommon): parser = ET.XMLParser(remove_blank_text=True) rootXml = ET.XML(xmlData, parser=parser) - xPath = ".//template[@id='website.%s']" % self.pageName + xPath = ".//template[@id='__export__.%s']" % self.pageName templateNodeList = rootXml.findall(xPath) self.assertEqual(len(templateNodeList), 1) self.assertNotIn("website.", templateNodeList[0].attrib['name']) @@ -47,7 +47,7 @@ class TestExportHelpWizard(TestWizardCommon): self.assertIn("/web/image/%s" % self.imgXmlId, imgSrc) if self.pageTemplate: - xPath = ".//template[@id='website.%s_snippet']" % self.pageName + xPath = ".//template[@id='__export__.%s_snippet']" % self.pageName templateNodeList = rootXml.findall(xPath) self.assertEqual(len(templateNodeList), 1) self.assertNotIn("website.", templateNodeList[0].attrib['name']) diff --git a/help_online/wizards/export_help_wizard.py b/help_online/wizards/export_help_wizard.py index aad0f08d..e7c7da91 100644 --- a/help_online/wizards/export_help_wizard.py +++ b/help_online/wizards/export_help_wizard.py @@ -271,6 +271,10 @@ class ExportHelpWizard(models.TransientModel): return data[0].name else: module, name = template_name.split('.') + # always use __export__ as module by convention to + # avoid the removal by odoo of the exported pages on system + # update (-u ) + module = "__export__" postfix = ir_model_data.search_count( [('module', '=', module), ('name', 'like', name)])