[MIG] document_page: Migration to 15.0

This commit is contained in:
Jacob Oldfield 2021-10-29 20:55:45 +11:00 committed by Justine Doutreloux
parent 374f250e2b
commit a2e0c9b8dd
14 changed files with 43 additions and 55 deletions

View File

@ -14,13 +14,13 @@ Document Page
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
:target: https://github.com/OCA/knowledge/tree/14.0/document_page :target: https://github.com/OCA/knowledge/tree/15.0/document_page
:alt: OCA/knowledge :alt: OCA/knowledge
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-document_page :target: https://translation.odoo-community.org/projects/knowledge-15-0/knowledge-15-0-document_page
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/118/14.0 :target: https://runbot.odoo-community.org/runbot/118/15.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -57,7 +57,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -109,6 +109,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/14.0/document_page>`_ project on GitHub. This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/15.0/document_page>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -4,7 +4,7 @@
{ {
"name": "Document Page", "name": "Document Page",
"version": "14.0.1.0.0", "version": "15.0.1.0.0",
"category": "Knowledge Management", "category": "Knowledge Management",
"author": "OpenERP SA, Odoo Community Association (OCA)", "author": "OpenERP SA, Odoo Community Association (OCA)",
"images": [ "images": [
@ -26,8 +26,12 @@
"views/document_page.xml", "views/document_page.xml",
"views/document_page_category.xml", "views/document_page_category.xml",
"views/document_page_history.xml", "views/document_page_history.xml",
"views/document_page_assets.xml",
"views/report_document_page.xml", "views/report_document_page.xml",
], ],
"demo": ["demo/document_page.xml"], "demo": ["demo/document_page.xml"],
"assets": {
"web.assets_backend": [
"document_page/static/src/scss/document_page.scss",
],
},
} }

View File

@ -21,7 +21,7 @@ Additional ressources
</record> </record>
<record id="demo_page1" model="document.page"> <record id="demo_page1" model="document.page">
<field name="name">Odoo 14.0 Functional Demo</field> <field name="name">Odoo 15.0 Functional Demo</field>
<field name="draft_name">1.0</field> <field name="draft_name">1.0</field>
<field name="draft_summary">Init</field> <field name="draft_summary">Init</field>
<field name="parent_id" ref="demo_category1" /> <field name="parent_id" ref="demo_category1" />
@ -29,22 +29,26 @@ Additional ressources
<![CDATA[ <![CDATA[
<br> <br>
<br> <br>
The news is out, Odoo's latest version 14.0 is here. It's more<br> The news is out, Odoo's latest version 15.0 is here. It's more<br>
user-friendly, even more business oriented and efficient to manage your company<br> user-friendly, even more business oriented and efficient to manage your company<br>
<br> <br>
How to discover the latest version 14.0?<br> How to discover the latest version 15.0?<br>
<br> <br>
Demo : <a target="https://demo.odoo.com" href="https://demo.odoo.com" style="background: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC&quot;) no-repeat scroll right center transparent;padding-right: 13px;"></a><br> Demo : <a target="https://demo.odoo.com" href="https://demo.odoo.com" style="background: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC&quot;) no-repeat scroll right center transparent;padding-right: 13px;"></a><br>
Online: <a target="https://www.odoo.com/trial" href="https://www.odoo.com/trial" style="background: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC&quot;) no-repeat scroll right center transparent;padding-right: 13px;"></a><br> Online: <a target="https://www.odoo.com/trial" href="https://www.odoo.com/trial" style="background: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC&quot;) no-repeat scroll right center transparent;padding-right: 13px;"></a><br>
Download: <a target="https://www.odoo.com/page/download" href="https://www.odoo.com/page/download" style="background: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC&quot;) no-repeat scroll right center transparent;padding-right: 13px;"></a><br> Download: <a target="https://www.odoo.com/page/download" href="https://www.odoo.com/page/download" style="background: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC&quot;) no-repeat scroll right center transparent;padding-right: 13px;"></a><br>
<br> <br>
We have also put together a functional demo that presents 14.0. Watch this video<br> We have also put together a functional demo that presents 15.0. Watch this video<br>
to learn directly from us what Odoo 14.0 can do for you. Share it in your<br> to learn directly from us what Odoo 15.0 can do for you. Share it in your<br>
company, with your clients and implement it now for your business.<br> company, with your clients and implement it now for your business.<br>
<br> <br>
<h3>Watch on Youtube!</h3><br> <h3>Watch on Youtube!</h3><br>
<br> <br>
<iframe width="480" height="390" src="https://www.youtube.com/embed/zLSgpQM_tms" frameborder="0" allowfullscreen=""></iframe><br> <div class="media_iframe_video" data-oe-expression="//www.youtube.com/embed/zLSgpQM_tms">
<div class="css_editable_mode_display" />
<div class="media_iframe_video_size" />
<iframe src="//www.youtube.com/embed/zLSgpQM_tms" allowfullscreen="allowfullscreen" frameborder="0" />
</div>
<br> <br>
<br> <br>
]]> ]]>
@ -101,7 +105,7 @@ you change your mind there is a reset button to return to the default view.<br>
<field name="content"> <field name="content">
<![CDATA[ <![CDATA[
<br> <br>
The Odoo touchscreen point of sale available with 14.0 allows you<br> The Odoo touchscreen point of sale available with 15.0 allows you<br>
to manage your shop sales very easily. It's fully web based so that you don't<br> to manage your shop sales very easily. It's fully web based so that you don't<br>
have to install or deploy any software and all the sales shops can be easily<br> have to install or deploy any software and all the sales shops can be easily<br>
consolidated. It works in connected and disconnected modes so that you can<br> consolidated. It works in connected and disconnected modes so that you can<br>

View File

@ -18,7 +18,6 @@ class DocumentPage(models.Model):
name = fields.Char("Title", required=True) name = fields.Char("Title", required=True)
type = fields.Selection( type = fields.Selection(
[("content", "Content"), ("category", "Category")], [("content", "Content"), ("category", "Category")],
"Type",
help="Page type", help="Page type",
default="content", default="content",
) )
@ -27,11 +26,11 @@ class DocumentPage(models.Model):
"document.page", "Category", domain=[("type", "=", "category")] "document.page", "Category", domain=[("type", "=", "category")]
) )
child_ids = fields.One2many("document.page", "parent_id", "Children") child_ids = fields.One2many("document.page", "parent_id", "Children")
content = fields.Text( content = fields.Html(
"Content",
compute="_compute_content", compute="_compute_content",
inverse="_inverse_content", inverse="_inverse_content",
search="_search_content", search="_search_content",
sanitize=False,
) )
draft_name = fields.Char( draft_name = fields.Char(
@ -49,7 +48,6 @@ class DocumentPage(models.Model):
) )
template = fields.Html( template = fields.Html(
"Template",
help="Template that will be used as a content template " help="Template that will be used as a content template "
"for all new page of this category.", "for all new page of this category.",
) )

View File

@ -16,8 +16,8 @@ class DocumentPageHistory(models.Model):
page_id = fields.Many2one("document.page", "Page", ondelete="cascade") page_id = fields.Many2one("document.page", "Page", ondelete="cascade")
name = fields.Char(index=True) name = fields.Char(index=True)
summary = fields.Char(index=True) summary = fields.Char(index=True)
content = fields.Text() content = fields.Html(sanitize=False)
diff = fields.Text(compute="_compute_diff") diff = fields.Html(compute="_compute_diff")
company_id = fields.Many2one( company_id = fields.Many2one(
"res.company", "res.company",

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/knowledge/tree/14.0/document_page"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-document_page"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/118/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/knowledge/tree/15.0/document_page"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/knowledge-15-0/knowledge-15-0-document_page"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/118/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to write web pages for internal documentation.</p> <p>This module allows you to write web pages for internal documentation.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
@ -407,7 +407,7 @@ ul.auto-toc {
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_page%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_page%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -454,7 +454,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/14.0/document_page">OCA/knowledge</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/15.0/document_page">OCA/knowledge</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -15,12 +15,12 @@ class TestDocumentPage(common.TransactionCase):
{ {
"name": "Test Page 1", "name": "Test Page 1",
"parent_id": self.category1.id, "parent_id": self.category1.id,
"content": "Test content", "content": "<p>Test content</p>",
} }
) )
self.assertEqual(page.content, "Test content") self.assertEqual(page.content, "<p>Test content</p>")
self.assertEqual(len(page.history_ids), 1) self.assertEqual(len(page.history_ids), 1)
page.content = "New content for Demo Page" page.content = "<p>New content for Demo Page</p>"
self.assertEqual(len(page.history_ids), 2) self.assertEqual(len(page.history_ids), 2)
def test_category_template(self): def test_category_template(self):

View File

@ -26,4 +26,4 @@ class TestDocumentPageCreateMenu(common.TransactionCase):
active_id=[self.ref("document_page.demo_page1")] active_id=[self.ref("document_page.demo_page1")]
).default_get(fields_list) ).default_get(fields_list)
self.assertEqual(res["menu_name"], "Odoo 14.0 Functional Demo") self.assertEqual(res["menu_name"], "Odoo 15.0 Functional Demo")

View File

@ -7,7 +7,7 @@
<field name="field_parent">child_ids</field> <field name="field_parent">child_ids</field>
<field name="priority">100</field> <field name="priority">100</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Document Page"> <tree>
<field name="name" /> <field name="name" />
<field name="content_uid" /> <field name="content_uid" />
<field name="content_date" /> <field name="content_date" />
@ -19,7 +19,7 @@
<field name="name">document.page.list</field> <field name="name">document.page.list</field>
<field name="model">document.page</field> <field name="model">document.page</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Document Page"> <tree>
<field name="name" /> <field name="name" />
<field name="parent_id" /> <field name="parent_id" />
<field name="company_id" groups="base.group_multi_company" /> <field name="company_id" groups="base.group_multi_company" />
@ -55,7 +55,7 @@
widget="html" widget="html"
placeholder="e.g. Once upon a time..." placeholder="e.g. Once upon a time..."
required="1" required="1"
options="{'safe': True}" options="{'safe': True, 'codeview': True}"
/> />
</div> </div>
</group> </group>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template
id="assets_backend"
name="document_page assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<link
rel="stylesheet"
type="text/scss"
href="/document_page/static/src/scss/document_page.scss"
/>
</xpath>
</template>
</odoo>

View File

@ -41,7 +41,7 @@
name="content" name="content"
widget="html" widget="html"
class="oe_view_only" class="oe_view_only"
options='{"safe": True}' options='{"safe": True, "codeview": True}'
required="0" required="0"
/> />
</page> </page>
@ -58,7 +58,7 @@
<field name="name">document.page.category.tree</field> <field name="name">document.page.category.tree</field>
<field name="model">document.page</field> <field name="model">document.page</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Categories"> <tree>
<field name="name" /> <field name="name" />
<field name="parent_id" /> <field name="parent_id" />
<field name="create_uid" invisible="1" /> <field name="create_uid" invisible="1" />

View File

@ -6,7 +6,7 @@
<field name="name">document.page.history.tree</field> <field name="name">document.page.history.tree</field>
<field name="model">document.page.history</field> <field name="model">document.page.history</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Document History"> <tree>
<field name="id" /> <field name="id" />
<field name="page_id" /> <field name="page_id" />
<field name="name" /> <field name="name" />
@ -63,7 +63,7 @@
name="content" name="content"
widget="html" widget="html"
placeholder="e.g. Once upon a time..." placeholder="e.g. Once upon a time..."
options="{'safe': True}" options="{'safe': True, 'codeview': True}"
/> />
</page> </page>
<page name="diff" string="Changes"> <page name="diff" string="Changes">

View File

@ -10,7 +10,7 @@ class DocumentPageCreateMenu(models.TransientModel):
_name = "document.page.create.menu" _name = "document.page.create.menu"
_description = "Wizard Create Menu" _description = "Wizard Create Menu"
menu_name = fields.Char("Menu Name", required=True) menu_name = fields.Char(required=True)
menu_parent_id = fields.Many2one("ir.ui.menu", "Parent Menu", required=True) menu_parent_id = fields.Many2one("ir.ui.menu", "Parent Menu", required=True)
@api.model @api.model
@ -33,9 +33,7 @@ class DocumentPageCreateMenu(models.TransientModel):
page = obj_page.browse(page_id) page = obj_page.browse(page_id)
data = self[0] data = self[0]
view_id = obj_model_data.sudo().get_object_reference( view_id = obj_model_data._xmlid_to_res_id("document_page.view_wiki_menu_form")
"document_page", "view_wiki_menu_form"
)[1]
value = { value = {
"name": "Document Page", "name": "Document Page",
"view_mode": "form,tree", "view_mode": "form,tree",

View File

@ -27,4 +27,4 @@ class DocumentPageShowDiff(models.TransientModel):
raise UserError(_("Select one or maximum two history revisions!")) raise UserError(_("Select one or maximum two history revisions!"))
return diff return diff
diff = fields.Text(readonly=True, default=_get_diff) diff = fields.Html(readonly=True, default=_get_diff)