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

Credit/debit sign #124

Closed
Chrismarsh opened this issue Jul 1, 2024 · 2 comments
Closed

Credit/debit sign #124

Chrismarsh opened this issue Jul 1, 2024 · 2 comments
Labels
triage This will looked at

Comments

@Chrismarsh
Copy link

  • lunchable version: 1.3.3
  • Python version: 3.10.12
  • Operating System: Windows 11 WSL2

Description

Negative amount values in a transaction are converted to positive values in the lunchmoney webui

What I Did


# set API
# set asset_id

tx_dict={}
tx_dict['date'] = '2024-06-30'
tx_dict['amount'] = '60'
tx_dict['category'] = 'Groceries'
tx_dict['payee'] = 'sobeys2'
tx_dict['type'] = 'debit'
user_category = get_lunchmoney_categories()

new_transaction = lmtrans.TransactionInsertObject(
    date= tx_dict['date'],
    amount= float(tx_dict['amount']),
    category_id= user_category[tx_dict['category']],
    notes= None,
    payee= tx_dict['payee'],
    type = tx_dict['type'],
    asset_id = my_asset_id,
    status="cleared"
)
# tx.append(new_transaction)
lunchmoney.insert_transactions(transactions=[new_transaction], skip_duplicates=True)

If tx_dict['amount'] = '60', then this is shown as negative in the lunchmoney webui
If tx_dict['amount'] = '-60' then this is shown as psitive in the lunchmoney webui

@github-actions github-actions bot added the triage This will looked at label Jul 1, 2024
@juftin
Copy link
Owner

juftin commented Jul 1, 2024

Hey @Chrismarsh, lunchable simply sends the data to the Lunch Money developer API - I think you're describing the default behavior of the API treatment of negative/positive values as credits/expenses?

You should check out the debit_as_negative parameter of the insert_transactions method if you want to change the behavior. 

If true, will assume negative amount values denote expenses and positive amount values denote credits. Defaults to false.

https://juftin.com/lunchable/reference/models/transactions/#lunchable.models.transactions.TransactionsClient.insert_transactions

https://lunchmoney.dev/#insert-transactions

@juftin
Copy link
Owner

juftin commented Jul 19, 2024

I'm closing this issue for now - if you think this is an actual product with lunchable's implementation of the LunchMoney developer API please feel free to follow up and re-open this issue.

@juftin juftin closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage This will looked at
Projects
None yet
Development

No branches or pull requests

2 participants