How to I can get value of total_avoiced to use calculate for a new field at form customer res.parner. I tried code like this, but it not active:
# def get_invoice_total(self):
# if self.total_invoiced > 1000:
# type_customer = 'Gold'
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How to I can get value of total_avoiced to use calculate for a new field at form customer res.parner. I tried code like this, but it not active:
# def get_invoice_total(self):
# if self.total_invoiced > 1000:
# type_customer = 'Gold'
I tried this but it not active :
class ResPartner(models.Model):
_inherit = 'res.partner'
type_customer = fields.Char('Type customer', 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'
Hi,
You can use compute function which depends 'total_invoiced' to calculate value on new field.
@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 = ''Hope it helps
I just use value of total_invoiced to select type_customer, I tried your guide, but it not active:
class ResPartner(models.Model):
_inherit = 'res.partner'
type_customer = fields.Char('Type customer', 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'
Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!
Rekisteröidy| Aiheeseen liittyviä artikkeleita | Vastaukset | Näkymät | Toimenpide | |
|---|---|---|---|---|
|
1
marrask. 21
|
2748 | |||
|
2
marrask. 17
|
6011 | |||
|
0
elok. 17
|
3922 | |||
|
0
maalisk. 15
|
3522 | |||
|
1
maalisk. 15
|
3927 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.