Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3766 มุมมอง

Hi everyone, in the Recruitment app, when configuring an automated email, I ran across the following templated expression for the "email_to" field:

{{ (not object.partner_id and object.email_from or '') }}


I noticed that this expression evaluates to object.email_from, which is the email of the applicant (I validated this because my test applicant received an email). However, I can't find any documentation to explain why it evaluated to this value; according to my programming kwowledge, this expression should evaluate to a Boolean (True or False) value, since it has AND and OR keywords.


If anyone could explain how dynamic placeholders are evaluated I'd be much appreciated! thanks. 


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

You are totally right, a bit embarrassing for a Python programmer to have forgotten about this :D 

Thanks a lot!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Fred: This is how python works. It's the pythonic way of saying,

if the record does not have a partner_id return email_from else return ''

You can test it by assigning the value of the expression to a variable and printing out it's value.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 21
7373
1
ธ.ค. 24
1155
0
ม.ค. 24
1205
0
ก.ค. 20
3648
9
พ.ค. 25
17609