İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
2031 Görünümler

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'

 

Avatar
Vazgeç
En İyi Yanıt

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')


Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Kas 21
2337
2
Kas 17
5231
0
Ağu 17
3129
1
Mar 15
3405
0
Mar 15
3047