Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3838 มุมมอง

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?

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
4
ต.ค. 22
8034
0
ม.ค. 21
2493
How to add Fields in Form แก้ไขแล้ว
5
ก.ค. 19
4988
1
ธ.ค. 17
7693
fields_view_get not being triggered แก้ไขแล้ว
2
พ.ย. 16
6500