From cae7bbe7cb2e4e452dddee72eb0b679e1d13b392 Mon Sep 17 00:00:00 2001 From: Waleed Mohsen Date: Tue, 5 Nov 2019 16:57:02 +0300 Subject: [PATCH] Fix change log html The chnage log HTML is not showing correctly in form view so this fix will fix it. other thing, there is some character breaking the read() method added decode("UTF-8") to fix it. --- app_store/models/appstore_account.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app_store/models/appstore_account.py b/app_store/models/appstore_account.py index da125d6fe..d4e224000 100644 --- a/app_store/models/appstore_account.py +++ b/app_store/models/appstore_account.py @@ -20,6 +20,7 @@ import json from odoo import api, fields, models +from odoo.tools import plaintext2html class AppstoreAccount(models.Model): @@ -147,16 +148,16 @@ def analyse_module(self, module_name, app_directory): try: #Read /doc/changelog.rst file if os.path.exists(app_directory + "/" + module_name + "/doc/changelog.rst"): - with open(app_directory + "/" + module_name + "/doc/changelog.rst", 'r') as changelogfile: - changelogdata = changelogfile.read() + with open(app_directory + "/" + module_name + "/doc/changelog.rst", 'rb') as changelogfile: + changelogdata = changelogfile.read().decode("UTF-8") module_overview.change_log_raw = changelogdata - module_overview.change_log_html = changelogdata + module_overview.change_log_html = plaintext2html(changelogdata) #module_overview.change_log_html = publish_string(changelogdata, writer_name='html').split("\n",2)[2] #Read /static/description/index.html file if os.path.exists(app_directory + "/" + module_name + "/static/description/index.html"): - with open(app_directory + "/" + module_name + "/static/description/index.html", 'r') as descriptionfile: - descriptiondata = descriptionfile.read() + with open(app_directory + "/" + module_name + "/static/description/index.html", 'rb') as descriptionfile: + descriptiondata = descriptionfile.read().decode("UTF-8") module_overview.store_description = descriptiondata if 'depends' in op_settings: @@ -308,4 +309,4 @@ def _read_xml(self, file_path, m_id): model = model_exist[0] #add this view to this model - self.env['module.overview.model.view'].create({'model_id': model.id, 'name': record_name, 'x_id': record_id}) \ No newline at end of file + self.env['module.overview.model.view'].create({'model_id': model.id, 'name': record_name, 'x_id': record_id})