diff --git a/document_page/__manifest__.py b/document_page/__manifest__.py index 29e548cc..a6573d96 100644 --- a/document_page/__manifest__.py +++ b/document_page/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Document Page', - 'version': '11.0.1.0.0', + 'version': '11.0.2.0.0', 'category': 'Knowledge Management', 'author': 'OpenERP SA, Odoo Community Association (OCA)', 'images': [ diff --git a/document_page/models/document_page.py b/document_page/models/document_page.py index 24524210..3cb3b527 100644 --- a/document_page/models/document_page.py +++ b/document_page/models/document_page.py @@ -21,6 +21,8 @@ class DocumentPage(models.Model): default="content" ) + active = fields.Boolean(default=True) + parent_id = fields.Many2one( 'document.page', 'Category', @@ -42,7 +44,16 @@ class DocumentPage(models.Model): ) # no-op computed field - summary = fields.Char( + draft_name = fields.Char( + string='Name', + help='Name for the changes made', + compute=lambda x: x, + inverse=lambda x: x, + ) + + # no-op computed field + draft_summary = fields.Char( + string='Summary', help='Describe the changes made', compute=lambda x: x, inverse=lambda x: x, @@ -124,10 +135,12 @@ class DocumentPage(models.Model): @api.multi def _inverse_content(self): for rec in self: - if rec.type == 'content': + if rec.type == 'content' and \ + rec.content != rec.history_head.content: rec._create_history({ + 'name': rec.draft_name, + 'summary': rec.draft_summary, 'content': rec.content, - 'summary': rec.summary, }) @api.multi diff --git a/document_page/models/document_page_history.py b/document_page/models/document_page_history.py index a5e70e78..31411ba7 100644 --- a/document_page/models/document_page_history.py +++ b/document_page/models/document_page_history.py @@ -14,12 +14,12 @@ class DocumentPageHistory(models.Model): _order = 'id DESC' page_id = fields.Many2one('document.page', 'Page', ondelete='cascade') - summary = fields.Char('Summary', index=True) - content = fields.Text("Content") + name = fields.Char(index=True) + summary = fields.Char(index=True) + content = fields.Text() diff = fields.Text(compute='_compute_diff') @api.multi - @api.depends('content', 'page_id.history_ids') def _compute_diff(self): """Shows a diff between this version and the previous version""" history = self.env['document.page.history'] diff --git a/document_page/views/document_page.xml b/document_page/views/document_page.xml index f19341a5..c9681ff5 100644 --- a/document_page/views/document_page.xml +++ b/document_page/views/document_page.xml @@ -38,6 +38,11 @@
+
+ +

@@ -54,17 +59,21 @@ - + diff --git a/document_page/views/document_page_history.xml b/document_page/views/document_page_history.xml index b0b49faf..413fd6e4 100755 --- a/document_page/views/document_page_history.xml +++ b/document_page/views/document_page_history.xml @@ -9,6 +9,7 @@ + @@ -39,18 +40,19 @@ -

+

+ + + + -