mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 23:48:38 +00:00
fix: reflect in-invoice receivable settlements in Sales Register ledger view
(cherry picked from commit 40c356d166)
This commit is contained in:
@@ -160,7 +160,8 @@ def _execute(filters, additional_table_columns=None):
|
|||||||
row.update(
|
row.update(
|
||||||
{
|
{
|
||||||
"debit": inv.base_grand_total,
|
"debit": inv.base_grand_total,
|
||||||
"credit": 0.0,
|
# credits the invoice itself posts to the receivable (mirrors its GL)
|
||||||
|
"credit": get_in_invoice_receivable_credit(inv),
|
||||||
"outstanding_amount": flt(
|
"outstanding_amount": flt(
|
||||||
(inv.outstanding_amount * (inv.conversion_rate or 1)), outstanding_precision
|
(inv.outstanding_amount * (inv.conversion_rate or 1)), outstanding_precision
|
||||||
),
|
),
|
||||||
@@ -181,6 +182,14 @@ def _execute(filters, additional_table_columns=None):
|
|||||||
return columns, res, None, None, None, include_payments
|
return columns, res, None, None, None, include_payments
|
||||||
|
|
||||||
|
|
||||||
|
def get_in_invoice_receivable_credit(inv):
|
||||||
|
# amount the invoice settles against its own receivable, matching the invoice's GL entries
|
||||||
|
credit = flt(inv.loyalty_amount) # loyalty redemption, POS or not
|
||||||
|
if inv.is_pos: # POS payments and write-off credit the receivable only on POS invoices
|
||||||
|
credit += flt(inv.base_paid_amount) - flt(inv.base_change_amount) + flt(inv.base_write_off_amount)
|
||||||
|
return credit
|
||||||
|
|
||||||
|
|
||||||
def get_columns(invoice_list, additional_table_columns, include_payments=False):
|
def get_columns(invoice_list, additional_table_columns, include_payments=False):
|
||||||
"""return columns based on filters"""
|
"""return columns based on filters"""
|
||||||
columns = [
|
columns = [
|
||||||
@@ -447,6 +456,11 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
si.base_net_total,
|
si.base_net_total,
|
||||||
si.base_grand_total,
|
si.base_grand_total,
|
||||||
si.base_rounded_total,
|
si.base_rounded_total,
|
||||||
|
si.is_pos,
|
||||||
|
si.base_paid_amount,
|
||||||
|
si.base_change_amount,
|
||||||
|
si.base_write_off_amount,
|
||||||
|
si.loyalty_amount,
|
||||||
si.outstanding_amount,
|
si.outstanding_amount,
|
||||||
si.is_internal_customer,
|
si.is_internal_customer,
|
||||||
si.represents_company,
|
si.represents_company,
|
||||||
|
|||||||
Reference in New Issue
Block a user