تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6517 أدوات العرض

For example, I have a treeview in wizard window. The treeview has column namely sequence, date, priority.Then user clicks the column header to change the order of items in the treeview (sorting of records). So on clicking a save button I would like to save the sequence/order of the list items which was visible to user. 

Below is my part of python code:


def print_production(self, cr, uid, ids, context=None):

  if context is None:

   context = {}

 _newseq=0

  record = self.browse(cr, uid, ids[0], context=context)

  for line in record.print_line:#looping through all treeview list items

       _newseq= line.sequence #this sequence is not as per the treeview sorted items

The _newseq does not get the preview treeview items sorted order (by column header clicks).


Is there any way to capture the order of treeview in database?


Thanks.

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

you have to define the sequence field in your model then that field will store the actual sequence value of tree view in default. The sequence field also gets updated if any changes.

sequence = fields.Integer("Sequence")
الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أبريل 23
4713
3
يناير 20
9088
3
أبريل 25
4659
5
نوفمبر 23
42968
3
سبتمبر 23
9458