跳至內容
選單
此問題已被標幟
1 回覆
2006 瀏覽次數

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'

 

頭像
捨棄
最佳答案

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


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
11月 21
2296
2
11月 17
5209
0
8月 17
3108
1
3月 15
3401
0
3月 15
3038