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

Hi everybody,

I am using V14 Enterprise hosted on SH.

I want to show the "View Invoice" button, which appears on the footer of the e-mail sent from Odoo when manually sending a regular invoice to the customer via the "Send & Print" button, also on the email with the invoice sent automatically from the Subscription module.

This button is not set from the template, I checked. It appears to be set from the views (as I read on the Forum). However, the email with the invoice sent automatically by the Subscriptions module does not show this "View Invoice" button. I need to show it in this email.

Please help! It drives me nuts :)

Thank you,

Sebastian

Avatar
Discard
Best Answer

You can add a button to the template which calls the same action as the "PREVIEW" button does (get_portal_url) from the account.move form view. This action also generates an access token for the button which does not require being logged in.

Code here, which does not include any if statements etc:

<center>

<a href="${object.get_portal_url()}" style="background-color:#1abc9c;padding: 20px; text-decoration: none; color: #fff; border-radius: 5px; font-size: 16px;" class="o_default_snippet_text">View Invoice</a>

</center> 


Note: be sure to add this using the code view when editing the email template

Avatar
Discard
Author

Thank you very much Michael! This make the button appear on the template and all is working great in the preview mode.

However, I am getting an error now, after adding the button, when I push the "Generate Invoice" button from a subscription. It's a large error and at the end it says:

"Error to render compiling AST

IndexError: list index out of range

Template: account.report_invoice_document

Path: /t/t/div/div[5]/div/div[1]/table/t[1]/tr/t[2]/td[2]/t[1]

Node: <t t-if="amount_by_group == o.amount_by_group[1]">

<span t-esc="sub_values[2]" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: sub_values[0]}"/>

</t>"

Could this error come from the added button?

Hi Sebastian - as the addition to the template only calls an existing function and does not modify any code, the error you are experiencing would be completely unrelated. Of course you can always test by removing the code from the template and checking if it changes anything. Based on the part of the error you have posted in your comment, it's an error with the invoice document itself (account.report_invoice_document) related to the line/code shown in the Node:section of the error message.

Author Best Answer

Hi Michael, yes, you are completely right. The error was from somewhere else.

Your answer fully solved my problem, thank you a lot! :)

Warmest regards,

Sebastian

Avatar
Discard