Vauxoo / odoo

Fork of Odoo (formerly OpenERP). [This project is not publically mantained just born for internal usage with some little patches] go to official repository on github.com/odoo/odoo
https://www.odoo.com
Other
9 stars 9 forks source link

[FIX] account: Do not try to reconcile a CABA Entry line if already reconciled #302

Closed luisg123v closed 4 years ago

luisg123v commented 5 years ago

Main

For Huge Amount Invoices with small residual being paid and the Invoice and the initial payment which almost paid, the invoice in full can render the reconciliation of the Tax Entry Lines as fully reconciled.

Description

In case of multi-currency transactions where CABA Journal Entries are involved, there could be a case where ,in Mexican Localization, so far, a small entry line cannot be reconciled with their counterpart because the previous counterparts are already reconciled. (Though this is still unproved in a lab, i.e. UnitTest, can be seen in the wild, i.e. Customer's Production Instance)

The following is an hypothetical case yet to be proven:

    Test to validate tax effectively receivable

    My company currency is MXN.
    Invoice issued two days ago in USD at a rate => 1MXN = 0.80 USD.
    Booked like:
        Receivable          1450                1160    USD
            Revenue                 1250       -1000    USD
            Taxes to Collect         200        -160    USD (Hypothetical Fully Reconciled with A1)
    Payment issued today in USD at a rate => 1 MXN = 1.25 USD.
    Booked like:
        Bank                 927.99                1159.99    USD
            Receivable               927.99       -1159.99    USD

    And a Tax Cash Basis Entry is generated for the ratio being paid
    Booked like:
        Tax Base Account     800                1000.00    USD (sometimes this base can be rounded up and instead of being 999.99 it ends up as 1000.00 which leads to taxes to be as fully reconciled)
            Tax Base Account         800       -1000.00    USD
        Taxes to Collect     128                 160    USD (Hypothetical Fully Reconciled with A1)
            Taxes to Paid            128        -160    USD

    I will neglect to depict here the FX Journal Entry for Tax to Collect account for the hypothetical reconciliation A1. And any other FX Journal Entries.

    At this moment Invoice has a USD 0.01 residual which on same date will be tried to write-off manually.

        Write-off              0.01                   0.01    USD
            Receivable                 0.01          -0.01    USD

    At this moment Invoice has a USD 0.01 residual which on same date will be tried to write-off manually.
    This small amount will create while running in run-time following CABA Journal Entry:
        Tax Base Account     0.01                0.01    USD (sometimes this base can be rounded up and instead of being 0.00 it ends up as 0.01 which leads to taxes to be created and be tried to reconcile)
            Tax Base Account         0.01       -0.01    USD
        Taxes to Collect     0.01                 0.01    USD (Hypothetical This will be tried to reconcile with the items in Full Reconciliation A1 but raise an error)
            Taxes to Paid            0.01        -0.01    USD

-- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

luistorresm commented 5 years ago

@luisg123v

PR description is missing.

Please complete it.

Regards

luisg123v commented 5 years ago

@hbto
Could you provide a description for this PR, please? I think I'm not the right person to do so, as I'm not completely aware of its purpose/implications.

CC @luistorresm @edy1192

hbto commented 5 years ago

@luisg123v Done

cc/ @luistorresm & @edy1192

hbto commented 5 years ago

ok, Estoy de acuerdo, procede entonces con ese enfoque.

Saludos.

Quien suscribe,

Humberto Arocha

On Thu, May 23, 2019 at 2:26 PM Luis Ernesto Torres Macías < notifications@github.com> wrote:

@luistorresm commented on this pull request.

In addons/account/models/account_move.py https://github.com/Vauxoo/odoo/pull/302#discussion_r287076209:

@@ -1615,7 +1615,7 @@ def create_tax_cash_basis_entry(self, percentage_before_rec):

                             'move_id': newly_created_move.id,

                             'partner_id': line.partner_id.id,

                         })
  • if line.account_id.reconcile:

  • if line.account_id.reconcile and not line.reconciled:

@hbto https://github.com/hbto ⬇️ Suggested change

  • if line.account_id.reconcile and not line.reconciled:

  • force = self.env['ir.config_parameter'].sudo().get_param(

  • 'force_unreconciled', True)

  • if line.account_id.reconcile and (force and not line.reconciled):

Como no es tan replicable el error, que te parece si en esta primer versión hacemos algo como esto. Por si se afecta alguna funcionalidad, simplemente se elimine el parametrro del sistema y el comportamiento sea el mismo que tiene Odoo ahora?

Nota: Mi propuesta de código es un ejemplo, hay que ver cual es la mejor solución.

Saludos

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Vauxoo/odoo/pull/302?email_source=notifications&email_token=ABZ67OT35VFV6IZV2Y32SB3PW3OUZA5CNFSM4HNWEKW2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBZRRQCQ#pullrequestreview-241375242, or mute the thread https://github.com/notifications/unsubscribe-auth/ABZ67OXLVBN4LP2MVIVNRODPW3OUZANCNFSM4HNWEKWQ .

hbto commented 4 years ago

This PR is related to https://github.com/odoo/odoo/pull/33585

luisg123v commented 4 years ago

@hbto May I close this? The Odoo PR (https://github.com/odoo/odoo/pull/33585) has been already merged .