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

I want to perform an arithmetic calculation on a field whenever the tree view gets loaded.Here here is the 

model.py:

class li(models.Model):

    ns_rate = fields.Float(compute='_compute_ns_rate', store=True)

     def _compute_ns_rate(self): 

        for record in self: 

            record.ns_rate = float(math.ceil(float(record.ns_rate)*4)/4)




Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 18
3439
1
thg 2 16
3598
1
thg 3 15
4257
1
thg 3 15
4929
1
thg 11 23
2431