Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
4261 Vizualizări

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>

Imagine profil
Abandonează
Cel mai bun răspuns

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.

Imagine profil
Abandonează
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 Răspunsuri Vizualizări Activitate
5
iun. 20
6856
1
dec. 23
17964
1
apr. 16
5031
2
mar. 15
6441
0
mar. 15
3487