[ADD]fields on category for oragnaising

[IMP]Image on category
This commit is contained in:
Florent THOMAS 2021-12-23 15:36:37 +01:00
parent fc67a92d48
commit a269eb40e4
2 changed files with 110 additions and 95 deletions

View File

@ -117,10 +117,15 @@ class DocumentPage(models.Model):
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,
)
@api.depends('name', 'parent_id.complete_name')
def _compute_complete_name(self):

View File

@ -9,10 +9,16 @@
<form string="Category">
<sheet>
<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>
<field name="parent_id" string="Category" context="{'default_type':'category'}"/>
<field name="parent_id" string="Category"
context="{'default_type':'category'}" />
</group>
<group>
<field name="write_uid" groups="base.group_no_one" />
@ -22,10 +28,12 @@
</group>
<notebook>
<page string="Template" name="template">
<field name="template" placeholder="e.g. Once upon a time..." />
<field name="template"
placeholder="e.g. Once upon a time..." />
</page>
<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>
</notebook>
</sheet>
@ -63,9 +71,12 @@
<field name="create_uid" />
<field name="content_uid" />
<group expand="0" string="Group By...">
<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_last_contributor" string="Last Contributor" context="{'group_by':'content_uid'}"/>
<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_last_contributor"
string="Last Contributor" context="{'group_by':'content_uid'}" />
</group>
</search>
</field>
@ -83,25 +94,24 @@
<field name="search_view_id" ref="view_document_category_filter" />
</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="view_mode">tree</field>
<field name="view_id" ref="view_category_tree" />
<field name="act_window_id" ref="action_category" />
</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="view_mode">form</field>
<field name="view_id" ref="view_category_form" />
<field name="act_window_id" ref="action_category" />
</record>
<menuitem id="menu_category"
parent="menu_wiki"
name="Categories"
action="action_category"
sequence="20"/>
<menuitem id="menu_category" parent="menu_wiki"
name="Categories" action="action_category" sequence="20" />
</odoo>