تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
2023 أدوات العرض

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
مايو 21
6741
0
أبريل 20
3554
1
أغسطس 19
6246
1
أكتوبر 16
6433
5
أغسطس 16
5663