Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2017 Vizualizări

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'

 

Imagine profil
Abandonează
Cel mai bun răspuns

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


Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
nov. 21
2298
2
nov. 17
5218
0
aug. 17
3116
1
mar. 15
3403
0
mar. 15
3041