Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
20279 Lượt xem

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!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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


Ảnh đại diện
Huỷ bỏ
Tác giả

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

Thanks! You saved my day .

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 22
4800
0
thg 1 25
860
2
thg 7 23
3901
2
thg 11 22
7091
5
thg 1 24
13714