Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4377 Zobrazení

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
Zrušit
Autor Nejlepší odpověď
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
Zrušit

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

Nejlepší odpověď

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
Zrušit