How to avoid showing fields in a customized form in OpenERP7?



I am using OpenERP7, and I have created a field in a form. This field is the next one:



'history': fields.function(_get_history, type='many2many',
obj="res.partner.link.category",
method=True, string='Categories'),


Then, I show it in the form. As the field is a many2many, it is shown as a tree, which I specify below.



<group string="Activity Summary">
<field name="history" nolabel="1" attrs="{'readonly': 1}">
<tree string="Categories">
<field name="active_category" attrs="{'readonly': 1}"/>
<field name="link_category_id" attrs="{'readonly': 1}"/>
<field name="type" attrs="{'readonly': 1}"/>
<field name="date" attrs="{'readonly': 1}"/>
<field name="observations"/>
<button name="open_history" type="object" string="View history" icon="terp-calendar"/>
</tree>
</field>
</group>


Everything is OK, but, if I click on one of the records, it is opened as a form in a popup, and it is showing some fields which I do not want. For example, the objects of "res.partner.link.category" have the attribute partner_id, which I do not want to be shown. So I did not write it inside the tree (which is working great), but I did the same for the form and this one is showing every attributes of "res.partner.link.category". Here the code after the modifications I did to show the form as I want:



<group string="Activity Summary">
<field name="history" nolabel="1" attrs="{'readonly': 1}">
<tree string="Categories">
<field name="active_category" attrs="{'readonly': 1}"/>
<field name="link_category_id" attrs="{'readonly': 1}"/>
<field name="type" attrs="{'readonly': 1}"/>
<field name="date" attrs="{'readonly': 1}"/>
<field name="observations"/>
<button name="open_history" type="object" string="View history" icon="terp-calendar"/>
</tree>
<form string="Categories" version="7.0">
<sheet>
<group col="4">
<field name="active_category"/>
<field name="link_category_id" options="{'no_open': True}"/>
<field name="type"/>
<field name="partner_id" attrs="{'invisible': True}"/>
</group>
<group col="4">
<field name="date"/>
<field name="observations"/>
</group>
</sheet>
</form>
</field>
</group>


What am I doing wrong? Is there any way to fix it?


No comments:

Post a Comment