Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2074 Widoki

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'

 

Awatar
Odrzuć
Najlepsza odpowiedź

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


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lis 21
2362
2
lis 17
5257
0
sie 17
3176
1
mar 15
3415
0
mar 15
3082