Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3822 มุมมอง

want to inherit and add a custom field brand_id in Products notebook page 'general_information', after field Cost (standard_price). 

1) it is not showing custom field brand_id (Many2many) before going in Edit mode. it is showing only in Edit mode or Create new... (please check both screenshots below) 

AND

2) it is not appearing below Cost (standard_price) column ALSO String/Label not appear

what i am doing wrong or missing? please help

view code here: 
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <record id="view_products_form_brands_inherit" model="ir.ui.view">
        <field name="name">products.template.brands</field>
        <field name="model">product.template</field>
        <field name="type">form</field>
        <field name="inherit_id" ref="product.product_template_only_form_view"/>
        <field name="arch" type="xml">
                <xpath expr="//page[@name='general_information']//field[@name='standard_price']" position="after">
                        <field name="brand_id" string="Brand" widget="many2many_tags"/>
                </xpath>
        </field>
    </record>
</odoo>


In Edit mode:

regards
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Your field is not showing a label because the standard_price field is added inside the div tag. You should place your field after the div tag.

Try the following code:

<div name="standard_price_uom" position="after">
<field name="brand_id" string="Brand" widget="many2many_tags"/>
</div>



อวตาร
ละทิ้ง
ผู้เขียน

thanks @Sudhir Arya for help, it works fine... :)

คำตอบที่ดีที่สุด
Try this
<xpath expr="//page[@name='general_information']//div[@name='standard_price_uom']" position="after">
      <label for="brand_id"/>
      <field name="brand_id" string="Brand" widget="many2many_tags"/>
</xpath>
อวตาร
ละทิ้ง
ผู้เขียน

thanks @Akshay Babu, didn't worked as required.

Related Posts ตอบกลับ มุมมอง กิจกรรม
How to get Many2many records ids แก้ไขแล้ว
1
มิ.ย. 22
5449
1
ก.ย. 23
1723
1
ธ.ค. 22
3258
0
ต.ค. 21
2828
2
มี.ค. 21
4627