[9.0] Improve document_page (#162)

* [document_page] FIX creating history when there are no changes made. Add history name field, to name revisions. Modified views to allow setting this field.

* [document_page] FIX BUG: UI hanging when editing content. This was due to the api.depends on _compute_diff. Removing it because it's not really necessary since the field is not stored.

* [document_page] page_id should be readonly.

* [document_page] Implement active field

* [document_page] Update version number
This commit is contained in:
Iván Todorovich
2018-06-01 15:36:19 -03:00
committed by Maxime Chambreuil
parent 59460e4a53
commit adc4b0ccd8
5 changed files with 40 additions and 15 deletions

View File

@@ -30,12 +30,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']