Skip to Content
Menu
This question has been flagged
2 Replies
3242 Views

I am struggling with a supposedly easy task in Odoo 12 CE.

In my custom module I can print a report from the drop-down menu without problem.

The code in my report that seems to work fine:

<report
id="report_service_registration"
string="Workorder Info"
model="yacht.service.registration"
report_type="qweb-html"
name="yacht_repair_management.yacht_service_report"
file="yacht_repair_management.yacht_service_report"
print_report_name="'Job Info- %s' % (object.customer)"/>
Now I have created an action button in my form view. 
I need that button to do exactly the same as the "dropdown print".
Here the code for the button in my form:
<button class="oe_stat_button"
name="%(my_report)d"
string="WO Info"
type="action"
icon="fa-print"
help="Print Workorder Sheet">
</button>
I tried all kinds of names e.g. (yacht_service_registration.my_report) yes,
even with the id (report_service_registration).
The button appears just fine in the form but there is no action whatsoever when clicking.
 


Avatar
Discard
Best Answer

Please try the below:

<button type="action" name="[YourAppName].report_service_registration" string="WO Info"  icon="fa-print"
help="Print Workorder Sheet"/>



Avatar
Discard
Author Best Answer

I yet got another error, but you sure pushed me into the right direction ;).

It has to be:

<button type="action" name="yacht_service_management.report_service_registration" string="WO Info"  icon="fa-print"
help="Print Workorder Sheet"/>
Instead of the module name: (yacht_service_registration);
I has to be the app name: (yacht_service_management)!
That did the trick.
Thanks a lot I appreciate it.



Avatar
Discard

Yes It's Module/App name not the model and already updated the answer. Please accept my answer.