コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2030 ビュー

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
2333
2
11月 17
5227
0
8月 17
3129
1
3月 15
3404
0
3月 15
3046