OCA / account-financial-reporting

Financial reports for Odoo
GNU Affero General Public License v3.0
233 stars 616 forks source link

[14.0] [partner_statement] Exhange gain/loss should not appear on statements #852

Closed LGodoo closed 3 months ago

LGodoo commented 2 years ago

Module

partner_statement

Describe the bug

A customer we deal with in Euro. Our reporting/company currency is USD. If we issue invoices in Euro and record payment in Euro a realised forex is accounted for.

If we generate the receivable statement it is in Euro but it includes the forex gain/loss that was booked in our ledger in USD with the euro sign in front.

As a result the balance in the statement is not zero and the customer/partner will wander what this small amounts are. The partner should not see forex gain/losses in his Statement. They do not consern them.

To Reproduce

Affected versions: 14.0

Steps to reproduce the behavior:

  1. Company curency is USD
  2. Activate multi-currencies, then Euro and fill in the rates
  3. Generate invoice in Euro
  4. Record payment in Euro at a different date
  5. Confirm in general ledger that an exchange gain or loss was booked
  6. Generate Activity Statement for this partner

Expected behavior Expected to see the statement in Euro with 2 entries:

  1. The invoice i.e. Dr Euro 100
  2. The payment i.e. Cr Euro 100
  3. Balance is zero
nicolas-tg commented 1 year ago

I am facing the same issue in version 15.

github-actions[bot] commented 11 months ago

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.

AndrzejGerasimukARCHIMEDES commented 11 months ago

We have the same problem i PLN I have check the code and i think, tat problem is in _display_outstanding_lines_sql_q1 method.

In line 38 system check only balance >= 0 obraz

But in our case then account.move.line has ballance (in system currency) equal 0 and ammount_currency have proper value - positive or negative. So in my opinion proper case condition must be:

        CASE WHEN l.balance > 0.0  or (l.balance = 0.0 and l.amount_currency > 0.0)
            THEN l.amount_currency - sum(coalesce(pd.debit_amount_currency, 0.0))
            ELSE l.amount_currency + sum(coalesce(pc.credit_amount_currency, 0.0))
        END AS open_amount_currency,
github-actions[bot] commented 4 months ago

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.