i have a method that prints a report. That method is not defined inside an Odoo model class, but it is defined inside the website controller. I want to call that method from odoo website, 'My Invoices' section. The method do something in backend and if it doesn't find some information it raises a Warning error. I want to show that error in a website pop up, using javascript.
I found out how to show a simple alert "Hello" in a pop up using the following code:
<script>
function printInvoice(){
alert("Hello");
}
</script>
<a href="javascript:printInvoice();">
<t t-esc="invoice.full_name"/>
</a>
now i want to call the python method and show the string message it returns inside the alert. python code:
def my_function(self, invoice_report_render):
try:
invoice_report_render.get_pdf()
except Exception, e:
return e[0]
Is there any way to call 'my_function' from javascript above code and put the message in the alert?
Thank you very much