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

[FIX] account_reconcile_oca : foreign currency reconcile with late currency rate #3

Conversation

florian-dacosta
Copy link

It is possible that the statement line in foreign currency is created before the rate of the day is updated in Odoo. In this case we need to take the real rate of the statement line to compute the exchange rate

@etobella One more fix about multi currency.
To reproduce :
Create a rate for d-2
Create an invoice in currency for d-2
Create a statement line in a foreign currency journal for d-1 (same amount in same currency of the invoice)
create a rate for d-1
Try to reconcile => It does not work because the rate of the statement line is the one of d-2.

…rrency rate

It is possible that the statement line in foreign currency is created before the rate of the day is updated in Odoo. In this case we need to take the real rate of the statement line to comput the exchange rate
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

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

Files with missing lines Patch % Lines
...econcile_oca/models/account_bank_statement_line.py 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             16.0-fix-mcurr       #3   +/-   ##
=================================================
  Coverage                  ?   85.86%           
=================================================
  Files                     ?       77           
  Lines                     ?     3092           
  Branches                  ?      441           
=================================================
  Hits                      ?     2655           
  Misses                    ?      325           
  Partials                  ?      112           

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

self.manual_line_id.exists()
and self.manual_line_id
and self.manual_kind != "liquidity"
):
Copy link
Author

Choose a reason for hiding this comment

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

Here, we may have a better fix I don't know, but here it was it fixes :

When you click on the statement line (the liquidity line), _onchange_manual_reconcile_reference is called (to fill all manual fields from what I understand) and then in cascasde _onchange_manual_amount_in_currency is called and it recompute the manual_amount.
So, if the rate of the statement line is different from the current odoo rate at this date, the amount in company currency changes... (and become inconsitent with the real account move line amount)

I don't see any case when it should recompute the amount of the liquidity line.

@@ -1050,6 +1055,12 @@ def _get_exchange_rate_amount(self, amount, currency_amount, currency, line):
self.date,
)
to_amount = self.company_id.currency_id.round(to_amount_company_currency)
elif self.currency_id == currency and not self.foreign_currency_id:
Copy link
Author

Choose a reason for hiding this comment

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

To compute the exchange amount, I take the "accounting rate", instead of the odoo rate, even if the foreign currency is not filled (case of journan in foreign currency)

@etobella etobella merged commit c810817 into dixmit:16.0-fix-mcurr Oct 9, 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