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

Sum record in treeview odoo 17

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

Thanks for your help.         

 But I want:        

Example: when I search it show 3 record, and I want to count this record.     (field count_record = 3)

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

Hello BB

It is already showing in odoo17 


Solution : 2

If you want to store in a field , You can also do like this


class SaleOrder(models.Model):
​_inherit = 'sale.order'

​no_of_records = fields.Integer(string='No. Of records', compute='count_no_of_records')

​def count_no_of_records(self):

​Solution : 1


​# records_lst = []
​# for record in self.search([], limit=10):
​# records_lst.append(record)
​# self.no_of_records = len(records_lst)

solution:

​​len_records = self.search_count([])
​self.no_of_records = len_records


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

Thanks for your help.
But I want to create a pivot to count record in tree view.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 4 23
2975
2
thg 3 23
2704
1
thg 3 15
4869
2
thg 3 15
8521
0
thg 4 21
3828