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

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)
Awatar
Odrzuć
Autor Najlepsza odpowiedź
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',

Awatar
Odrzuć

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.

Autor

ok man

Autor

thank you :)

Najlepsza odpowiedź

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.

Awatar
Odrzuć