This question has been flagged
1 Reply
2076 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.