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

hai 

i want to show a status feild on the user. i have a table for the payments the user made and have an invoice table. if there are pending payments then the account status need to be inactive and if no pending payment then the user is active. how this can be done?

 

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

Hi, you can use a functional field( a compute field in new api) for that. So in the function you can perform all the calculations based on the payments and return a status value, which will be displayed on the user profile.

For Eg:

class custom_res_partner(models.Model):

     _inherits = 'res.partner'

    status = fields.Boolean(compute='_check_status', string="Status")

   

    def _check_status(self):

        for rec in self:

            if payment_done:            // do your calculations based on payments

                   rec.status =True

            else:

                   rec.status = False

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 10 22
7987
0
thg 1 21
2486
5
thg 7 19
4981
1
thg 12 17
7685
2
thg 11 16
6492