Skip to Content
मेन्यू
This question has been flagged
1 Reply
2070 Views

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
Discard
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
Discard
Related Posts Replies Views Activity
2
नव॰ 21
2360
2
नव॰ 17
5249
0
अग॰ 17
3173
1
मार्च 15
3414
0
मार्च 15
3080