Updates asset account names for consistency
Ensures that default and specified account names for cash, bank transfers, and checks align with the correct asset account structure.
This commit is contained in:
parent
e2472d13a2
commit
4957826c49
1 changed files with 10 additions and 10 deletions
20
views_api.py
20
views_api.py
|
|
@ -800,15 +800,15 @@ async def api_settle_receivable(
|
||||||
|
|
||||||
# Get the appropriate asset account based on payment method
|
# Get the appropriate asset account based on payment method
|
||||||
payment_account_map = {
|
payment_account_map = {
|
||||||
"cash": "Cash",
|
"cash": "Assets:Cash",
|
||||||
"bank_transfer": "Bank Account",
|
"bank_transfer": "Assets:Bank",
|
||||||
"check": "Bank Account",
|
"check": "Assets:Bank",
|
||||||
"lightning": "Assets:Bitcoin:Lightning",
|
"lightning": "Assets:Bitcoin:Lightning",
|
||||||
"btc_onchain": "Assets:Bitcoin:OnChain",
|
"btc_onchain": "Assets:Bitcoin:OnChain",
|
||||||
"other": "Cash"
|
"other": "Assets:Cash"
|
||||||
}
|
}
|
||||||
|
|
||||||
account_name = payment_account_map.get(data.payment_method.lower(), "Cash")
|
account_name = payment_account_map.get(data.payment_method.lower(), "Assets:Cash")
|
||||||
payment_account = await get_account_by_name(account_name)
|
payment_account = await get_account_by_name(account_name)
|
||||||
|
|
||||||
# If account doesn't exist, try to find or create a generic one
|
# If account doesn't exist, try to find or create a generic one
|
||||||
|
|
@ -948,15 +948,15 @@ async def api_pay_user(
|
||||||
|
|
||||||
# Get the appropriate asset account based on payment method
|
# Get the appropriate asset account based on payment method
|
||||||
payment_account_map = {
|
payment_account_map = {
|
||||||
"cash": "Cash",
|
"cash": "Assets:Cash",
|
||||||
"bank_transfer": "Bank Account",
|
"bank_transfer": "Assets:Bank",
|
||||||
"check": "Bank Account",
|
"check": "Assets:Bank",
|
||||||
"lightning": "Assets:Bitcoin:Lightning",
|
"lightning": "Assets:Bitcoin:Lightning",
|
||||||
"btc_onchain": "Assets:Bitcoin:OnChain",
|
"btc_onchain": "Assets:Bitcoin:OnChain",
|
||||||
"other": "Cash"
|
"other": "Assets:Cash"
|
||||||
}
|
}
|
||||||
|
|
||||||
account_name = payment_account_map.get(data.payment_method.lower(), "Cash")
|
account_name = payment_account_map.get(data.payment_method.lower(), "Assets:Cash")
|
||||||
payment_account = await get_account_by_name(account_name)
|
payment_account = await get_account_by_name(account_name)
|
||||||
|
|
||||||
if not payment_account:
|
if not payment_account:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue