mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-01 20:48:27 +00:00
fix: payment reco for jv with negative dr or cr amount
(cherry picked from commit fee79b9445)
This commit is contained in:
@@ -211,12 +211,14 @@ class PaymentReconciliation(Document):
|
|||||||
if self.get("cost_center"):
|
if self.get("cost_center"):
|
||||||
conditions.append(jea.cost_center == self.cost_center)
|
conditions.append(jea.cost_center == self.cost_center)
|
||||||
|
|
||||||
dr_or_cr = (
|
account_type = erpnext.get_party_account_type(self.party_type)
|
||||||
"credit_in_account_currency"
|
|
||||||
if erpnext.get_party_account_type(self.party_type) == "Receivable"
|
if account_type == "Receivable":
|
||||||
else "debit_in_account_currency"
|
dr_or_cr = jea.credit_in_account_currency - jea.debit_in_account_currency
|
||||||
)
|
elif account_type == "Payable":
|
||||||
conditions.append(jea[dr_or_cr].gt(0))
|
dr_or_cr = jea.debit_in_account_currency - jea.credit_in_account_currency
|
||||||
|
|
||||||
|
conditions.append(dr_or_cr.gt(0))
|
||||||
|
|
||||||
if self.bank_cash_account:
|
if self.bank_cash_account:
|
||||||
conditions.append(jea.against_account.like(f"%%{self.bank_cash_account}%%"))
|
conditions.append(jea.against_account.like(f"%%{self.bank_cash_account}%%"))
|
||||||
@@ -231,7 +233,7 @@ class PaymentReconciliation(Document):
|
|||||||
je.posting_date,
|
je.posting_date,
|
||||||
je.remark.as_("remarks"),
|
je.remark.as_("remarks"),
|
||||||
jea.name.as_("reference_row"),
|
jea.name.as_("reference_row"),
|
||||||
jea[dr_or_cr].as_("amount"),
|
dr_or_cr.as_("amount"),
|
||||||
jea.is_advance,
|
jea.is_advance,
|
||||||
jea.exchange_rate,
|
jea.exchange_rate,
|
||||||
jea.account_currency.as_("currency"),
|
jea.account_currency.as_("currency"),
|
||||||
|
|||||||
@@ -630,6 +630,16 @@ def update_reference_in_journal_entry(d, journal_entry, do_not_save=False):
|
|||||||
if jv_detail.get("reference_type") in ["Sales Order", "Purchase Order"]:
|
if jv_detail.get("reference_type") in ["Sales Order", "Purchase Order"]:
|
||||||
update_advance_paid.append((jv_detail.reference_type, jv_detail.reference_name))
|
update_advance_paid.append((jv_detail.reference_type, jv_detail.reference_name))
|
||||||
|
|
||||||
|
rev_dr_or_cr = (
|
||||||
|
"debit_in_account_currency"
|
||||||
|
if d["dr_or_cr"] == "credit_in_account_currency"
|
||||||
|
else "credit_in_account_currency"
|
||||||
|
)
|
||||||
|
if jv_detail.get(rev_dr_or_cr):
|
||||||
|
d["dr_or_cr"] = rev_dr_or_cr
|
||||||
|
d["allocated_amount"] = d["allocated_amount"] * -1
|
||||||
|
d["unadjusted_amount"] = d["unadjusted_amount"] * -1
|
||||||
|
|
||||||
if flt(d["unadjusted_amount"]) - flt(d["allocated_amount"]) != 0:
|
if flt(d["unadjusted_amount"]) - flt(d["allocated_amount"]) != 0:
|
||||||
# adjust the unreconciled balance
|
# adjust the unreconciled balance
|
||||||
amount_in_account_currency = flt(d["unadjusted_amount"]) - flt(d["allocated_amount"])
|
amount_in_account_currency = flt(d["unadjusted_amount"]) - flt(d["allocated_amount"])
|
||||||
|
|||||||
Reference in New Issue
Block a user