mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-22 13:22:19 -06:00
[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:
committed by
Maxime Chambreuil
parent
59460e4a53
commit
adc4b0ccd8
@@ -39,6 +39,8 @@ class DocumentPage(models.Model):
|
||||
default="content"
|
||||
)
|
||||
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
parent_id = fields.Many2one(
|
||||
'document.page',
|
||||
'Category',
|
||||
@@ -60,7 +62,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,
|
||||
@@ -156,10 +167,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
|
||||
|
||||
Reference in New Issue
Block a user