Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0]account_invoice_overdue_reminder : When i remove invoice from list in wizard, the residual become 0 #310

Closed
Olimalt85 opened this issue Sep 7, 2023 · 3 comments
Labels
bug stale PR/Issue without recent activity, it'll be soon closed automatically.

Comments

@Olimalt85
Copy link

Olimalt85 commented Sep 7, 2023

Module

account_invoice_overdue_reminder

Describe the bug

When you use the reminder wizard in customers and delete a line from the invoice_ids field, the computed amount due of each line become 0
image
When i remove a line on invoice :
image

To Reproduce

Affected versions: 14.0

Steps to reproduce the behavior:

  1. Launch the action "Overdue Invoice Remind" in Invoicing/Customers/Overdue Invoice Remind
  2. Start the action
  3. Delete a line in the invoices list

Expected behavior
The residual amount should be computed normaly.

@Olimalt85 Olimalt85 added the bug label Sep 7, 2023
@Olimalt85
Copy link
Author

I found that the problem was because of the mail template creation.

To debug it, i made a method "_get_mail_template" in the wizard that return the mail template like this :
image

And i had to change the lines related to the td of amount_untaxed,amount_total and amount_residual :
<td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_untaxed * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td> <td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_total * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td> <td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_residual * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td>

I just add _signed after the fields names to resolve it.
Like this :
<td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_untaxed_signed * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td> <td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_total_signed * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td> <td style="padding: 5px; border: 1px solid black; text-align: right;">${format_amount(inv.amount_residual_signed * (inv.move_type == 'out_refund' and -1 or 1), inv.currency_id)}</td>

But when i try to change the mail template directly like this, it won't work i don't understand why?

@Olimalt85
Copy link
Author

I found the last problem, it was caused by the "total_residual" function.
I had to change inv.amount_residual by inv.amount_residual_signed in it :
image

its now working well !

Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

No branches or pull requests

1 participant