mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-24 17:38:42 -06:00
commit
57393d3c8e
@ -3,36 +3,31 @@
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Document Page',
|
"name": "Documentation Page",
|
||||||
'version': '12.0.1.3.0',
|
"version": "12.0.1.4.0",
|
||||||
'category': 'Knowledge Management',
|
"category": "Knowledge Management",
|
||||||
'author': 'OpenERP SA, Odoo Community Association (OCA)',
|
"author": "OpenERP SA, Odoo Community Association (OCA)",
|
||||||
'images': [
|
"images": [
|
||||||
'images/category_list.png',
|
"images/category_list.png",
|
||||||
'images/create_category.png',
|
"images/create_category.png",
|
||||||
'images/page_list.png',
|
"images/page_list.png",
|
||||||
'images/create_page.png',
|
"images/create_page.png",
|
||||||
'images/customer_invoice.jpeg',
|
"images/customer_invoice.jpeg",
|
||||||
'images/page_history.png',
|
"images/page_history.png",
|
||||||
],
|
],
|
||||||
'website': 'https://github.com/OCA/knowledge',
|
"website": "https://github.com/OCA/knowledge",
|
||||||
'license': 'AGPL-3',
|
"license": "AGPL-3",
|
||||||
'depends': [
|
"depends": ["mail", "knowledge"],
|
||||||
'mail',
|
"data": [
|
||||||
'knowledge',
|
"security/document_page_security.xml",
|
||||||
],
|
"security/ir.model.access.csv",
|
||||||
'data': [
|
"wizard/document_page_create_menu.xml",
|
||||||
'security/document_page_security.xml',
|
"wizard/document_page_show_diff.xml",
|
||||||
'security/ir.model.access.csv',
|
"views/document_page.xml",
|
||||||
'wizard/document_page_create_menu.xml',
|
"views/document_page_category.xml",
|
||||||
'wizard/document_page_show_diff.xml',
|
"views/document_page_history.xml",
|
||||||
'views/document_page.xml',
|
"views/document_page_assets.xml",
|
||||||
'views/document_page_category.xml',
|
"views/report_document_page.xml",
|
||||||
'views/document_page_history.xml',
|
|
||||||
'views/document_page_assets.xml',
|
|
||||||
'views/report_document_page.xml',
|
|
||||||
],
|
|
||||||
'demo': [
|
|
||||||
'demo/document_page.xml'
|
|
||||||
],
|
],
|
||||||
|
"demo": ["demo/document_page.xml"],
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
@ -9,49 +9,46 @@ class DocumentPage(models.Model):
|
|||||||
"""This class is use to manage Document."""
|
"""This class is use to manage Document."""
|
||||||
|
|
||||||
_name = "document.page"
|
_name = "document.page"
|
||||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
_inherit = ["mail.thread", "mail.activity.mixin"]
|
||||||
_description = "Document Page"
|
_description = "Document Page"
|
||||||
_order = 'name'
|
_parent_name = "parent_id"
|
||||||
|
_parent_store = True
|
||||||
|
_rec_name = "complete_name"
|
||||||
|
_order = "type, sequence, complete_name"
|
||||||
|
|
||||||
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',
|
"Type",
|
||||||
help="Page type",
|
help="Page type",
|
||||||
default="content"
|
default="content",
|
||||||
)
|
)
|
||||||
active = fields.Boolean(default=True)
|
active = fields.Boolean(default=True)
|
||||||
parent_id = fields.Many2one(
|
parent_id = fields.Many2one(
|
||||||
'document.page',
|
"document.page", "Category", domain=[("type", "=", "category")]
|
||||||
'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.Text(
|
||||||
"Content",
|
"Content",
|
||||||
compute='_compute_content',
|
compute="_compute_content",
|
||||||
inverse='_inverse_content',
|
inverse="_inverse_content",
|
||||||
search='_search_content',
|
search="_search_content",
|
||||||
required=True,
|
required=True,
|
||||||
copy=True,
|
copy=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# no-op computed field
|
# no-op computed field
|
||||||
draft_name = fields.Char(
|
draft_name = fields.Char(
|
||||||
string='Name',
|
string="Name",
|
||||||
help='Name for the changes made',
|
help="Name for the changes made",
|
||||||
compute=lambda x: x,
|
compute=lambda x: x,
|
||||||
inverse=lambda x: x,
|
inverse=lambda x: x,
|
||||||
)
|
)
|
||||||
|
|
||||||
# no-op computed field
|
# no-op computed field
|
||||||
draft_summary = fields.Char(
|
draft_summary = fields.Char(
|
||||||
string='Summary',
|
string="Summary",
|
||||||
help='Describe the changes made',
|
help="Describe the changes made",
|
||||||
compute=lambda x: x,
|
compute=lambda x: x,
|
||||||
inverse=lambda x: x,
|
inverse=lambda x: x,
|
||||||
)
|
)
|
||||||
@ -59,58 +56,88 @@ class DocumentPage(models.Model):
|
|||||||
template = fields.Html(
|
template = fields.Html(
|
||||||
"Template",
|
"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.",
|
||||||
)
|
)
|
||||||
history_head = fields.Many2one(
|
history_head = fields.Many2one(
|
||||||
'document.page.history',
|
"document.page.history",
|
||||||
'HEAD',
|
"HEAD",
|
||||||
compute='_compute_history_head',
|
compute="_compute_history_head",
|
||||||
store=True,
|
store=True,
|
||||||
auto_join=True,
|
auto_join=True,
|
||||||
)
|
)
|
||||||
history_ids = fields.One2many(
|
history_ids = fields.One2many(
|
||||||
'document.page.history',
|
"document.page.history",
|
||||||
'page_id',
|
"page_id",
|
||||||
'History',
|
"History",
|
||||||
order='create_date DESC',
|
order="create_date DESC",
|
||||||
readonly=True,
|
|
||||||
)
|
|
||||||
menu_id = fields.Many2one(
|
|
||||||
'ir.ui.menu',
|
|
||||||
"Menu",
|
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
|
menu_id = fields.Many2one("ir.ui.menu", "Menu", readonly=True,)
|
||||||
content_date = fields.Datetime(
|
content_date = fields.Datetime(
|
||||||
'Last Contribution Date',
|
"Last Contribution Date",
|
||||||
related='history_head.create_date',
|
related="history_head.create_date",
|
||||||
store=True,
|
store=True,
|
||||||
index=True,
|
index=True,
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
content_uid = fields.Many2one(
|
content_uid = fields.Many2one(
|
||||||
'res.users',
|
"res.users",
|
||||||
'Last Contributor',
|
"Last Contributor",
|
||||||
related='history_head.create_uid',
|
related="history_head.create_uid",
|
||||||
store=True,
|
store=True,
|
||||||
index=True,
|
index=True,
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
'res.company',
|
"res.company",
|
||||||
'Company',
|
"Company",
|
||||||
help='If set, page is accessible only from this company',
|
help="If set, page is accessible only from this company",
|
||||||
index=True,
|
index=True,
|
||||||
ondelete='cascade',
|
ondelete="cascade",
|
||||||
)
|
)
|
||||||
backend_url = fields.Char(
|
backend_url = fields.Char(
|
||||||
string='Backend URL',
|
string="Backend URL",
|
||||||
help='Use it to link resources univocally',
|
help="Use it to link resources univocally",
|
||||||
compute='_compute_backend_url',
|
compute="_compute_backend_url",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends('menu_id', 'parent_id.menu_id')
|
sequence = fields.Integer(
|
||||||
|
string="Sequence", default=10, help="Used to organise the category."
|
||||||
|
)
|
||||||
|
|
||||||
|
parent_path = fields.Char(index=True)
|
||||||
|
complete_name = fields.Char(
|
||||||
|
"Complete Name", compute="_compute_complete_name", store=True
|
||||||
|
)
|
||||||
|
|
||||||
|
image = fields.Binary("Image", attachment=True,)
|
||||||
|
|
||||||
|
color = fields.Integer(string="Color Index")
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def write(self, vals):
|
||||||
|
child_ids = self
|
||||||
|
if vals.get("color", False) and len(vals) == 1:
|
||||||
|
child_ids = self.search(
|
||||||
|
[("type", "=", "category"),
|
||||||
|
("parent_id", "child_of", self.ids)]
|
||||||
|
)
|
||||||
|
res = super(DocumentPage, child_ids).write(vals)
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.depends("name", "parent_id.complete_name")
|
||||||
|
def _compute_complete_name(self):
|
||||||
|
for category in self:
|
||||||
|
if category.parent_id:
|
||||||
|
category.complete_name = "{} / {}".format(
|
||||||
|
category.parent_id.complete_name, category.name,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
category.complete_name = category.name
|
||||||
|
|
||||||
|
@api.depends("menu_id", "parent_id.menu_id")
|
||||||
def _compute_backend_url(self):
|
def _compute_backend_url(self):
|
||||||
tmpl = '/web#id={}&model=document.page&view_type=form'
|
tmpl = "/web#id={}&model=document.page&view_type=form"
|
||||||
for rec in self:
|
for rec in self:
|
||||||
url = tmpl.format(rec.id)
|
url = tmpl.format(rec.id)
|
||||||
# retrieve action
|
# retrieve action
|
||||||
@ -120,13 +147,13 @@ class DocumentPage(models.Model):
|
|||||||
action = parent.menu_id.action
|
action = parent.menu_id.action
|
||||||
parent = parent.parent_id
|
parent = parent.parent_id
|
||||||
if action:
|
if action:
|
||||||
url += '&action={}'.format(action.id)
|
url += "&action={}".format(action.id)
|
||||||
rec.backend_url = url
|
rec.backend_url = url
|
||||||
|
|
||||||
@api.constrains('parent_id')
|
@api.constrains("parent_id")
|
||||||
def _check_parent_id(self):
|
def _check_parent_id(self):
|
||||||
if not self._check_recursion():
|
if not self._check_recursion():
|
||||||
raise ValidationError(_('You cannot create recursive categories.'))
|
raise ValidationError(_("You cannot create recursive categories."))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_page_index(self, link=True):
|
def _get_page_index(self, link=True):
|
||||||
@ -135,7 +162,7 @@ class DocumentPage(models.Model):
|
|||||||
index = []
|
index = []
|
||||||
for subpage in self.child_ids:
|
for subpage in self.child_ids:
|
||||||
index += ["<li>" + subpage._get_page_index() + "</li>"]
|
index += ["<li>" + subpage._get_page_index() + "</li>"]
|
||||||
r = ''
|
r = ""
|
||||||
if link:
|
if link:
|
||||||
r = '<a href="{}">{}</a>'.format(self.backend_url, self.name)
|
r = '<a href="{}">{}</a>'.format(self.backend_url, self.name)
|
||||||
if index:
|
if index:
|
||||||
@ -143,35 +170,37 @@ class DocumentPage(models.Model):
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('history_head')
|
@api.depends("history_head")
|
||||||
def _compute_content(self):
|
def _compute_content(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if rec.type == 'category':
|
if rec.type == "category":
|
||||||
rec.content = rec._get_page_index(link=False)
|
rec.content = rec._get_page_index(link=False)
|
||||||
else:
|
else:
|
||||||
if rec.history_head:
|
if rec.history_head:
|
||||||
rec.content = rec.history_head.content
|
rec.content = rec.history_head.content
|
||||||
else:
|
else:
|
||||||
# html widget's default, so it doesn't trigger ghost save
|
# html widget's default, so it doesn't trigger ghost save
|
||||||
rec.content = '<p><br></p>'
|
rec.content = "<p><br></p>"
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _inverse_content(self):
|
def _inverse_content(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if rec.type == 'content' and \
|
if rec.type == "content" \
|
||||||
rec.content != rec.history_head.content:
|
and rec.content != rec.history_head.content:
|
||||||
rec._create_history({
|
rec._create_history(
|
||||||
'name': rec.draft_name,
|
{
|
||||||
'summary': rec.draft_summary,
|
"name": rec.draft_name,
|
||||||
'content': rec.content,
|
"summary": rec.draft_summary,
|
||||||
})
|
"content": rec.content,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _search_content(self, operator, value):
|
def _search_content(self, operator, value):
|
||||||
return [('history_head.content', operator, value)]
|
return [("history_head.content", operator, value)]
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('history_ids')
|
@api.depends("history_ids")
|
||||||
def _compute_history_head(self):
|
def _compute_history_head(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if rec.history_ids:
|
if rec.history_ids:
|
||||||
@ -180,20 +209,20 @@ class DocumentPage(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def _create_history(self, vals):
|
def _create_history(self, vals):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
history = self.env['document.page.history']
|
history = self.env["document.page.history"]
|
||||||
vals['page_id'] = self.id
|
vals["page_id"] = self.id
|
||||||
return history.create(vals)
|
return history.create(vals)
|
||||||
|
|
||||||
@api.onchange("parent_id")
|
@api.onchange("parent_id")
|
||||||
def _onchange_parent_id(self):
|
def _onchange_parent_id(self):
|
||||||
"""We Set it the right content to the new parent."""
|
"""We Set it the right content to the new parent."""
|
||||||
if not self.content or self.content == '<p><br></p>':
|
if not self.content or self.content == "<p><br></p>":
|
||||||
if self.parent_id and self.parent_id.type == "category":
|
if self.parent_id and self.parent_id.type == "category":
|
||||||
self.content = self.parent_id.template
|
self.content = self.parent_id.template
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
menus = self.mapped('menu_id')
|
menus = self.mapped("menu_id")
|
||||||
res = super().unlink()
|
res = super().unlink()
|
||||||
menus.unlink()
|
menus.unlink()
|
||||||
return res
|
return res
|
||||||
|
@ -8,3 +8,5 @@
|
|||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
* Víctor Martínez
|
* Víctor Martínez
|
||||||
|
|
||||||
|
* Florent THOMAS <florent.thomas@mind-and-go.com>
|
||||||
|
28
document_page/static/src/js/document_page_kanban.js
Normal file
28
document_page/static/src/js/document_page_kanban.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
odoo.define("document_page.update_kanban", function(require) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var KanbanRecord = require("web.KanbanRecord");
|
||||||
|
|
||||||
|
KanbanRecord.include({
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
// Private
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_openRecord: function() {
|
||||||
|
if (
|
||||||
|
this.modelName === "document.page" &&
|
||||||
|
this.$(".o_document_page_kanban_boxes a").length
|
||||||
|
) {
|
||||||
|
this.$(".o_document_page_kanban_boxes a")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
} else {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
26
document_page/views/document_menus.xml
Normal file
26
document_page/views/document_menus.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<odoo>
|
||||||
|
<menuitem id="menu_main_wiki"
|
||||||
|
name="Wiki"
|
||||||
|
action="action_category_navigation"
|
||||||
|
parent="knowledge.menu_document_root"
|
||||||
|
sequence="1"/>
|
||||||
|
|
||||||
|
<menuitem id="menu_wiki"
|
||||||
|
name="Pages"
|
||||||
|
parent="knowledge.menu_document_root"
|
||||||
|
sequence="10"/>
|
||||||
|
|
||||||
|
<menuitem id="menu_page"
|
||||||
|
name="Pages"
|
||||||
|
parent="menu_wiki"
|
||||||
|
action="action_page"
|
||||||
|
sequence="20"/>
|
||||||
|
|
||||||
|
<menuitem id="menu_category"
|
||||||
|
parent="menu_wiki"
|
||||||
|
name="Categories"
|
||||||
|
action="action_category"
|
||||||
|
sequence="20" />
|
||||||
|
|
||||||
|
</odoo>
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- wiki tree view -->
|
<!-- wiki tree view -->
|
||||||
@ -9,9 +9,9 @@
|
|||||||
<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 string="Document Page">
|
||||||
<field name="name"/>
|
<field name="name" />
|
||||||
<field name="content_uid"/>
|
<field name="content_uid" />
|
||||||
<field name="content_date"/>
|
<field name="content_date" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@ -22,12 +22,12 @@
|
|||||||
<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 string="Document Page">
|
||||||
<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" />
|
||||||
<field name="create_uid" invisible="1"/>
|
<field name="create_uid" invisible="1" />
|
||||||
<field name="content_uid"/>
|
<field name="content_uid" />
|
||||||
<field name="content_date"/>
|
<field name="content_date" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@ -41,27 +41,27 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_button_box" name="button_box">
|
<div class="oe_button_box" name="button_box">
|
||||||
<button name="toggle_active" type="object" groups="document_page.group_document_manager" class="oe_stat_button" icon="fa-archive">
|
<button name="toggle_active" type="object" groups="document_page.group_document_manager" class="oe_stat_button" icon="fa-archive">
|
||||||
<field name="active" widget="boolean_button" options="{'terminology': 'archive'}"/>
|
<field name="active" widget="boolean_button" options="{'terminology': 'archive'}" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<field name="type" invisible="1"/>
|
<field name="type" invisible="1" />
|
||||||
<h1>
|
<h1>
|
||||||
<field name="name" placeholder="Name"/>
|
<field name="name" placeholder="Name" />
|
||||||
</h1>
|
</h1>
|
||||||
<group>
|
<group>
|
||||||
<div>
|
<div>
|
||||||
<field name="content" widget="html" placeholder="e.g. Once upon a time..." required="1" options="{'safe': True}"/>
|
<field name="content" widget="html" placeholder="e.g. Once upon a time..." required="1" options="{'safe': True}" />
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
<page name="info" string="Information">
|
<page name="info" string="Information">
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="parent_id" string="Category" required="True" context="{'default_type':'category'}"/>
|
<field name="parent_id" string="Category" required="True" context="{'default_type':'category'}" />
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company" />
|
||||||
<field name="content_uid"/>
|
<field name="content_uid" />
|
||||||
<field name="content_date"/>
|
<field name="content_date" />
|
||||||
<field name="menu_id" readonly="1" attrs="{'invisible': [('menu_id','=',False)]}"/>
|
<field name="menu_id" readonly="1" attrs="{'invisible': [('menu_id','=',False)]}" />
|
||||||
</group>
|
</group>
|
||||||
<group string="Revision" class="oe_edit_only">
|
<group string="Revision" class="oe_edit_only">
|
||||||
<field name="draft_name" placeholder="Rev 01" required="True" class="oe_edit_only" />
|
<field name="draft_name" placeholder="Rev 01" required="True" class="oe_edit_only" />
|
||||||
@ -72,20 +72,20 @@
|
|||||||
<page name="history" string="History">
|
<page name="history" string="History">
|
||||||
<field name="history_ids">
|
<field name="history_ids">
|
||||||
<tree>
|
<tree>
|
||||||
<field name="id"/>
|
<field name="id" />
|
||||||
<field name="create_date"/>
|
<field name="create_date" />
|
||||||
<field name="name"/>
|
<field name="name" />
|
||||||
<field name="summary"/>
|
<field name="summary" />
|
||||||
<field name="create_uid"/>
|
<field name="create_uid" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
<div class="oe_chatter">
|
<div class="oe_chatter">
|
||||||
<field name="message_follower_ids" widget="mail_followers"/>
|
<field name="message_follower_ids" widget="mail_followers" />
|
||||||
<field name="activity_ids" widget="mail_activity"/>
|
<field name="activity_ids" widget="mail_activity" />
|
||||||
<field name="message_ids" widget="mail_thread"/>
|
<field name="message_ids" widget="mail_thread" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
@ -96,11 +96,11 @@
|
|||||||
<field name="model">document.page</field>
|
<field name="model">document.page</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Document Page" create="0">
|
<form string="Document Page" create="0">
|
||||||
<field name="type" invisible="1"/>
|
<field name="type" invisible="1" />
|
||||||
<h1>
|
<h1>
|
||||||
<field name="name" placeholder="Name"/>
|
<field name="name" placeholder="Name" />
|
||||||
</h1>
|
</h1>
|
||||||
<field name="content" widget="html" class="oe_view_only" required="1" options='{"safe": True}'/>
|
<field name="content" widget="html" class="oe_view_only" required="1" options='{"safe": True}' />
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@ -111,15 +111,14 @@
|
|||||||
<field name="model">document.page</field>
|
<field name="model">document.page</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="Document Page">
|
<search string="Document Page">
|
||||||
<field name="name" string="Content"
|
<field name="name" string="Content" filter_domain="['|', ('name','ilike',self), ('content','ilike',self)]" />
|
||||||
filter_domain="['|', ('name','ilike',self), ('content','ilike',self)]"/>
|
<field name="parent_id" />
|
||||||
<field name="parent_id"/>
|
<field name="create_uid" />
|
||||||
<field name="create_uid"/>
|
<field name="content_uid" />
|
||||||
<field name="content_uid"/>
|
|
||||||
<group expand="0" string="Group By...">
|
<group expand="0" string="Group By...">
|
||||||
<filter name="group_by_category" string="Category" context="{'group_by':'parent_id'}"/>
|
<filter name="group_by_category" string="Category" context="{'group_by':'parent_id'}" />
|
||||||
<filter name="group_by_author" string="Author" context="{'group_by':'create_uid'}"/>
|
<filter name="group_by_author" string="Author" context="{'group_by':'create_uid'}" />
|
||||||
<filter name="group_by_last_contributor" string="Last Contributor" context="{'group_by':'content_uid'}"/>
|
<filter name="group_by_last_contributor" string="Last Contributor" context="{'group_by':'content_uid'}" />
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
@ -134,8 +133,8 @@
|
|||||||
<field name="context">{'default_type': 'content'}</field>
|
<field name="context">{'default_type': 'content'}</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="view_id" ref="view_wiki_tree"/>
|
<field name="view_id" ref="view_wiki_tree" />
|
||||||
<field name="search_view_id" ref="view_wiki_filter"/>
|
<field name="search_view_id" ref="view_wiki_filter" />
|
||||||
<field name="help" type="html">
|
<field name="help" type="html">
|
||||||
<p class="oe_view_nocontent_create">
|
<p class="oe_view_nocontent_create">
|
||||||
Click to create a new web page.
|
Click to create a new web page.
|
||||||
@ -144,40 +143,26 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_page_view_tree" model="ir.actions.act_window.view">
|
<record id="action_page_view_tree" model="ir.actions.act_window.view">
|
||||||
<field name="sequence" eval="0"/>
|
<field name="sequence" eval="0" />
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">tree</field>
|
||||||
<field name="view_id" ref="view_wiki_tree"/>
|
<field name="view_id" ref="view_wiki_tree" />
|
||||||
<field name="act_window_id" ref="action_page"/>
|
<field name="act_window_id" ref="action_page" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_page_view_form" model="ir.actions.act_window.view">
|
<record id="action_page_view_form" model="ir.actions.act_window.view">
|
||||||
<field name="sequence" eval="5"/>
|
<field name="sequence" eval="5" />
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
<field name="view_id" ref="view_wiki_form"/>
|
<field name="view_id" ref="view_wiki_form" />
|
||||||
<field name="act_window_id" ref="action_page"/>
|
<field name="act_window_id" ref="action_page" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<menuitem id="menu_wiki"
|
<menuitem id="menu_wiki" name="Pages" parent="knowledge.menu_document_root" sequence="10" />
|
||||||
name="Pages"
|
|
||||||
parent="knowledge.menu_document_root"
|
|
||||||
sequence="10"/>
|
|
||||||
|
|
||||||
|
|
||||||
<menuitem id="menu_page"
|
<menuitem id="menu_page" name="Pages" parent="menu_wiki" action="action_page" sequence="20" />
|
||||||
name="Pages"
|
|
||||||
parent="menu_wiki"
|
|
||||||
action="action_page"
|
|
||||||
sequence="20"/>
|
|
||||||
|
|
||||||
|
|
||||||
<act_window
|
<act_window id="action_related_page_create_menu" name="Create Menu" res_model="document.page.create.menu" target="new" view_type="form" view_mode="form" src_model="document.page" />
|
||||||
id="action_related_page_create_menu"
|
|
||||||
name="Create Menu"
|
|
||||||
res_model="document.page.create.menu"
|
|
||||||
target="new"
|
|
||||||
view_type="form"
|
|
||||||
view_mode="form"
|
|
||||||
src_model="document.page"/>
|
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
@ -1,9 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="assets_backend" name="document_page assets" inherit_id="web.assets_backend">
|
<template
|
||||||
|
id="assets_backend"
|
||||||
|
name="document_page assets"
|
||||||
|
inherit_id="web.assets_backend"
|
||||||
|
>
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<link rel="stylesheet" href="/document_page/static/src/css/document_page.css"/>
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="/document_page/static/src/css/document_page.css"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/document_page/static/src/js/document_page_kanban.js"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- Category Views -->
|
<!-- Category Views -->
|
||||||
@ -8,16 +8,21 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Category">
|
<form string="Category">
|
||||||
<sheet>
|
<sheet>
|
||||||
<field name="type" invisible="1"/>
|
<field name="type" invisible="1" />
|
||||||
<h1><field name="name" placeholder="Name"/></h1>
|
<field name="image" widget="image" class="oe_avatar" />
|
||||||
|
<div class="oe_title">
|
||||||
|
<h1>
|
||||||
|
<field name="name" placeholder="Name" />
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="parent_id" string="Category" context="{'default_type':'category'}"/>
|
<field name="parent_id" string="Category" context="{'default_type':'category'}" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="write_uid" groups="base.group_no_one"/>
|
<field name="write_uid" groups="base.group_no_one" />
|
||||||
<field name="write_date" groups="base.group_no_one"/>
|
<field name="write_date" groups="base.group_no_one" />
|
||||||
<field name="menu_id" groups="base.group_no_one"/>
|
<field name="menu_id" groups="base.group_no_one" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
@ -25,29 +30,147 @@
|
|||||||
<field name="template" placeholder="e.g. Once upon a time..." />
|
<field name="template" placeholder="e.g. Once upon a time..." />
|
||||||
</page>
|
</page>
|
||||||
<page string="Documents" name="documents">
|
<page string="Documents" name="documents">
|
||||||
<field name="content" widget="html" class="oe_view_only" options='{"safe": True}' />
|
<field name="content" widget="html" class="oe_view_only" options="{'safe': True}" />
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
<div class="oe_chatter">
|
<div class="oe_chatter">
|
||||||
<field name="message_follower_ids" widget="mail_followers"/>
|
<field name="message_follower_ids" widget="mail_followers" />
|
||||||
<field name="activity_ids" widget="mail_activity"/>
|
<field name="activity_ids" widget="mail_activity" />
|
||||||
<field name="message_ids" widget="mail_thread"/>
|
<field name="message_ids" widget="mail_thread" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="view_browse_top_document_filter" model="ir.ui.view">
|
||||||
|
<field name="name">document.page.category.search</field>
|
||||||
|
<field name="model">document.page</field>
|
||||||
|
<field name="inherit_id" ref="view_wiki_filter" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="content_uid" position="after">
|
||||||
|
<separator />
|
||||||
|
<filter string="Top Level Ressources" name="no_parent_id" domain="[('parent_id', '=', False)]" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_browse_top_content" model="ir.actions.act_window">
|
||||||
|
<field name="name">Browse Wiki Content</field>
|
||||||
|
<field name="res_model">document.page</field>
|
||||||
|
<field name="domain">[]</field>
|
||||||
|
<field name="context">{'default_type': 'content', 'search_default_no_parent_id':1, }</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">kanban,tree,form</field>
|
||||||
|
<field name="search_view_id" ref="view_browse_top_document_filter" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_browse_all_content" model="ir.actions.act_window">
|
||||||
|
<field name="name">Browse Wiki Content</field>
|
||||||
|
<field name="res_model">document.page</field>
|
||||||
|
<field name="domain">[]</field>
|
||||||
|
<field name="context">{'default_type': 'content', 'search_default_parent_id': [active_id] }</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">kanban,tree,form</field>
|
||||||
|
<field name="search_view_id" ref="view_wiki_filter" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_browse_content_kanban" model="ir.ui.view">
|
||||||
|
<field name="name">document.page.browse.kanban</field>
|
||||||
|
<field name="model">document.page</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<kanban>
|
||||||
|
<field name="id" />
|
||||||
|
<field name="name" />
|
||||||
|
<field name="display_name" />
|
||||||
|
<field name="create_uid" />
|
||||||
|
<field name="write_date" />
|
||||||
|
<field name="parent_id" />
|
||||||
|
<field name="content_uid" />
|
||||||
|
<field name="image" />
|
||||||
|
<field name="type" />
|
||||||
|
<field name="color" />
|
||||||
|
<templates>
|
||||||
|
<t t-name="kanban-box">
|
||||||
|
<div t-att-class="'oe_kanban_global_area' + ' oe_kanban_color_'+ (kanban_getcolor(record.color.raw_value)) + ' oe_kanban_global_click' ">
|
||||||
|
<div class="o_kanban_image">
|
||||||
|
<div class="o_kanban_image_wrapper">
|
||||||
|
<t t-if="record.type.raw_value == 'category'">
|
||||||
|
<img class="o_kanban_image" t-if="record.image.raw_value" t-att-src="kanban_image('document.page', 'image', record.id.raw_value)" t-att-alt="record.display_name" />
|
||||||
|
<span style="font-size: 64px; color: lightslategray">
|
||||||
|
<i t-if="!record.image.raw_value" class="o_kanban_image fa fa-folder-open" />
|
||||||
|
</span>
|
||||||
|
</t>
|
||||||
|
<t t-if="record.type.raw_value == 'content'">
|
||||||
|
<span style="font-size: 64px; color: lightgray">
|
||||||
|
<i class="o_kanban_image fa fa-file" />
|
||||||
|
</span>
|
||||||
|
</t>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="o_kanban_details">
|
||||||
|
<div class="o_kanban_details_wrapper">
|
||||||
|
<div class="o_kanban_record_top">
|
||||||
|
<div class="o_kanban_record_title o_text_overflow">
|
||||||
|
<strong>
|
||||||
|
<field name="name" />
|
||||||
|
</strong>
|
||||||
|
<br />
|
||||||
|
<small t-if="record.parent_id.raw_value">
|
||||||
|
<img t-att-src="kanban_image('document.page', 'image', record.parent_id.raw_value)" t-att-alt="record.parent_id.display_name" width="24" height="24" />
|
||||||
|
<field name="parent_id" />
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="o_dropdown_kanban dropdown" groups="base.group_user">
|
||||||
|
<a role="button" class="dropdown-toggle o-no-caret btn" data-toggle="dropdown" data-display="static" href="#" aria-label="Dropdown menu" title="Dropdown menu">
|
||||||
|
<span class="fa fa-ellipsis-v" />
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu" role="menu">
|
||||||
|
<ul class="oe_kanban_colorpicker" data-field="color" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="o_kanban_record_body">
|
||||||
|
<div class="o_kanban_tags_section">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="o_kanban_record_bottom" t-if="record.type.raw_value == 'content'">
|
||||||
|
<div class="oe_kanban_bottom_left">
|
||||||
|
<field name="write_date" widget="date" />
|
||||||
|
</div>
|
||||||
|
<div class="oe_kanban_bottom_right">
|
||||||
|
<img t-att-src="kanban_image('res.users', 'image_small', record.content_uid.raw_value)" t-att-title="record.content_uid.value" t-att-alt="record.content_uid.value" width="24" height="24" class="oe_kanban_avatar" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div t-if="record.type.raw_value == 'category'" class="o_document_page_kanban_boxes">
|
||||||
|
<a class="o_document_page_kanban_box" name="%(action_browse_all_content)d" type="action">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
|
</kanban>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<record id="view_category_tree" model="ir.ui.view">
|
<record id="view_category_tree" model="ir.ui.view">
|
||||||
<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 string="Categories">
|
||||||
<field name="name"/>
|
<field name="sequence" widget="handle" />
|
||||||
<field name="parent_id"/>
|
<field name="name" />
|
||||||
<field name="create_uid" invisible="1"/>
|
|
||||||
<field name="write_uid"/>
|
|
||||||
<field name="write_date"/>
|
<field name="parent_id" />
|
||||||
|
<field name="create_uid" invisible="1" />
|
||||||
|
<field name="write_uid" />
|
||||||
|
<field name="write_date" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@ -57,20 +180,21 @@
|
|||||||
<field name="model">document.page</field>
|
<field name="model">document.page</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="Document Category">
|
<search string="Document Category">
|
||||||
<field name="name" string="Content"
|
<field name="name" string="Content" filter_domain="['|', ('name','ilike',self), ('template','ilike',self)]" />
|
||||||
filter_domain="['|', ('name','ilike',self), ('template','ilike',self)]"/>
|
<field name="parent_id" />
|
||||||
<field name="parent_id"/>
|
<field name="create_uid" />
|
||||||
<field name="create_uid"/>
|
<field name="content_uid" />
|
||||||
<field name="content_uid"/>
|
|
||||||
<group expand="0" string="Group By...">
|
<group expand="0" string="Group By...">
|
||||||
<filter name="group_by_category" string="Category" context="{'group_by':'parent_id'}"/>
|
<filter name="group_by_category" string="Category" context="{'group_by':'parent_id'}" />
|
||||||
<filter name="group_by_author" string="Author" context="{'group_by':'create_uid'}"/>
|
<filter name="group_by_author" string="Author" context="{'group_by':'create_uid'}" />
|
||||||
<filter name="group_by_last_contributor" string="Last Contributor" context="{'group_by':'content_uid'}"/>
|
<filter name="group_by_last_contributor" string="Last Contributor" context="{'group_by':'content_uid'}" />
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Category Action -->
|
<!-- Category Action -->
|
||||||
<record id="action_category" model="ir.actions.act_window">
|
<record id="action_category" model="ir.actions.act_window">
|
||||||
<field name="name">Category</field>
|
<field name="name">Category</field>
|
||||||
@ -79,29 +203,26 @@
|
|||||||
<field name="context">{'default_type': 'category'}</field>
|
<field name="context">{'default_type': 'category'}</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="view_id" ref="view_category_tree"/>
|
<field name="view_id" ref="view_category_tree" />
|
||||||
<field name="search_view_id" ref="view_document_category_filter"/>
|
<field name="search_view_id" ref="view_document_category_filter" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_category_view_tree" model="ir.actions.act_window.view">
|
<record id="action_category_view_tree" model="ir.actions.act_window.view">
|
||||||
<field name="sequence" eval="0" />
|
<field name="sequence" eval="0" />
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">tree</field>
|
||||||
<field name="view_id" ref="view_category_tree"/>
|
<field name="view_id" ref="view_category_tree" />
|
||||||
<field name="act_window_id" ref="action_category"/>
|
<field name="act_window_id" ref="action_category" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_category_view_form" model="ir.actions.act_window.view">
|
<record id="action_category_view_form" model="ir.actions.act_window.view">
|
||||||
<field name="sequence" eval="5" />
|
<field name="sequence" eval="5" />
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
<field name="view_id" ref="view_category_form"/>
|
<field name="view_id" ref="view_category_form" />
|
||||||
<field name="act_window_id" ref="action_category"/>
|
<field name="act_window_id" ref="action_category" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem id="menu_category"
|
<menuitem id="menu_category" parent="menu_wiki" name="Categories" action="action_category" sequence="20" />
|
||||||
parent="menu_wiki"
|
|
||||||
name="Categories"
|
|
||||||
action="action_category"
|
|
||||||
sequence="20"/>
|
|
||||||
|
|
||||||
|
<menuitem id="menu_browse_content" parent="knowledge.menu_document_root" name="Browse Wiki Content" action="action_browse_top_content" sequence="5" />
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
Loading…
Reference in New Issue
Block a user