Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
903 Lượt xem

I want to add additional field to popup card, but there is no way to inspect it, no bug icon:


How can I add additional fields here?


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You need to inherit view stock.view_move_line_form and add your custom fields, 

You can do it from Odoo UI (Not prefer this way if you upgraded module or updated Odoo you will loose the changes), enable developer mode and go to settings -> Technicals -> view search for view  view_move_line_form and you will find more than one, open the one with  stock.view_move_line_form and you can add you fields there.


Ảnh đại diện
Huỷ bỏ
Tác giả

I figured that your is the best answer, because I didn't specify that I want to achieve it programmatically

Tác giả Câu trả lời hay nhất

Thank you Waleed Mohsen


I was searching for a programmatic way to achieve this.
This code worked for me:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="stock_move_lines_form_inherit_my_fields" model="ir.ui.view">
 
      <field name="name">stock.move.line.form.my.inherit</field>
 
      <field name="model">stock.move.line</field>
 
      <field name="inherit_id" ref="stock.view_move_line_form"/>
        <field name="priority" eval="8"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='result_package_id']"
                   position="after">
                <field name="my_field"/>
            </xpath>
        </field>
    </record>
</odoo>



Ảnh đại diện
Huỷ bỏ