Skip to content

Commit

Permalink
refactor: continue backing out changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ericaltendorf committed Aug 23, 2024
1 parent 4a4c1ff commit 13a5bef
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions beancount/parser/booking_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from beancount.core.number import ZERO
from beancount.core.data import Booking
from beancount.core.amount import Amount
from beancount.core.position import Cost, Position
from beancount.core.position import Cost
from beancount.core import flags
from beancount.core import position
from beancount.core import inventory
Expand Down Expand Up @@ -299,28 +299,6 @@ def booking_method_AVERAGE(entry, posting, matches):
)
_insufficient = abs(posting.units.number) > abs(units.number)

def booking_method_HIFO_XFER_AWARE(entry, posting, matches):
# If there's no price, it's probably a transfer rather than a sale. The
# posting we get is the reduction (donating account).
#
# If the posting is on a wallet account, it's probably a transfer to a
# trading account in preparation for sale, so we would want to pick the
# lot with minimal tax liability.
#
# If the posting is on a trading account, then it's probably a transfer to a
# wallet and we want the inverse -- to stash away the lots least desirable
# to sell.
is_sale = posting.price is not None
sale_prep = "Wallet" in posting.account # Total hack
if is_sale:
return booking_method_HIFO(entry, posting, matches)
elif entry.date.year < 2022:
return booking_method_HIFO(entry, posting, matches)
elif sale_prep:
return booking_method_HIFO(entry, posting, matches)
else:
return booking_method_LowIFO(entry, posting, matches)

def booking_method_magicbeans_stub(entry, posting, matches):
"""Magicbeans booking method stub."""
raise NotImplementedError("Magicbeans booking method should be redefined by Magicbeans package")
Expand Down

0 comments on commit 13a5bef

Please sign in to comment.