Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
20385 Näkymät

I tried to add section_and_note_one2many widget in purchase order model. But the lines don't retain the sequence after saving.

I had to create a sequence record manually and write an onchange to increment the sequence. Which works perfectly.

But I see in the sale.order model there is nothing like separate sequence record or onchange. So I wonder how it works.

Thanks!

Avatar
Hylkää
Paras vastaus

Make sure that:

* you define the _order in the comodel of section_and_note_one2many table. It should be something like:

 _order = "sequence,id"
* you apply the widget 'handle' in the tree view in the column sequence, e.g.:
<field name='section_and_note_one2many'>
    <tree>
        <field name='sequence' widget='handle'/>
        <!-- Other fields -->
    </tree>
</field>

No onchange, write, or inverse methods are required. The logic is behind the widget 'handle' and the related javascript. The '_order' is responsible for saving the order


Avatar
Hylkää
Tekijä

Thanks! It worked. I think the id in _order is required. That's what I was missing.

Thanks! You saved my day .

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
lokak. 22
4908
0
tammik. 25
974
2
heinäk. 23
3992
2
marrask. 22
7225
5
tammik. 24
13850