|
@ -5,7 +5,6 @@ |
|
|
import frappe |
|
|
import frappe |
|
|
from frappe import _, scrub |
|
|
from frappe import _, scrub |
|
|
from frappe.utils import getdate, nowdate |
|
|
from frappe.utils import getdate, nowdate |
|
|
from six import iteritems, itervalues |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PartyLedgerSummaryReport(object): |
|
|
class PartyLedgerSummaryReport(object): |
|
@ -143,9 +142,9 @@ class PartyLedgerSummaryReport(object): |
|
|
self.party_data[gle.party].paid_amount -= amount |
|
|
self.party_data[gle.party].paid_amount -= amount |
|
|
|
|
|
|
|
|
out = [] |
|
|
out = [] |
|
|
for party, row in iteritems(self.party_data): |
|
|
for party, row in self.party_data.items(): |
|
|
if row.opening_balance or row.invoiced_amount or row.paid_amount or row.return_amount or row.closing_amount: |
|
|
if row.opening_balance or row.invoiced_amount or row.paid_amount or row.return_amount or row.closing_amount: |
|
|
total_party_adjustment = sum(amount for amount in itervalues(self.party_adjustment_details.get(party, {}))) |
|
|
total_party_adjustment = sum(amount for amount in self.party_adjustment_details.get(party, {}).values()) |
|
|
row.paid_amount -= total_party_adjustment |
|
|
row.paid_amount -= total_party_adjustment |
|
|
|
|
|
|
|
|
adjustments = self.party_adjustment_details.get(party, {}) |
|
|
adjustments = self.party_adjustment_details.get(party, {}) |
|
@ -267,7 +266,7 @@ class PartyLedgerSummaryReport(object): |
|
|
adjustment_voucher_entries.setdefault((gle.voucher_type, gle.voucher_no), []) |
|
|
adjustment_voucher_entries.setdefault((gle.voucher_type, gle.voucher_no), []) |
|
|
adjustment_voucher_entries[(gle.voucher_type, gle.voucher_no)].append(gle) |
|
|
adjustment_voucher_entries[(gle.voucher_type, gle.voucher_no)].append(gle) |
|
|
|
|
|
|
|
|
for voucher_gl_entries in itervalues(adjustment_voucher_entries): |
|
|
for voucher_gl_entries in adjustment_voucher_entries.values(): |
|
|
parties = {} |
|
|
parties = {} |
|
|
accounts = {} |
|
|
accounts = {} |
|
|
has_irrelevant_entry = False |
|
|
has_irrelevant_entry = False |
|
@ -287,7 +286,7 @@ class PartyLedgerSummaryReport(object): |
|
|
if parties and accounts: |
|
|
if parties and accounts: |
|
|
if len(parties) == 1: |
|
|
if len(parties) == 1: |
|
|
party = list(parties.keys())[0] |
|
|
party = list(parties.keys())[0] |
|
|
for account, amount in iteritems(accounts): |
|
|
for account, amount in accounts.items(): |
|
|
self.party_adjustment_accounts.add(account) |
|
|
self.party_adjustment_accounts.add(account) |
|
|
self.party_adjustment_details.setdefault(party, {}) |
|
|
self.party_adjustment_details.setdefault(party, {}) |
|
|
self.party_adjustment_details[party].setdefault(account, 0) |
|
|
self.party_adjustment_details[party].setdefault(account, 0) |
|
@ -295,7 +294,7 @@ class PartyLedgerSummaryReport(object): |
|
|
elif len(accounts) == 1 and not has_irrelevant_entry: |
|
|
elif len(accounts) == 1 and not has_irrelevant_entry: |
|
|
account = list(accounts.keys())[0] |
|
|
account = list(accounts.keys())[0] |
|
|
self.party_adjustment_accounts.add(account) |
|
|
self.party_adjustment_accounts.add(account) |
|
|
for party, amount in iteritems(parties): |
|
|
for party, amount in parties.items(): |
|
|
self.party_adjustment_details.setdefault(party, {}) |
|
|
self.party_adjustment_details.setdefault(party, {}) |
|
|
self.party_adjustment_details[party].setdefault(account, 0) |
|
|
self.party_adjustment_details[party].setdefault(account, 0) |
|
|
self.party_adjustment_details[party][account] += amount |
|
|
self.party_adjustment_details[party][account] += amount |
|
|