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 reconcile oca currency fixes v4 #4

Merged

Conversation

florian-dacosta
Copy link

Hello @etobella

It's been a while... One more PR to try to fix some multi-currency case
The case it fixes is 1 paymant in a foreign currency journal to reconcile with 2 invoices in the same foreign currency of the journal.

…ount

If currency amount is not 0, the suspense line will have wrong amount
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (16.0-fix-mcurr@c810817). Learn more about missing BASE report.

Additional details and impacted files
@@                Coverage Diff                @@
##             16.0-fix-mcurr       #4   +/-   ##
=================================================
  Coverage                  ?   85.87%           
=================================================
  Files                     ?       77           
  Lines                     ?     3093           
  Branches                  ?      441           
=================================================
  Hits                      ?     2656           
  Misses                    ?      325           
  Partials                  ?      112           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -230,7 +229,7 @@ def _onchange_add_account_move_line_id(self):
self.add_account_move_line_id,
"other",
True,
max_amount=pending_amount,
max_amount=currency.round(pending_amount),
Copy link
Author

Choose a reason for hiding this comment

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

Without it, we then compare this amount with a rounded amount. (in my case something like 20.0 > 19.99999999. (here : https://github.com/OCA/account-reconcile/blob/16.0/account_reconcile_oca/models/account_reconcile_abstract.py#L51)
This leading to an unwanted conversion of the currency_amount (https://github.com/OCA/account-reconcile/blob/16.0/account_reconcile_oca/models/account_reconcile_abstract.py#L57)

"line_currency_id": self.company_id.currency_id.id,
"currency_amount": amount,
"line_currency_id": currency.id,
"currency_amount": 0,
Copy link
Author

Choose a reason for hiding this comment

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

The exchange rate gain/loss line should have the same currency of the line is is linked to and the currency_amount should be 0, else, it is taken into account in the suspense line recomputation leading to very weird result (taken into account here I think : https://github.com/OCA/account-reconcile/blob/16.0/account_reconcile_oca/models/account_bank_statement_line.py#L242)

@florian-dacosta
Copy link
Author

@etobella Could you merge it please ?
Since the other PR in OCA is pending, it is no risk.

@etobella etobella merged commit 32421da into dixmit:16.0-fix-mcurr Nov 16, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants