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

I tried code by guide like this, but it not active: 

class ResPartner(models.Model):
_inherit = 'res.partner'
type_customer = fields.Char('Loại KH', default='Normal')
@api.depends('total_invoiced')
def _compute_type_customer(self):
for rec in self:
if rec.total_invoiced > 1000:
rec.type_customer = 'Gold'
else:
rec.type_customer = 'Normal'

 

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

The field type_customer will be computed field so you need to add compute parameter.

You can check Odoo documentation:


type_customer = fields.Char('Loại KH',compute='_compute_type_customer')


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ย. 21
2357
2
พ.ย. 17
5238
0
ส.ค. 17
3144
1
มี.ค. 15
3411
0
มี.ค. 15
3070