Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: incorrect cost_center in ar/ap #43174

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ def init_voucher_balance(self):
# get the balance object for voucher_type

if self.filters.get("ignore_accounts"):
key = (ple.voucher_type, ple.voucher_no, ple.party)
key = (ple.voucher_type, ple.voucher_no, ple.party, ple.cost_center)
else:
key = (ple.account, ple.voucher_type, ple.voucher_no, ple.party)
key = (ple.account, ple.voucher_type, ple.voucher_no, ple.party, ple.cost_center)

if key not in self.voucher_balance:
self.voucher_balance[key] = self.build_voucher_dict(ple)
Expand Down Expand Up @@ -194,9 +194,9 @@ def get_voucher_balance(self, ple):
return

if self.filters.get("ignore_accounts"):
key = (ple.against_voucher_type, ple.against_voucher_no, ple.party)
key = (ple.against_voucher_type, ple.against_voucher_no, ple.party, ple.cost_center)
else:
key = (ple.account, ple.against_voucher_type, ple.against_voucher_no, ple.party)
key = (ple.account, ple.against_voucher_type, ple.against_voucher_no, ple.party, ple.cost_center)

# If payment is made against credit note
# and credit note is made against a Sales Invoice
Expand All @@ -206,9 +206,15 @@ def get_voucher_balance(self, ple):
return_against = self.return_entries.get(ple.against_voucher_no)
if return_against:
if self.filters.get("ignore_accounts"):
key = (ple.against_voucher_type, return_against, ple.party)
key = (ple.against_voucher_type, return_against, ple.party, ple.cost_center)
else:
key = (ple.account, ple.against_voucher_type, return_against, ple.party)
key = (
ple.account,
ple.against_voucher_type,
return_against,
ple.party,
ple.cost_center,
)

row = self.voucher_balance.get(key)

Expand All @@ -227,9 +233,11 @@ def get_voucher_balance(self, ple):
if not row:
# no invoice, this is an invoice / stand-alone payment / credit note
if self.filters.get("ignore_accounts"):
row = self.voucher_balance.get((ple.voucher_type, ple.voucher_no, ple.party))
row = self.voucher_balance.get((ple.voucher_type, ple.voucher_no, ple.party, ple.cost_center))
else:
row = self.voucher_balance.get((ple.account, ple.voucher_type, ple.voucher_no, ple.party))
row = self.voucher_balance.get(
(ple.account, ple.voucher_type, ple.voucher_no, ple.party, ple.cost_center)
)

row.party_type = ple.party_type
return row
Expand Down
Loading