Browse Source

[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)
pull/526/head
Laurent Mignon (ACSONE) 7 years ago
parent
commit
4f6c1ff671
  1. 4
      help_online/tests/test_export_help_wizard.py
  2. 4
      help_online/wizards/export_help_wizard.py

4
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'])

4
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)])

Loading…
Cancel
Save