Merge pull request #38844 from frappe/mergify/bp/version-15-hotfix/pr-38797
fix: wrong paid and cn amount on pos invoice (backport #38797)
This commit is contained in:
commit
637343f751
@ -242,6 +242,10 @@ class ReceivablePayableReport(object):
|
|||||||
row.invoiced_in_account_currency += amount_in_account_currency
|
row.invoiced_in_account_currency += amount_in_account_currency
|
||||||
else:
|
else:
|
||||||
if self.is_invoice(ple):
|
if self.is_invoice(ple):
|
||||||
|
if row.voucher_no == ple.voucher_no == ple.against_voucher_no:
|
||||||
|
row.paid -= amount
|
||||||
|
row.paid_in_account_currency -= amount_in_account_currency
|
||||||
|
else:
|
||||||
row.credit_note -= amount
|
row.credit_note -= amount
|
||||||
row.credit_note_in_account_currency -= amount_in_account_currency
|
row.credit_note_in_account_currency -= amount_in_account_currency
|
||||||
else:
|
else:
|
||||||
|
@ -76,6 +76,41 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
|
|||||||
|
|
||||||
return credit_note
|
return credit_note
|
||||||
|
|
||||||
|
def test_pos_receivable(self):
|
||||||
|
filters = {
|
||||||
|
"company": self.company,
|
||||||
|
"party_type": "Customer",
|
||||||
|
"party": [self.customer],
|
||||||
|
"report_date": add_days(today(), 2),
|
||||||
|
"based_on_payment_terms": 0,
|
||||||
|
"range1": 30,
|
||||||
|
"range2": 60,
|
||||||
|
"range3": 90,
|
||||||
|
"range4": 120,
|
||||||
|
"show_remarks": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
pos_inv = self.create_sales_invoice(no_payment_schedule=True, do_not_submit=True)
|
||||||
|
pos_inv.posting_date = add_days(today(), 2)
|
||||||
|
pos_inv.is_pos = 1
|
||||||
|
pos_inv.append(
|
||||||
|
"payments",
|
||||||
|
frappe._dict(
|
||||||
|
mode_of_payment="Cash",
|
||||||
|
amount=flt(pos_inv.grand_total / 2),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
pos_inv.disable_rounded_total = 1
|
||||||
|
pos_inv.save()
|
||||||
|
pos_inv.submit()
|
||||||
|
|
||||||
|
report = execute(filters)
|
||||||
|
expected_data = [[pos_inv.grand_total, pos_inv.paid_amount, 0]]
|
||||||
|
|
||||||
|
row = report[1][-1]
|
||||||
|
self.assertEqual(expected_data[0], [row.invoiced, row.paid, row.credit_note])
|
||||||
|
pos_inv.cancel()
|
||||||
|
|
||||||
def test_accounts_receivable(self):
|
def test_accounts_receivable(self):
|
||||||
filters = {
|
filters = {
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user