[IMP] improved form view for posts

bzr revid: fp@tinyerp.com-20140421213850-19gk3hfz8qxa6fw3
This commit is contained in:
Fabien Pinckaers 2014-04-21 23:38:50 +02:00
parent 261204c98d
commit c1b9748947
3 changed files with 38 additions and 10 deletions

View File

@ -58,19 +58,31 @@
<field name="arch" type="xml">
<form string="Forum Post" version="7.0">
<sheet>
<h1><field name="name" placeholder="Name"/></h1>
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="Name"/>
</h1>
<group>
<field name="tag_ids" widget="many2many_tags"/>
<field name="forum_id"/>
<field name="parent_id"/>
<field name="content" placeholder="e.g. Once upon a time..." widget="html"/>
<group>
<field name="create_date"/>
<field name="forum_id"/>
<field name="parent_id"/>
</group><group>
<field name="tag_ids" widget="many2many_tags"/>
<field name="state"/>
<field name="closed_reason_id"/>
<field name="closed_uid"/>
<field name="closed_date"/>
</group><group>
<field name="create_uid"/>
</group>
<group>
<field name="create_date"/>
<field name="write_uid"/>
<field name="write_date"/>
</group><group>
<field name="is_correct"/>
<field name="views"/>
<field name="vote_count"/>
<field name="favourite_count"/>
<field name="child_count"/>
</group>
</group>
</sheet>

View File

@ -33,7 +33,7 @@ class Documentation(osv.Model):
'display_name': fields.function(_name_get_fnc, type="char", string='Full Name'),
'name': fields.char('Name', required=True, translate=True),
'introduction': fields.html('Introduction', translate=True),
'parent_id': fields.many2one('forum.documentation.toc', 'Parent Table Of Content'),
'parent_id': fields.many2one('forum.documentation.toc', 'Parent Table Of Content', ondelete='cascade'),
'child_ids': fields.one2many('forum.documentation.toc', 'parent_id', 'Children Table Of Content'),
'parent_left': fields.integer('Left Parent', select=True),
'parent_right': fields.integer('Right Parent', select=True),
@ -59,7 +59,7 @@ class DocumentationStage(osv.Model):
class Post(osv.Model):
_inherit = 'forum.post'
_columns = {
'documentation_toc_id': fields.many2one('forum.documentation.toc', 'Documentation ToC'),
'documentation_toc_id': fields.many2one('forum.documentation.toc', 'Documentation ToC', ondelete='set null'),
'documentation_stage_id': fields.many2one('forum.documentation.stage', 'Documentation Stage'),
'color': fields.integer('Color Index')
}

View File

@ -94,6 +94,22 @@
parent="website_forum.menu_website_forum" name="Documentation Posts"
action="action_forum_doc_post" sequence="25"/>
<record id="view_forum_post_doc_form" model="ir.ui.view">
<field name="name">forum.post.form.doc</field>
<field name="model">forum.post</field>
<field name="inherit_id" ref="website_forum.view_forum_post_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='parent_id']" position="after">
<field name="documentation_toc_id"/>
</xpath>
<xpath expr="//sheet" position="before">
<header>
<field name="documentation_stage_id" widget="statusbar"/>
</header>
</xpath>
</field>
</record>
</data>