Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

i create a object inherit from product.product,but the field not shows in the view

By
figol New
on 5/20/13, 7:59 AM 3,602 views

what i want to do is add a column to product.product table so i create a new object inheriting from product.product , and i also create a new view inheriting from product.product_normal_form_view but the field i have added to product.product not showing in the form view. i can see the itemid field in product_product table. it is so strange , anyone can help me?? many thanks.

here is the code my_product.py

# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
from datetime import datetime 

class ebayerp_product(osv.osv):
    _name = 'product.product'
    _inherit = "product.product"
    _columns = {
        'itemid' : fields.char('eBay ItemID', size=32, readonly=True, invisible=False),
        }
ebayerp_product()

my_product_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="product_normal_form_view" model="ir.ui.view">
            <field name="name">product.normal.form.inherit1</field>
            <field name="model">product.product</field>
            <field name="type">form</field>
            <field name="priority" eval="1"/>
            <field name="inherit_id" ref="product.product_normal_form_view"/>
            <field name="arch" type="xml">
                 <sheet position="inside">
                    <label for="ebayitemid"/>
                    <div name="ean">
                        <field name="itemid"/>
                    </div>
                 </sheet>
            </field>
       </record>
    </data>
</openerp>

product_normal_form_view form view (not all code, because not neccessary)

<record id="product_normal_form_view" model="ir.ui.view">
            <field name="name">product.normal.form</field>
            <field name="model">product.product</field>
            <field eval="7" name="priority"/>
            <field name="arch" type="xml">
                <form string="Product" version="7.0">
                    <sheet>
                        <field name="image_medium" widget="image" class="oe_avatar oe_left"/>
                        <div class="oe_title">
                            <div class="oe_edit_only">
                                <label for="name" string="Product Name"/>
                            </div>
                            <h1>
                                <field name="name"/>
                            </h1>
                            <label for="categ_id" class="oe_edit_only"/>
                            <h2><field name="categ_id"/></h2>
                            <div name="options" groups="base.group_user">
                                <field name="sale_ok"/>
                                <label for="sale_ok"/>
                            </div>
                        </div>
                        <div class="oe_right oe_button_box" name="buttons">
                        </div>

Hi , can you put all your codes so I can test and correct the error so the problem will solved quickly

Maath
on 5/20/13, 8:26 AM

ok , i will post the code soon.

figol New
on 5/21/13, 12:32 AM

the problem has been resolved . delete 'readonly=True' will be ok

figol New
on 5/21/13, 5:00 AM

Ok @figol New .... if there is no problem can you send me all codes

Maath
on 5/21/13, 6:40 AM
7

Sandeep

--Sandeep--
6083
| 6 5 8
Delhi, India
--Sandeep--
Python OpenERP Developer http://in.linkedin.com/pub/sandeep-rana/3b/a16/786/
Sandeep
On 5/20/13, 8:19 AM

Hi you define wrong field name in your view

 <field name="ebayitemid"/>

replace it with

 <field name="itemid"/>

and plz be remember you should use same whither same class name (product_product) or place a new field in class label _table=product_product other wise this field will not be added in the product table

Thanks Sandeep

I have changed ,but there is no luck

figol New
on 5/21/13, 12:26 AM
0

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/20/13, 8:05 AM

Hi,

replace <field name="ebayitemid"/> to <field name="itemid"/> in form and view.

i have changed it , but there is no luck

figol New
on 5/21/13, 12:39 AM
0

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 5/20/13, 8:24 AM

Hello,

your field is wrong

<field name="ebayitemid"/>

to replace it <field name="itemid"/>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/20/13, 7:59 AM
Seen: 3602 times
Last updated: 3/16/15, 8:10 AM