Skip to Content
Menú
This question has been flagged
1 Respondre
2011 Vistes

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
Descartar
Best Answer

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
Descartar
Related Posts Respostes Vistes Activitat
2
de nov. 21
2296
2
de nov. 17
5211
0
d’ag. 17
3110
1
de març 15
3403
0
de març 15
3039