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: update payment entry references #33274

Merged

Conversation

dj12djdjs
Copy link
Collaborator

Description

Before this PR the following code was executed before adding rows to the deductions table.

payment_entry.flags.ignore_validate_update_after_submit = True
payment_entry.setup_party_account_field()
payment_entry.set_missing_values()
payment_entry.set_amounts()

This PR modified the above statements to execute after adding rows to the deductions table.

Before PR

After payment reconciliation is done, difference amount remains in payment entry document.
image

After PR

The difference amount has been updated after payment reconciliation.
image

@codecov
Copy link

codecov bot commented Dec 28, 2022

Codecov Report

Merging #33274 (a57f3e4) into develop (cabaed9) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #33274      +/-   ##
===========================================
+ Coverage    64.07%   64.09%   +0.01%     
===========================================
  Files          818      818              
  Lines        58740    58740              
===========================================
+ Hits         37640    37648       +8     
+ Misses       21100    21092       -8     
Impacted Files Coverage Δ
erpnext/accounts/utils.py 75.10% <100.00%> (+0.85%) ⬆️
...xt/accounts/doctype/payment_entry/payment_entry.py 72.68% <0.00%> (+0.10%) ⬆️
...e/payment_reconciliation/payment_reconciliation.py 94.47% <0.00%> (+0.50%) ⬆️

…nt-entry-references

# Conflicts:
#	erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
#	erpnext/accounts/doctype/journal_entry/journal_entry.py
#	erpnext/accounts/doctype/payment_entry/payment_entry.json
#	erpnext/accounts/doctype/payment_entry/payment_entry.py
#	erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
#	erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
#	erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py
#	erpnext/accounts/doctype/payment_request/payment_request.js
#	erpnext/accounts/doctype/payment_request/payment_request.json
#	erpnext/accounts/doctype/payment_request/payment_request.py
#	erpnext/accounts/doctype/pricing_rule/utils.py
#	erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
#	erpnext/accounts/doctype/sales_invoice/sales_invoice.json
#	erpnext/accounts/doctype/subscription/subscription.py
#	erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
#	erpnext/accounts/report/accounts_receivable/accounts_receivable.py
#	erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
#	erpnext/accounts/report/cash_flow/cash_flow.py
#	erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
#	erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
#	erpnext/accounts/report/gross_profit/gross_profit.py
#	erpnext/accounts/report/gross_profit/test_gross_profit.py
#	erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.js
#	erpnext/accounts/report/tax_detail/tax_detail.py
#	erpnext/accounts/test/test_utils.py
#	erpnext/accounts/utils.py
#	erpnext/buying/doctype/purchase_order/purchase_order.js
#	erpnext/buying/doctype/purchase_order/purchase_order.json
#	erpnext/buying/doctype/purchase_order/purchase_order.py
#	erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
#	erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
#	erpnext/buying/doctype/supplier/supplier.py
#	erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
#	erpnext/controllers/buying_controller.py
#	erpnext/controllers/selling_controller.py
#	erpnext/controllers/status_updater.py
#	erpnext/crm/doctype/appointment/appointment.json
#	erpnext/crm/doctype/appointment/appointment.py
#	erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.json
#	erpnext/crm/doctype/lead/lead.py
#	erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.json
#	erpnext/erpnext_integrations/exotel_integration.py
#	erpnext/hooks.py
#	erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
#	erpnext/manufacturing/doctype/work_order/test_work_order.py
#	erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py
#	erpnext/patches.txt
#	erpnext/portal/utils.py
#	erpnext/projects/doctype/project/project.py
#	erpnext/projects/doctype/task/task.py
#	erpnext/public/js/controllers/taxes_and_totals.js
#	erpnext/public/js/controllers/transaction.js
#	erpnext/selling/doctype/customer/customer.py
#	erpnext/selling/doctype/quotation/quotation.json
#	erpnext/selling/doctype/quotation/test_quotation.py
#	erpnext/selling/doctype/sales_order/sales_order.json
#	erpnext/selling/doctype/sales_order/sales_order.py
#	erpnext/selling/doctype/sales_order/sales_order_dashboard.py
#	erpnext/selling/report/sales_order_analysis/sales_order_analysis.js
#	erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
#	erpnext/setup/doctype/company/company.py
#	erpnext/setup/doctype/customer_group/customer_group.json
#	erpnext/setup/doctype/supplier_group/supplier_group.json
#	erpnext/setup/doctype/territory/territory.json
#	erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
#	erpnext/stock/doctype/bin/bin.py
#	erpnext/stock/doctype/delivery_note/delivery_note.json
#	erpnext/stock/doctype/material_request/material_request.py
#	erpnext/stock/doctype/pick_list/pick_list.js
#	erpnext/stock/doctype/pick_list/pick_list.py
#	erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
#	erpnext/stock/doctype/serial_no/serial_no.py
#	erpnext/stock/doctype/stock_entry/stock_entry.js
#	erpnext/stock/doctype/stock_entry/stock_entry.py
#	erpnext/stock/doctype/stock_entry/test_stock_entry.py
#	erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
#	erpnext/stock/get_item_details.py
#	erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
#	erpnext/stock/stock_ledger.py
#	erpnext/support/doctype/issue/issue.py
#	erpnext/support/doctype/warranty_claim/warranty_claim.py
#	erpnext/translations/de.csv
#	erpnext/www/book_appointment/index.js
#	erpnext/www/book_appointment/index.py
#	erpnext/www/book_appointment/verify/index.py
)
for d in payment_reconciliation.invoices:
# Reset invoice outstanding_amount because allocate_entries will zero this value out.
d.outstanding_amount = d.amount
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to reset the outstanding_amount here because it will get set to zero here during allocate_entries()

This will then fail during the validate_allocation()

invoice_outstanding = unreconciled_invoices.get(row.invoice_type, {}).get(row.invoice_number)
if flt(row.allocated_amount) - invoice_outstanding > 0.009:
frappe.throw(
_(
"Row {0}: Allocated amount {1} must be less than or equal to invoice outstanding amount {2}"
).format(row.idx, row.allocated_amount, invoice_outstanding)
)

@deepeshgarg007 deepeshgarg007 merged commit 98c39c4 into frappe:develop Jan 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants