Aplikasi catat jual-beli saham: Odoo 17 + Postgres 16 + addon saat_invest

- docker-compose.yml: odoo:17.0 (port 8069) + postgres:16 (internal, no publish)
- Addon saat_invest: model saat.saham / saat.transaksi / saat.portofolio
  - P/L computed (realized FIFO, unrealized dari harga_sekarang)
  - action_recalculate() endpoint untuk Flutter
  - seed 5 saham IDX (BBRI, TLKM, BBCA, ASII, PTBA)
- JSON-RPC end-to-end terverifikasi: create beli/jual -> recalculate -> portfolio
  (avg_cost 4525, realized 65000, unrealized 220000, nilai 3840000)
- PLAN.md: rancangan disetujui Bozz
- Login Odoo admin/admin (ganti password master di .env, jangan commit)
This commit is contained in:
2026-09-02 11:23:39 +07:00
commit d657a0a8f0
19 changed files with 608 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class SaatSaham(models.Model):
"""Master daftar saham / emiten yang dicatat."""
_name = 'saat.saham'
_description = "Saham / Emiten"
_order = 'name'
name = fields.Char(string="Kode Saham (Ticker)", required=True)
perusahaan = fields.Char(string="Nama Perusahaan / Emiten")
bursa = fields.Char(string="Bursa", default="IDX")
sector = fields.Char(string="Sektor")
active = fields.Boolean(string="Aktif", default=True)
# o2m convenience menampilkan semua transaksi saham ini
transaksi_ids = fields.One2many('saat.transaksi', 'saham_id', string="Transaksi")
_sql_constraints = [
('saham_uniq', 'unique(name)', "Kode saham sudah terdaftar."),
]