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

[16.0] [FIX] fix invoiced_amount when invoice currency == sale curren… #3362

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

BenjaHe
Copy link

@BenjaHe BenjaHe commented Oct 15, 2024

We have a bug when:
invoice.currency_id == rec.currency_id and invoice.currency_id != invoice.company_currency_id
-> This may append in an inter-company scénario

In that case the invoiced amount in the sale order is not correct:
invoice
Saleorder

@BenjaHe
Copy link
Author

BenjaHe commented Oct 15, 2024

@luc-demeyer

@@ -42,6 +42,13 @@ def _compute_invoice_amount(self):
invoice.company_id,
invoice.invoice_date or fields.Date.today(),
)
elif (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hy,

Thanks for the proposal.
I totally agree on the case.
Yet I think it should be great to simplify. Actually this line L37 is the same as your addition.
So in the end we have 2 main cases and not 3 :

  • One case when rec.currency_id == invoice.company_currency_id fair case in L53
  • the other one when rec.currency_id != invoice.company_currency_id andIMHO, we should always use the convert method to prevent the enumeration of cases and improve readability.

Of course this is my humble opinion

@rousseldenis
Copy link
Contributor

@BenjaHe Thanks for this. A great thing should be tests addition for that use case. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants