İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
17558 Görünümler

Hi,

I followed few videos like https://www.youtube.com/watch?v=tc-QlBYjjkM and went through similar posts but i could not get new field displayed on product page; despite i can do same with any other screens like sales order, invoice etc.

steps:

1. I added one column in DB x_test using settings -> database structure -> models -> product.template -> edit -> add field

2. edited product_template.py and added

x_test = fields.Char("test Name")

3. edit product_template_views.xml and add below at end

<record id="view_product_form_inherit" model="ir.ui.view">

            <field name="name">product.template.product.form.inherit</field>

         <field name="model">product.template</field>

         <field name="inherit_id" ref="product.product_template_form_view"/>

         <field name="arch" type="xml">

             <field name="default_code" position="after">

                     <field name="color"/>

             </field>

         </field>s

     </record>


4. I tried with some existing fields in template table like color to display on product page but no success.


any help..

Avatar
Vazgeç

have you restarted odoo service and upgraded the module containing xml code edits?

Üretici

yes, many times. will do once more.

En İyi Yanıt

<record id="view_product_form_inherit" model="ir.ui.view">
<field name="name">product.template.common.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='General Information']/group" position="before">
<group col="2" colspan="2" >
<field name="color"/>
</group>
</xpath>

</field>
</record>

Avatar
Vazgeç

That xpath is quite likely to break plus you're using a page title in @name instead of the actual name of the page.

İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Haz 23
2226
1
Haz 23
2657
2
Haz 23
2184
0
Nis 21
1541
4
Eki 20
6644