Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
4371 Tampilan

It works with my needs, but I don't understand how it works. can you explain it to me;

@api.model
def create(self, vals):
vals['classiffy_lead']='leads_processed'
print(vals)
# Nếu vals chưa được thiết lập user_id thì gán giá trị user_id vào vals
if not 'user_id' in vals:
vals['classiffy_lead'] = 'leads_init'
if not 'user_id' in vals:
vals['user_id'] = 8
return super(crm_lead, self).create(vals)
Avatar
Buang
Penulis Jawaban Terbai
Mitul Shingala : My case is: when fetch from mail, 'classiffy_lead' changes to 'leads_init', when import or create, 'classiffy_lead' changes to 'leads_processed',

Avatar
Buang

when you simple create the record at that time into the vals you get the user_id key, but while fetch from mail at that time into the vals you didn't get the key user_id that's why the classiffy_lead value is change.

Penulis

ok man

Penulis

thank you :)

Jawaban Terbai

hello

it update the values of classiffy_lead field to "leads_processed".
and user_id field value is not exist into the vals variable then it update the value that you assigned.

Avatar
Buang