When click on the Renewal letter menu under print action, i want to call below method from python
@api
def renewal letter(self):
print "Renewal
"
can anyone help me to resolve this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
When click on the Renewal letter menu under print action, i want to call below method from python
@api
def renewal letter(self):
print "Renewal
"
can anyone help me to resolve this?
For items under the `Print` menu, you should be calling a report directly (qweb template)
You can do this by having the following defined in an xml file in a module:
<template id="template_name">
<div class="page">
<!-- Report template defined here -->
</div>
</template>
<template id="print_template_name">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="module_name.template_name"/>
</t>
</t>
</template>
<report
id="your_report_print"
model="model.name"
string="Your Report Name"
report_type="qweb-pdf"
name="module_name.print_template_name"
file="module_name.print_template_name"
attachment="'Attachment Name.pdf'"
/>
If the intended use is to actually call a python function from this menu - then I would advise to define an Action.
This way - you can call a wizard form, and a fairly free to do what you please from it. (i.e have a button on it which calls your function)
You would do this with the following:
https://www.odoo.com/forum/help-1/question/how-to-open-a-form-with-ir-action-server-which-executes-python-code-61910
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Mar 18
|
7546 | ||
KeyError: 'share'
Solved
|
|
1
Oct 17
|
4425 | |
|
4
Apr 24
|
170721 | ||
|
0
Dec 23
|
604 | ||
|
5
Nov 24
|
217125 |
https://www.youtube.com/watch?v=7unX7D2E5Yw