mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-22 03:56:56 -06:00
Add useful filters and menus
Filter on "real"/user documents (no odoo assets), filter on res_model, filter on indexed content.
This commit is contained in:
parent
3bf43cca72
commit
ec3ab11991
@ -2,4 +2,5 @@
|
|||||||
# Copyright 2016 MONK Software
|
# Copyright 2016 MONK Software
|
||||||
# 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 . import ir_attachment
|
||||||
from . import res_config
|
from . import res_config
|
||||||
|
8
knowledge/models/ir_attachment.py
Normal file
8
knowledge/models/ir_attachment.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class IrAttachment(models.Model):
|
||||||
|
_inherit = 'ir.attachment'
|
||||||
|
|
||||||
|
# Add index to res_model because filtering on it is a common use case
|
||||||
|
res_model = fields.Char(index=True)
|
@ -1,16 +1,53 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
|
<record id="knowledge_action_documents" model="ir.actions.act_window">
|
||||||
|
<field name="name">Documents</field>
|
||||||
|
<field name="res_model">ir.attachment</field>
|
||||||
|
<field name="view_mode">kanban,tree,form</field>
|
||||||
|
<field name="context">{'search_default_user_documents': True}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="ir_attachment_view_user_documents" model="ir.ui.view">
|
||||||
|
<field name="name">Documents search view: additional filters</field>
|
||||||
|
<field name="model">ir.attachment</field>
|
||||||
|
<field name="inherit_id" ref="base.view_attachment_search"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search>
|
||||||
|
<field name="res_model"/>
|
||||||
|
<field name="index_content"/>
|
||||||
|
<filter name="user_documents" string="Documents"
|
||||||
|
domain="[('res_model', 'not like', 'ir.%'), ('res_model', '!=', False)]"/>
|
||||||
|
<group string="Group by">
|
||||||
|
<filter name="group_model" string="Model" context="{'group_by': 'res_model'}"/>
|
||||||
|
</group>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- Top menu item -->
|
<!-- Top menu item -->
|
||||||
<menuitem name="Knowledge"
|
<menuitem
|
||||||
id="knowledge.menu_document"
|
id="menu_document_root"
|
||||||
groups="base.group_system,base.group_document_user"
|
name="Knowledge"
|
||||||
sequence="116"/>
|
groups="base.group_system,base.group_document_user"
|
||||||
|
sequence="116"/>
|
||||||
|
|
||||||
<menuitem name="Configuration" id="knowledge.menu_document_configuration"
|
<menuitem
|
||||||
parent="knowledge.menu_document" sequence="50"/>
|
id="menu_document_configuration"
|
||||||
|
name="Configuration"
|
||||||
|
parent="menu_document_root"
|
||||||
|
sequence="50"/>
|
||||||
|
|
||||||
<menuitem name="Collaborative Content" id="knowledge.menu_document2"
|
<menuitem
|
||||||
parent="knowledge.menu_document"/>
|
id="menu_document_section"
|
||||||
|
name="Documents"
|
||||||
|
parent="menu_document_root"/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
id="menu_document"
|
||||||
|
name="Documents"
|
||||||
|
action="knowledge_action_documents"
|
||||||
|
parent="menu_document_section"/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
Loading…
Reference in New Issue
Block a user