fix: reconciled credit notes being fetched again in Payment Reconciliation tool (#33471)
fix: reconciled cr note showing up as Payments
This commit is contained in:
@@ -172,22 +172,22 @@ class PaymentReconciliation(Document):
|
|||||||
query = (
|
query = (
|
||||||
qb.from_(gl)
|
qb.from_(gl)
|
||||||
.select(
|
.select(
|
||||||
gl.voucher_type.as_("reference_type"),
|
gl.against_voucher_type.as_("reference_type"),
|
||||||
gl.voucher_no.as_("reference_name"),
|
gl.against_voucher.as_("reference_name"),
|
||||||
(Sum(dr_or_cr) - Sum(reconciled_dr_or_cr)).as_("amount"),
|
(Sum(dr_or_cr) - Sum(reconciled_dr_or_cr)).as_("amount"),
|
||||||
gl.posting_date,
|
gl.posting_date,
|
||||||
gl.account_currency.as_("currency"),
|
gl.account_currency.as_("currency"),
|
||||||
)
|
)
|
||||||
.where(
|
.where(
|
||||||
(gl.voucher_type == voucher_type)
|
(gl.against_voucher.isin(sub_query))
|
||||||
& (gl.voucher_no.isin(sub_query))
|
& (gl.against_voucher_type == voucher_type)
|
||||||
& (gl.is_cancelled == 0)
|
& (gl.is_cancelled == 0)
|
||||||
& (gl.account == self.receivable_payable_account)
|
& (gl.account == self.receivable_payable_account)
|
||||||
& (gl.party_type == self.party_type)
|
& (gl.party_type == self.party_type)
|
||||||
& (gl.party == self.party)
|
& (gl.party == self.party)
|
||||||
)
|
)
|
||||||
.where(Criterion.all(conditions))
|
.where(Criterion.all(conditions))
|
||||||
.groupby(gl.voucher_no)
|
.groupby(gl.against_voucher)
|
||||||
.having(qb.Field("amount") > 0)
|
.having(qb.Field("amount") > 0)
|
||||||
)
|
)
|
||||||
dr_cr_notes = query.run(as_dict=True)
|
dr_cr_notes = query.run(as_dict=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user