跳至内容
菜单
此问题已终结
1 回复
4248 查看

Hi,

I want to show the name field in the view stock.partial.picking.form. But since I must traverse upward the relations from partial picking > move > picking, I have not figured out how the XML must look like.

<form string="Stock partial Picking" version="7.0">
...
<field name="move_ids" context="{'hide_tracking': hide_tracking}">
    <tree editable="bottom" string="Product Moves">
            <field name="product_id" on_change="onchange_product_id(product_id)"/>
            <field name="name"/> <!-- doesnt exist, error -->

<form string="Stock partial Picking" version="7.0">
...
<field name="move_ids" context="{'hide_tracking': hide_tracking}">
    <tree editable="bottom" string="Product Moves">
            <field name="product_id" on_change="onchange_product_id(product_id)"/>
            <field name="move_id.picking_id.name"/> <!-- syntax error? -->

<form string="Stock partial Picking" version="7.0">
...
<field name="move_ids" context="{'hide_tracking': hide_tracking}">
    <tree editable="bottom" string="Product Moves">
            <field name="product_id" on_change="onchange_product_id(product_id)"/>
            <!-- no error, but also not shown (instead the move is shown) -->
            <field name="move_id">
                <form>
                    <field name="picking_id">
                        <form>
                            <field name="name"/>
                        </form>
                    </field>
                </form>
            </field>

形象
丢弃
编写者

anyone?

最佳答案

Field name can only be the exact name of the field in your python code. The field on your python script in this is is propably a related field. If it does not yet exist you should create it first.

Then you can reference this field using the field name tag like so:

<field name="my_related_field_name" />

This should show you the field. 

Look in the existing code to find the code in order to create a related field.

形象
丢弃
编写者

ah, I understand, thank you! I will try that. should I modify this extension directly or should I create my own? (is there a kickstart/tutorial in that case, that you can point me to)?

You should create your own (small) module for this. Looking at previously made code is always the best thing I presume. Otherwise, you can always go to https://doc.odoo.com/trunk/server/ for a quick start on creating modules. When browsing existing code, look for fields.related and see how that is done. If you have any more questions, just ask.

编写者

great, thanks for your kickstart!

相关帖文 回复 查看 活动
5
6月 20
6829
1
12月 23
17953
1
4月 16
5025
2
3月 15
6425
0
3月 15
3464