fix: Recalculate difference amount after setting deductions
This commit is contained in:
parent
619824855a
commit
75ec0a0a85
@ -1772,6 +1772,7 @@ def get_payment_entry(
|
|||||||
|
|
||||||
discount_amount = set_early_payment_discount_loss(pe, doc, valid_discounts, discount_amount)
|
discount_amount = set_early_payment_discount_loss(pe, doc, valid_discounts, discount_amount)
|
||||||
if discount_amount > 0:
|
if discount_amount > 0:
|
||||||
|
# Set pending discount amount in deductions
|
||||||
pe.set_gain_or_loss(
|
pe.set_gain_or_loss(
|
||||||
account_details={
|
account_details={
|
||||||
"account": frappe.get_cached_value("Company", pe.company, "default_discount_account"),
|
"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),
|
"amount": discount_amount * (-1 if payment_type == "Pay" else 1),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
pe.set_difference_amount()
|
|
||||||
|
pe.set_difference_amount()
|
||||||
|
|
||||||
return pe
|
return pe
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user