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 payment entry bug: Handle None value in payment_term_outstanding #36455

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

husamhammad
Copy link
Contributor

Fix Payment Entry Bug: Handle None Value in Payment Term Outstanding

Description:

This pull request addresses the bug in the Payment Entry module, which occurs when a Payment Entry is generated from a Purchase Order with payment terms. The issue results in a validation error due to an unexpected None value for the latest.payment_term_outstanding when referencing the Purchase Order on the Payment Entry.

Bug Details:

Module: accounts
Version: Frappe v14.42.0, ERPNext v14.32.1
Root Cause:

The bug occurs because the original code does not handle the case when latest.payment_term_outstanding is None for the Purchase Order reference on the Payment Entry.

Solution:

To fix the issue, I introduced a condition to check whether latest.payment_term_outstanding is None. If it is None, the comparison is bypassed, allowing the Payment Entry to proceed without throwing an error.

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Aug 1, 2023
@lafi87
Copy link

lafi87 commented Aug 2, 2023

I think the sentence should be:

and latest.payment_term_outstanding and ( flt(d.allocated_amount) > flt(latest.payment_term_outstanding))

@ruthra-kumar ruthra-kumar self-assigned this Aug 2, 2023
@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Merging #36455 (6e25441) into develop (ba15810) will increase coverage by 0.01%.
Report is 55 commits behind head on develop.
The diff coverage is 84.03%.

❗ Current head 6e25441 differs from pull request most recent head 3976e06. Consider uploading reports for the commit 3976e06 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #36455      +/-   ##
===========================================
+ Coverage    64.52%   64.54%   +0.01%     
===========================================
  Files          786      787       +1     
  Lines        61123    61171      +48     
===========================================
+ Hits         39440    39483      +43     
- Misses       21683    21688       +5     
Files Changed Coverage Δ
...ccounts/doctype/loyalty_program/loyalty_program.py 75.60% <0.00%> (ø)
...ext/accounts/report/trial_balance/trial_balance.py 81.97% <ø> (ø)
...eport/voucher_wise_balance/voucher_wise_balance.py 0.00% <ø> (ø)
erpnext/controllers/website_list_for_contact.py 56.02% <0.00%> (ø)
...facturing/doctype/bom_update_log/bom_update_log.py 43.36% <ø> (ø)
...uring/doctype/bom_update_log/bom_updation_utils.py 44.23% <0.00%> (ø)
erpnext/manufacturing/doctype/job_card/job_card.py 72.84% <0.00%> (ø)
...t/manufacturing/doctype/workstation/workstation.py 88.15% <0.00%> (ø)
...rpnext/stock/report/stock_balance/stock_balance.py 88.84% <ø> (ø)
erpnext/stock/report/stock_ledger/stock_ledger.py 66.66% <ø> (ø)
... and 19 more

... and 2 files with indirect coverage changes

@husamhammad husamhammad changed the title Fix payment entry bug: Handle None value in payment_term_outstanding (#36415) Fix payment entry bug: Handle None value in payment_term_outstanding Aug 2, 2023
@ruthra-kumar ruthra-kumar merged commit 27ebf14 into frappe:develop Aug 2, 2023
11 of 12 checks passed
@ruthra-kumar ruthra-kumar added the backport version-14-hotfix backport to version 14 label Aug 2, 2023
ruthra-kumar added a commit that referenced this pull request Aug 2, 2023
…-36455

fix: handle None value in payment_term_outstanding (backport #36455)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14 needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants