Hello! i try to import a field from the product module to my module, but when i try it, it appears all the product data and not just the field i want, here is the code of the .py file:
class student(osv.osv):
_name = 'student'
_rec_name = 'default_code'
_columns = {
'name': fields.char('name',size=30,required=True, help='the name'),
'first_name': fields.char('first name',size=30,required=True, help='the first name'),
'birth_date': fields.date('birth date',size=30,required=True, help='the birth date'),
'email': fields.char('email', help='the email'),
'phone': fields.integer('phone',size=30, help='the phone'),
'sexo': fields.selection([('m','Masculino'),('f','Femenino')],'Sexo',help="Opcion sexual"),
'product': fields.many2one('product.product','cantidad', help='the Specialty'),}
student()
And my view:
<record model="ir.ui.view" id="view_student_form">
<field name="name">student.form</field>
<field name="model">student</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="student">
<group col="1" colspan="2">
<field name='image_medium' widget='image' />
</group>
<group col="2" colspan="2">
<field name="name" select="1"/>
<field name="first_name" select="2"/>
<field name="phone" />
</group>
<group col="2" colspan="2">
<field name="birth_date" select="0"/>
<field name="email" select="0"/>
<field name='sexo'/>
</group>
<notebook colspan="4">
<page string="stock">
<field name="product" select="0" widget='many2one_list'/>
</page>
</notebook>
And this is how it appears: http://drasticelanik.comoj.com/product.jpg
it appears the name field and not the default_code field.
I'm doing something wrong?
In the student table you define _rec_name = 'default_code' its wrong. to Inherit product.product table and define _rec_name or using override name_get method in the product.product class and display the default_code.