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: reconciliation matching rule div by zero #32105

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
4 participants
@kebeclibre
Copy link
Contributor

commented Mar 25, 2019

Do a MISC operation representing a payment
revert it

Do a statement line for that amount

Click on "reconcile" on the bank journal

Before this commit there was a Division By Zero traceback
This was because the bank account line had a zero amount_residual
due to its reversion
while the statement line was negative.

After this commit, for liquidity lines, we take the total amount instead of the residual
Because a reverted payment line can always be associated with a statement

OPW 1947362
courtesy of @smetl (las@odoo.com) for the fix

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

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

@kebeclibre kebeclibre requested a review from smetl Mar 25, 2019

@robodoo robodoo added the seen 🙂 label Mar 25, 2019

@kebeclibre kebeclibre force-pushed the odoo-dev:12.0-recmodels-zero-div-lpe branch 2 times, most recently from 8ffb086 to a6fbd7e Mar 25, 2019

@C3POdoo C3POdoo added the OE label Mar 25, 2019

[FIX] account: reconciliation matching rule div by zero
Do a MISC operation representing a payment
revert it

Do a statement line for that amount

Click on "reconcile" on the bank journal

Before this commit there was a Division By Zero traceback
This was because the bank account line had a zero amount_residual
due to its reversion
while the statement line was negative.

After this commit, for liquidity lines, we take the total amount instead of the residual
Because a reverted payment line can always be associated with a statement

OPW 1947362
courtesy of @smetl (las@odoo.com) for the fix

@kebeclibre kebeclibre force-pushed the odoo-dev:12.0-recmodels-zero-div-lpe branch from a6fbd7e to a213b53 Mar 26, 2019

@robodoo robodoo added the CI 🤖 label Mar 26, 2019

@smetl

smetl approved these changes Mar 26, 2019

'name': 'One of these days',
'debit': 10,
})
payment_bnk_line = AccountMoveLine.create({

This comment has been minimized.

Copy link
@smetl

smetl Mar 26, 2019

Contributor

@kebeclibre I highly encourage you to define your one2many like:

'line_ids': [(0, 0, {...}), (0, 0, {...}), ....]

...because it's:

  • more efficient (create batch)
  • more readable (less code)
  • avoid trick like .with_context(check_move_validity=False)

This comment has been minimized.

Copy link
@kebeclibre

kebeclibre Mar 26, 2019

Author Contributor

I feel you bro, but in tests we usually need a reference to a specific line to check it against some values,
just like I do at l347
Otherwise, we would have to filter.map with lambdas, which is, I guess, not very clearer :D

@kebeclibre

This comment has been minimized.

Copy link
Contributor Author

commented Mar 26, 2019

robodoo r+

@robodoo robodoo added the r+ 👌 label Mar 26, 2019

robodoo pushed a commit that referenced this pull request Mar 26, 2019

[FIX] account: reconciliation matching rule div by zero
Do a MISC operation representing a payment
revert it

Do a statement line for that amount

Click on "reconcile" on the bank journal

Before this commit there was a Division By Zero traceback
This was because the bank account line had a zero amount_residual
due to its reversion
while the statement line was negative.

After this commit, for liquidity lines, we take the total amount instead of the residual
Because a reverted payment line can always be associated with a statement

OPW 1947362
courtesy of @smetl (las@odoo.com) for the fix

closes #32105

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
@robodoo

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

Merged, thanks!

@robodoo robodoo closed this Mar 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.