Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4229 Widoki

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>

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
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!

Powiązane posty Odpowiedzi Widoki Czynność
5
cze 20
6808
1
gru 23
17928
1
kwi 16
5007
2
mar 15
6405
0
mar 15
3445