コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
2011 ビュー

hello,,


i add new field to product.product model python

i want to Add it in product view form xml 

put i dont find view form for model product.product 

how can i add it 

アバター
破棄
最善の回答

Here’s the corrected and clarified XML code for adding a new field using an xpath expression while inheriting from product.product_normal_form_view:

<odoo>

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

        <field name="name">product.product.form.custom</field>

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

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

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

            <!-- Add the new field after the 'existing_field' field  -->

            <xpath expr="//field[@name='existing_field']" position="after">

                <field name="new_field_name"/>

            </xpath>

        </field>

    </record>

</odoo>


Regards,

Jishna

Accurates


アバター
破棄
著作者 最善の回答

thank you i use this code but it not add any thing and no errors ???

アバター
破棄
最善の回答

The product.product model shares most views with product.template, but has its own specific form view product.product_normal_form_view. Here's how to inherit it:

<odoo>

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

        <field name="name">product.product.form.custom</field>

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

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

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

            <!-- Add your custom fields/modifications here -->

            

        </field>

    </record>

</odoo>

アバター
破棄
関連投稿 返信 ビュー 活動
1
5月 21
6734
0
4月 20
3552
1
8月 19
6230
1
10月 16
6427
5
8月 16
5661