Hi,
I'm trying to solve this problem without succes.
I'm trying to create a custom wiev form that only shows name and category in the form view of a new module.
Here the classes:
from osv import osv, fields
class product_product2(osv.osv):
_name = 'product.product2'
_inherit = 'product.product'
_columns = {
'melody_ids': fields.many2many('vr.melody','product_vr_melody_rel','product_id','melody_id','Melodies'),
}
product_product2()
class vr_melody (osv.osv):
_name = 'vr.melody'
_columns = {
'name': fields.char('Melody',size=30,required=True),
'author': fields.char('Melodist',size=30,required=True),
'year': fields.char('Year',size=30,required=True),
'product_id':fields.many2many('product.product2','product_vr_melody_rel','melody_id','product_id','Products'),
}
vr_melody()
And here the views:
<?xml version="1.0"?>
<openerp>
<data>
</record>
<record model="ir.ui.view" id="view_vr_melody_tree">
<field name="name">Video Rental Melodies Tree</field>
<field name="model">vr.melody</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Melodies Tree">
<field name="name" select="1"/>
<field name="year" select="1"/>
<field name="author"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_vr_melody_form">
<field name="name">Video Rental Melodies Form</field>
<field name="model">vr.melody</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Melodies Form">
<field name="name"/>
<field name="year"/>
<field name="author"/>
<field name="product_id"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_vr_melodies">
<field name="name">Melodies</field>
<field name="res_model">vr.melody</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Melodies" id="menu_vr_melodies" action="action_vr_melodies" parent="video_rental_GonzalezLozano.menu_vr_configuration"/>
</data>
</openerp>
Now product_id doesn't show any data. If I delete _name = 'product.product2' and name the class like product.product, then product_id shows all the same data that are showed on product view form.
I need that my product view form shows only name and category.
Any help?
Thank you,
Views in Odoo: https://goo.gl/pZpTVu