Skip to Content
Menú
This question has been flagged
1 Respondre
4199 Vistes

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>

Avatar
Descartar
Best Answer

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.

Avatar
Descartar
Autor

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.

Autor

great, thanks for your kickstart!

Related Posts Respostes Vistes Activitat
5
de juny 20
6748
1
de des. 23
17912
1
d’abr. 16
4960
2
de març 15
6368
0
de març 15
3419