Akaunting Skill
CLI and API integration for Akaunting, a free open-source accounting platform.
Quick Start
CODEBLOCK0
Setup
1. Deploy Akaunting
CODEBLOCK1
Access web UI at http://YOUR_IP:8080 and complete the setup wizard.
2. Apply Required Fix
Critical: Akaunting has a bug where module event listeners don't auto-register. Run:
CODEBLOCK2
Or manually add to /var/www/html/app/Providers/Event.php in the $listen array:
CODEBLOCK3
3. Configure Credentials
CODEBLOCK4
Or set environment variables: AKAUNTING_URL, AKAUNTING_EMAIL, INLINECODE5
CLI Commands
| Command | Description |
|---|
| INLINECODE6 | Test API connection |
| INLINECODE7 |
List bank accounts |
|
akaunting categories [--type income\|expense] | List categories |
|
akaunting transactions [--type income\|expense] | List transactions |
|
akaunting items | List products/services |
|
akaunting income --amount X --category Y | Create income |
|
akaunting expense --amount X --category Y | Create expense |
|
akaunting item --name X --price Y | Create item |
Add --json to any command for JSON output.
API Reference
See references/api.md for full endpoint documentation.
Key Endpoints
- -
GET /api/ping - Health check - INLINECODE17 - Bank accounts
- INLINECODE18 - Income/expense categories
- INLINECODE19 - Income/expense records
- INLINECODE20 - Products/services
Authentication: HTTP Basic Auth with user email/password. User needs read-api permission (Admin role has this by default).
Troubleshooting
"Payment method is invalid" error:
The event listener fix wasn't applied. Run fix_event_listener.py.
401 Unauthorized:
Check credentials in config.json. User must have API access permission.
403 Forbidden on contacts/documents:
User needs additional permissions for these endpoints.
Akaunting 技能
用于 Akaunting(一款免费开源会计平台)的 CLI 和 API 集成。
快速开始
bash
测试连接
akaunting ping
列出数据
akaunting accounts
akaunting categories
akaunting transactions
创建交易
akaunting income --amount 100 --category Sales --description 已收到付款
akaunting expense --amount 50 --category Other --description 办公用品
设置
1. 部署 Akaunting
bash
使用提供的 docker-compose
cp skills/akaunting/assets/docker-compose.yml ~/akaunting/
cd ~/akaunting && docker compose up -d
通过 http://YOUR_IP:8080 访问 Web 界面,并完成设置向导。
2. 应用必要修复
关键: Akaunting 存在一个 bug,导致模块事件监听器无法自动注册。运行:
bash
python3 skills/akaunting/scripts/fixeventlistener.py
或手动添加到 /var/www/html/app/Providers/Event.php 的 $listen 数组中:
php
App\Events\Module\PaymentMethodShowing => [
Modules\OfflinePayments\Listeners\ShowAsPaymentMethod,
],
3. 配置凭据
bash
mkdir -p ~/.config/akaunting
cat > ~/.config/akaunting/config.json << EOF
{
url: http://YOUR_IP:8080,
email: your@email.com,
password: your-password
}
EOF
或设置环境变量:AKAUNTINGURL、AKAUNTINGEMAIL、AKAUNTING_PASSWORD
CLI 命令
| 命令 | 描述 |
|---|
| akaunting ping | 测试 API 连接 |
| akaunting accounts |
列出银行账户 |
| akaunting categories [--type income\|expense] | 列出类别 |
| akaunting transactions [--type income\|expense] | 列出交易 |
| akaunting items | 列出产品/服务 |
| akaunting income --amount X --category Y | 创建收入 |
| akaunting expense --amount X --category Y | 创建支出 |
| akaunting item --name X --price Y | 创建项目 |
在任何命令后添加 --json 可获取 JSON 格式输出。
API 参考
完整端点文档请参见 references/api.md。
关键端点
- - GET /api/ping - 健康检查
- GET/POST /api/accounts - 银行账户
- GET/POST /api/categories - 收入/支出类别
- GET/POST /api/transactions - 收入/支出记录
- GET/POST /api/items - 产品/服务
认证方式:使用用户邮箱和密码的 HTTP 基本认证。用户需要 read-api 权限(管理员角色默认拥有此权限)。
故障排除
Payment method is invalid 错误:
未应用事件监听器修复。请运行 fixeventlistener.py。
401 未授权:
检查 config.json 中的凭据。用户必须拥有 API 访问权限。
联系人/文档的 403 禁止访问:
用户需要这些端点的额外权限。