Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +7 -1
- VERSION +1 -1
- api/odoo_relational.py +40 -5
- api/routes_odoo_tables.py +9 -0
RELEASES.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
{
|
| 5 |
"version": "v23",
|
| 6 |
"sha": "44cc283",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "v24 (514d829)",
|
| 3 |
"releases": [
|
| 4 |
+
{
|
| 5 |
+
"version": "v24",
|
| 6 |
+
"sha": "514d829",
|
| 7 |
+
"date": "2026-08-09",
|
| 8 |
+
"subject": "release v24"
|
| 9 |
+
},
|
| 10 |
{
|
| 11 |
"version": "v23",
|
| 12 |
"sha": "44cc283",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
v24 (514d829)
|
api/odoo_relational.py
CHANGED
|
@@ -383,6 +383,32 @@ def excluded_ids(cur, names=None):
|
|
| 383 |
return {int(pid) for pid, name in rows if str(name).strip().lower() in names}
|
| 384 |
|
| 385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 386 |
def _as_date(value):
|
| 387 |
"""ISO date string, or ''. The grid renders `date` cells itself (W26: `Aug 5, 2026`), so the
|
| 388 |
STORED value stays ISO β a formatted string in the cell is a value the filters cannot sort."""
|
|
@@ -447,8 +473,9 @@ def read_open_ar(cur, excluded=None):
|
|
| 447 |
def read_orders(cur, excluded=None):
|
| 448 |
"""[(row dict)] β confirmed sale orders, keyed on the `sale.order` id."""
|
| 449 |
excluded = excluded if excluded is not None else excluded_ids(cur)
|
| 450 |
-
|
| 451 |
-
|
|
|
|
| 452 |
f"FROM sale_order WHERE {_CONFIRMED} AND partner_id IS NOT NULL")
|
| 453 |
out = []
|
| 454 |
for r in cur.execute(sql).fetchall():
|
|
@@ -479,7 +506,9 @@ def read_products(cur):
|
|
| 479 |
grouped by `sales_lines.product` that has no parent row is a rollup value with nowhere to
|
| 480 |
land β silently. 119 extra rows is the whole cost of the claim being literally true.
|
| 481 |
"""
|
| 482 |
-
|
|
|
|
|
|
|
| 483 |
"FROM product_product")
|
| 484 |
out = []
|
| 485 |
for r in cur.execute(sql).fetchall():
|
|
@@ -511,9 +540,15 @@ def read_customers(cur, excluded=None):
|
|
| 511 |
out of the store in the first place.
|
| 512 |
"""
|
| 513 |
excluded = excluded if excluded is not None else excluded_ids(cur)
|
| 514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
"FROM res_partner p "
|
| 516 |
-
"
|
| 517 |
"WHERE p.id IN ("
|
| 518 |
f" SELECT partner_id FROM sale_order WHERE {_CONFIRMED} AND partner_id IS NOT NULL "
|
| 519 |
" UNION "
|
|
|
|
| 383 |
return {int(pid) for pid, name in rows if str(name).strip().lower() in names}
|
| 384 |
|
| 385 |
|
| 386 |
+
def columns(cur, table):
|
| 387 |
+
"""The column names a mirror table actually has, lowercased. `set()` if the table is absent.
|
| 388 |
+
|
| 389 |
+
β WHY THIS EXISTS, AND IT COST A LIVE 500. `harness.datastore.ready()` gates on ENTITY
|
| 390 |
+
phases, and a Space hydrates its mirror from `store_seed/royal.duckdb` β a SNAPSHOT. Columns
|
| 391 |
+
added to `ENTITIES` after that snapshot was taken (`res_partner.agent_id`,
|
| 392 |
+
`account_move_line.product_id`, β¦) are backfilled by `sync_all()` under their OWN `_sync_state`
|
| 393 |
+
keys, which `ready()` does not read. So there is a real window, right after a boot, where the
|
| 394 |
+
store reports READY and a column this module names does not exist yet β and DuckDB answers a
|
| 395 |
+
missing identifier with a Binder error, which reached the operator as a bare `500`.
|
| 396 |
+
β The absent columns are all DISPLAY ones (an agent name, a category, a team). Refusing the
|
| 397 |
+
whole spawn over a cosmetic column would be worse than the gap it is reporting, so the readers
|
| 398 |
+
degrade the COLUMN to blank and still write every id.
|
| 399 |
+
"""
|
| 400 |
+
try:
|
| 401 |
+
rows = cur.execute(f"SELECT * FROM {table} LIMIT 0")
|
| 402 |
+
return {str(d[0]).lower() for d in rows.description}
|
| 403 |
+
except Exception: # noqa: BLE001
|
| 404 |
+
return set()
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
def _col(have, name, default="NULL"):
|
| 408 |
+
"""`name` when the mirror has it, else a literal that keeps the SELECT's arity intact."""
|
| 409 |
+
return name if str(name).split(".")[-1].lower() in have else default
|
| 410 |
+
|
| 411 |
+
|
| 412 |
def _as_date(value):
|
| 413 |
"""ISO date string, or ''. The grid renders `date` cells itself (W26: `Aug 5, 2026`), so the
|
| 414 |
STORED value stays ISO β a formatted string in the cell is a value the filters cannot sort."""
|
|
|
|
| 473 |
def read_orders(cur, excluded=None):
|
| 474 |
"""[(row dict)] β confirmed sale orders, keyed on the `sale.order` id."""
|
| 475 |
excluded = excluded if excluded is not None else excluded_ids(cur)
|
| 476 |
+
have = columns(cur, "sale_order")
|
| 477 |
+
sql = (f"SELECT id, name, date_order, partner_id, partner_name, {_col(have, 'team_name')}, "
|
| 478 |
+
f" state, amount_untaxed, {_col(have, 'invoice_status')} "
|
| 479 |
f"FROM sale_order WHERE {_CONFIRMED} AND partner_id IS NOT NULL")
|
| 480 |
out = []
|
| 481 |
for r in cur.execute(sql).fetchall():
|
|
|
|
| 506 |
grouped by `sales_lines.product` that has no parent row is a rollup value with nowhere to
|
| 507 |
land β silently. 119 extra rows is the whole cost of the claim being literally true.
|
| 508 |
"""
|
| 509 |
+
have = columns(cur, "product_product")
|
| 510 |
+
sql = (f"SELECT id, default_code, name, {_col(have, 'categ_name')}, type, "
|
| 511 |
+
f" {_col(have, 'standard_price', '0')}, {_col(have, 'active', 'TRUE')} "
|
| 512 |
"FROM product_product")
|
| 513 |
out = []
|
| 514 |
for r in cur.execute(sql).fetchall():
|
|
|
|
| 540 |
out of the store in the first place.
|
| 541 |
"""
|
| 542 |
excluded = excluded if excluded is not None else excluded_ids(cur)
|
| 543 |
+
have = columns(cur, "res_partner")
|
| 544 |
+
# β THE AGENT JOIN IS DROPPED WHOLE when `agent_id` is absent, not merely NULL-ed: the join
|
| 545 |
+
# itself names the column, so `_col` on the SELECT list alone would still fail to bind.
|
| 546 |
+
agent = ("ag.name" if "agent_id" in have else "NULL")
|
| 547 |
+
join = ("LEFT JOIN res_partner ag ON ag.id = p.agent_id " if "agent_id" in have else "")
|
| 548 |
+
sql = (f"SELECT p.id, p.name, {_col(have, 'p.city')}, {_col(have, 'p.state_name')}, "
|
| 549 |
+
f" {_col(have, 'p.country_name')}, {agent} "
|
| 550 |
"FROM res_partner p "
|
| 551 |
+
f"{join}"
|
| 552 |
"WHERE p.id IN ("
|
| 553 |
f" SELECT partner_id FROM sale_order WHERE {_CONFIRMED} AND partner_id IS NOT NULL "
|
| 554 |
" UNION "
|
api/routes_odoo_tables.py
CHANGED
|
@@ -56,6 +56,15 @@ def refresh_odoo_tables(session: Session = Depends(require_session)):
|
|
| 56 |
# `datastore.ro_con()` raises this while the store is completing its first sync. Relaying
|
| 57 |
# it beats writing a partial table from a half-synced mirror.
|
| 58 |
raise err(503, "store_not_ready", str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
@router.get("/odoo-tables/status")
|
|
|
|
| 56 |
# `datastore.ro_con()` raises this while the store is completing its first sync. Relaying
|
| 57 |
# it beats writing a partial table from a half-synced mirror.
|
| 58 |
raise err(503, "store_not_ready", str(e))
|
| 59 |
+
except Exception as e: # noqa: BLE001
|
| 60 |
+
# β AN UNEXPECTED FAILURE MUST STILL SAY WHAT IT WAS. Measured live 2026-08-09: this
|
| 61 |
+
# route answered a bare `500` and the operator had no way to learn why β the reason lived
|
| 62 |
+
# only in a container log nobody can reach from the product. A spawn that rewrites four
|
| 63 |
+
# locked databases is exactly the operation whose failure needs a sentence.
|
| 64 |
+
# β The TYPE is included deliberately: `BinderException: Referenced column "agent_id" not
|
| 65 |
+
# found` is a different action (wait for the column backfill) from a timeout or an auth
|
| 66 |
+
# failure, and "500" cannot tell them apart.
|
| 67 |
+
raise err(500, "refresh_failed", f"{type(e).__name__}: {e}")
|
| 68 |
|
| 69 |
|
| 70 |
@router.get("/odoo-tables/status")
|