fix: Recalculate difference amount after setting deductions

This commit is contained in:
marination 2023-03-03 14:13:27 +05:30
parent 619824855a
commit 75ec0a0a85

View File

@ -1772,6 +1772,7 @@ def get_payment_entry(
discount_amount = set_early_payment_discount_loss(pe, doc, valid_discounts, discount_amount)
if discount_amount > 0:
# Set pending discount amount in deductions
pe.set_gain_or_loss(
account_details={
"account": frappe.get_cached_value("Company", pe.company, "default_discount_account"),
@ -1780,7 +1781,8 @@ def get_payment_entry(
"amount": discount_amount * (-1 if payment_type == "Pay" else 1),
}
)
pe.set_difference_amount()
pe.set_difference_amount()
return pe