Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
20289 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore

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

Thanks! You saved my day .

Post correlati Risposte Visualizzazioni Attività
2
ott 22
4810
0
gen 25
879
2
lug 23
3906
2
nov 22
7097
5
gen 24
13716