Skip to Content
Menu
This question has been flagged
1 Reply
2361 Views

I was going through the code and randomly find this line. Can someone tell me what is it used for?

template = self.env.ref('coupon.mail_template_sale_coupon', raise_if_not_found=False)
Avatar
Discard
Best Answer

Hello Rob, 

Looking through more of the code it looks like if the record cannot be found and raise_if_not_found is True, this line of code will run: 

raise ValueError('No record found for unique ID %s. It may have been deleted.' % (xmlid))

If no record can be found and raise_if_not_found is False then the function will return None. 

This can be seen here on the Github repository. 

Thanks, 

Avatar
Discard
Author

Thank you.

Related Posts Replies Views Activity
1
Nov 24
1483
1
Nov 24
1188
2
Sep 24
1047
1
Aug 24
2451
3
Aug 24
2686