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(accounts): payment entry unallocated amount #30927

Closed
wants to merge 20 commits into from

Conversation

dj12djdjs
Copy link
Collaborator

@dj12djdjs dj12djdjs commented May 8, 2022

Continuation of #30504

closes: #29595
closes: #23936

** Allocating References
This shows the unallocated amount being changes as rows become allocated.

allocate references

** Write Offs
Using the "deductions" table, the unallocated_amount can be manipulated. It's primary use is for rounding, and writeoffs.

maniplute unallocated_amount

** Exchange gain/loss
Using the "losses table, the difference_amount can be manipulated. It's primary use if for declaring the difference between currencies.
manipluate difference amount

# $20.00 USD * 45.263 = 905.26 INR
# $20.00 USD * 50 = 1000 INR
# 1000 - 905.26 = 94.74 INR
# Therefore, deduction amount = 94.74
@dj12djdjs dj12djdjs marked this pull request as ready for review May 8, 2022 21:15
@codecov
Copy link

codecov bot commented May 9, 2022

Codecov Report

Merging #30927 (263c7ba) into develop (3714e36) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop   #30927      +/-   ##
===========================================
- Coverage    63.07%   63.03%   -0.04%     
===========================================
  Files          985      985              
  Lines        67272    67277       +5     
===========================================
- Hits         42431    42410      -21     
- Misses       24841    24867      +26     
Impacted Files Coverage Δ
...ccounts/doctype/payment_request/payment_request.py 67.56% <ø> (ø)
erpnext/regional/india/setup.py 94.24% <ø> (ø)
...xt/accounts/doctype/payment_entry/payment_entry.py 69.33% <100.00%> (+0.23%) ⬆️
...e_sales_analytics/supplier_wise_sales_analytics.py 59.01% <0.00%> (-22.96%) ⬇️
...urity_shortfall/process_loan_security_shortfall.py 93.75% <0.00%> (-6.25%) ⬇️
erpnext/accounts/party.py 78.09% <0.00%> (-4.62%) ⬇️
...pnext/setup/doctype/sales_partner/sales_partner.py 65.21% <0.00%> (-4.35%) ⬇️
erpnext/stock/doctype/warehouse/warehouse.py 77.62% <0.00%> (-3.50%) ⬇️
...e/asset_value_adjustment/asset_value_adjustment.py 86.04% <0.00%> (-3.49%) ⬇️
...eorder_level/itemwise_recommended_reorder_level.py 90.74% <0.00%> (-1.86%) ⬇️
... and 18 more

@dj12djdjs
Copy link
Collaborator Author

Disregard comment about allocation for credit note.

@dj12djdjs
Copy link
Collaborator Author

dj12djdjs commented May 12, 2022

I'm starting to think the only way to solve this is to separate deductions/writeoffs and exchange rate deductions into separate child tables.

Having a condition that forces unallocated_amount to be zero is not working. It should be produced by addition and subtraction.

The only way I can think to solve this is to subtract exchange deductions from total_deductions. Then calculate the unallocated_amount

@dj12djdjs
Copy link
Collaborator Author

Gonna post some screen recordings in a few hours.

@dj12djdjs
Copy link
Collaborator Author

I don't know why the linter keeps failing. I've run pre-commit run --all-files multiple times and is passing on my machine.

@dj12djdjs
Copy link
Collaborator Author

@deepeshgarg007 This is working. Can you please review.

@dj12djdjs
Copy link
Collaborator Author

@deepeshgarg007 Just checking up, did you have a chance to review this ?

@deepeshgarg007
Copy link
Member

@dj12djdjs I am reviewing this and will also take a second opinion internally if we need a separate table for losses

@dj12djdjs
Copy link
Collaborator Author

@dj12djdjs I am reviewing this and will also take a second opinion internally if we need a separate table for losses

If you guys can find a way to make it work in 1 table that would be more convenient.

I don't have much experience in accounting. This is the only way I could make it work.

@dj12djdjs
Copy link
Collaborator Author

@deepeshgarg007 any update from the team on this matter?

@dj12djdjs
Copy link
Collaborator Author

@deepeshgarg007 Is there a time frame for this?

@OneiricIT
Copy link

@dj12djdjs does this have any relation to being able to pull credit note amounts sitting on account as payment method for other invoices?
Reference:
#28775

@dj12djdjs
Copy link
Collaborator Author

@dj12djdjs does this have any relation to being able to pull credit note amounts sitting on account as payment method for other invoices? Reference: #28775

@OneiricIT no, this PR is just about unallocated calculation method

@deepeshgarg007
Copy link
Member

Closing this since a new PR is raised for this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants