跳至內容
選單
此問題已被標幟
1 回覆
4211 瀏覽次數

I added a field in move_lines(stock.picking) using xpath expression.

python

class StockMove(models.Model):

    _inherit = "stock.move"

   serial_no = fields.Char(string="Serial#")

This my field to add in one2many. In my xml I added like this.

xml

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

            <field name="name">stock.picking.serial.form</field>

            <field name="model">stock.picking</field>

            <field name="inherit_id" ref="stock.view_picking_form"/>

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

                    <xpath expr="//notebook/page/field[@name='move_lines']/tree/field[@name='product_id']" position="after">

                              <field name="serial_no"/>

                </xpath>    

            </field>

  </record>

Notes

I get a validation error the xpath expression cannot be located in the parent view.How to solve this issue?



頭像
捨棄
最佳答案

Hello,

The field you are trying to change is not in tree
change your expression to

<xpath expr="//notebook/page/field[@name='move_lines']/kanban/field[@name='product_id']" position="after">

頭像
捨棄
作者

thanks amal

相關帖文 回覆 瀏覽次數 活動
1
5月 17
10429
1
9月 22
2188
4
5月 18
11117
0
3月 23
5149
2
3月 22
9735