Skip to Content
Menu
This question has been flagged
2 Replies
4009 Views

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
Discard
Author Best Answer
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
Discard

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.

Author

ok man

Author

thank you :)

Best Answer

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
Discard