Corrected the definition of the "is_offset" property in the "__get_line_items" method of the OffsetMatcher class.

This commit is contained in:
依瑪貓 2023-04-30 06:38:01 +08:00
parent f29cb00aec
commit 1daed940b6

View File

@ -123,15 +123,15 @@ class OffsetMatcher:
.options(selectinload(JournalEntryLineItem.currency), .options(selectinload(JournalEntryLineItem.currency),
selectinload(JournalEntryLineItem.journal_entry)).all() selectinload(JournalEntryLineItem.journal_entry)).all()
for line_item in self.line_items: for line_item in self.line_items:
line_item.is_offset = line_item.id in net_balances line_item.is_offset = line_item.id not in net_balances
self.unapplied = [x for x in self.line_items self.unapplied = [x for x in self.line_items
if x.is_offset] if not x.is_offset]
for line_item in self.unapplied: for line_item in self.unapplied:
line_item.net_balance = line_item.amount \ line_item.net_balance = line_item.amount \
if net_balances[line_item.id] is None \ if net_balances[line_item.id] is None \
else net_balances[line_item.id] else net_balances[line_item.id]
self.unmatched = [x for x in self.line_items self.unmatched = [x for x in self.line_items
if not x.is_offset] if x.is_offset]
self.__populate_accumulated_balances() self.__populate_accumulated_balances()
def __populate_accumulated_balances(self) -> None: def __populate_accumulated_balances(self) -> None: