Deploy AIOS web (React glide grid + FastAPI slice)
Browse files
royalimports_os/modules/product_data.py
CHANGED
|
@@ -53,6 +53,18 @@ import modules.products as products
|
|
| 53 |
CONSOLIDATED_ONLY = ("on_hand", "unit_cost", "inv_value", "qty_ltm", "dos", "stock_bucket",
|
| 54 |
"cover_gap_d", "buy_now")
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
#: Wave 17 (owner item 13, ruling R3) β the SUPPLIER MASTER, from the curated mastersheet map
|
| 57 |
#: `procurement_suppliers.json` (3,963 SKUs; supplier on 3,624, lead time on 3,563). NOT Odoo:
|
| 58 |
#: the owner confirmed this data came from the Inventory System Mastersheet, which is why
|
|
|
|
| 53 |
CONSOLIDATED_ONLY = ("on_hand", "unit_cost", "inv_value", "qty_ltm", "dos", "stock_bucket",
|
| 54 |
"cover_gap_d", "buy_now")
|
| 55 |
|
| 56 |
+
#: β POOL-ROW KEYS THAT DELIBERATELY HAVE NO FIELD β they must never reach a browser.
|
| 57 |
+
#:
|
| 58 |
+
#: `rows_from_pool` projects strictly through the field contract, so "no Field" already means
|
| 59 |
+
#: "no cell on the wire". This tuple makes that a CHECKED fact rather than a consequence nobody
|
| 60 |
+
#: is watching: `verify_perm_scope` asserts every member is absent from BOTH product contracts,
|
| 61 |
+
#: and that every OTHER `CONSOLIDATED_ONLY` key is present in the consolidated one.
|
| 62 |
+
#:
|
| 63 |
+
#: Written because the two tuples silently diverged the moment owner item 5 retired `buy_now`'s
|
| 64 |
+
#: Field while keeping its computation, and the gate β which was asserting a FIELD property from
|
| 65 |
+
#: a ROW-key list β went red with no way to tell a deliberate divergence from a dropped column.
|
| 66 |
+
UNSHIPPED_ROW_KEYS = ("buy_now",)
|
| 67 |
+
|
| 68 |
#: Wave 17 (owner item 13, ruling R3) β the SUPPLIER MASTER, from the curated mastersheet map
|
| 69 |
#: `procurement_suppliers.json` (3,963 SKUs; supplier on 3,624, lead time on 3,563). NOT Odoo:
|
| 70 |
#: the owner confirmed this data came from the Inventory System Mastersheet, which is why
|
web/dist-embed/index.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
web/src/customer-grid/cells.ts
CHANGED
|
@@ -38,8 +38,8 @@ import { STATUS_BUBBLE } from "./theme";
|
|
| 38 |
// another. C-AVATAR names choiceColors' as the avatar fallback's source, so the two stay
|
| 39 |
// distinguishable at the call site rather than one silently shadowing the other.
|
| 40 |
import { optionTint, pickTint as choicePickTint } from "./choiceColors";
|
| 41 |
-
import { avatarInitials, avatarSize, checkboxOn, dateTimeText, num, numberText,
|
| 42 |
-
from "./display";
|
| 43 |
import type { CellValue, UserCellData } from "./display";
|
| 44 |
|
| 45 |
// Wave-7 (item W2): the pure display-string half moved to display.ts so the
|
|
@@ -293,8 +293,14 @@ export function makeCell(
|
|
| 293 |
// CustomerGrid's computedRows. Read-only by nature β the caller passes editable=false.
|
| 294 |
// 2026-07-31 (owner item 2): a formula may now return TEXT (CONCATENATE, &, TEXT(),
|
| 295 |
// TRUE/FALSE) β a non-numeric result renders as a text cell, never as NaN.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
const asNum = num(v);
|
| 297 |
-
if (!blank &&
|
| 298 |
return {
|
| 299 |
kind: GridCellKind.Text,
|
| 300 |
data: v,
|
|
|
|
| 38 |
// another. C-AVATAR names choiceColors' as the avatar fallback's source, so the two stay
|
| 39 |
// distinguishable at the call site rather than one silently shadowing the other.
|
| 40 |
import { optionTint, pickTint as choicePickTint } from "./choiceColors";
|
| 41 |
+
import { avatarInitials, avatarSize, checkboxOn, dateTimeText, formulaIsText, num, numberText,
|
| 42 |
+
userCellPayload } from "./display";
|
| 43 |
import type { CellValue, UserCellData } from "./display";
|
| 44 |
|
| 45 |
// Wave-7 (item W2): the pure display-string half moved to display.ts so the
|
|
|
|
| 293 |
// CustomerGrid's computedRows. Read-only by nature β the caller passes editable=false.
|
| 294 |
// 2026-07-31 (owner item 2): a formula may now return TEXT (CONCATENATE, &, TEXT(),
|
| 295 |
// TRUE/FALSE) β a non-numeric result renders as a text cell, never as NaN.
|
| 296 |
+
//
|
| 297 |
+
// β THE TEST WAS `!Number.isFinite(num(v))` AND IT NEVER FIRED. `num()` returns 0 for
|
| 298 |
+
// anything non-finite, so that read `Number.isFinite(0)` β always true β and every text
|
| 299 |
+
// formula printed as `0` here and in `formatDisplay`, which held its own copy of the same
|
| 300 |
+
// broken test. `formulaIsText` is now the ONE test, asked of the RAW value, shared by both
|
| 301 |
+
// renderers precisely because two copies is how they drifted. See its note in display.ts.
|
| 302 |
const asNum = num(v);
|
| 303 |
+
if (!blank && formulaIsText(v)) {
|
| 304 |
return {
|
| 305 |
kind: GridCellKind.Text,
|
| 306 |
data: v,
|
web/src/customer-grid/display.ts
CHANGED
|
@@ -80,6 +80,31 @@ export function num(v: CellValue): number {
|
|
| 80 |
return Number.isFinite(n) ? n : 0;
|
| 81 |
}
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
/** A checkbox cell's boolean, out of the overlay's '1'-or-empty contract. */
|
| 84 |
export function checkboxOn(v: CellValue | boolean): boolean {
|
| 85 |
return v === "1" || v === 1 || v === true;
|
|
@@ -156,8 +181,22 @@ export function formatDisplay(field: Field, v: CellValue): string {
|
|
| 156 |
switch (field.type) {
|
| 157 |
case "currency":
|
| 158 |
return v == null || v === "" ? "" : "$" + numberText(num(v), field.format);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
case "int":
|
| 160 |
-
case "formula":
|
| 161 |
return v == null || v === "" ? "" : numberText(num(v), field.format);
|
| 162 |
case "pct":
|
| 163 |
return v == null || v === "" ? "" : num(v).toFixed(1) + "%";
|
|
|
|
| 80 |
return Number.isFinite(n) ? n : 0;
|
| 81 |
}
|
| 82 |
|
| 83 |
+
/**
|
| 84 |
+
* β IS THIS FORMULA RESULT TEXT? β and it must be asked of the RAW value.
|
| 85 |
+
*
|
| 86 |
+
* A formula may return text since 2026-07-31 (owner item 2: CONCATENATE, `&`, TEXT(),
|
| 87 |
+
* TRUE/FALSE, and any `IF(cond, "yes", "no")`). Both renderers tried to detect that with
|
| 88 |
+
* `!Number.isFinite(num(v))` β and `num()` above returns **0** for anything non-finite, so the
|
| 89 |
+
* test was `Number.isFinite(0)`, which is always true. The text branch therefore never ran in
|
| 90 |
+
* EITHER renderer, and every text-returning formula printed as `0`: on the canvas, in the list,
|
| 91 |
+
* on kanban cards, in the record panel and in all four export formats.
|
| 92 |
+
*
|
| 93 |
+
* The feature had never worked. It surfaced by rendering the owner's own Buy signal formula
|
| 94 |
+
* through the shipped bundle rather than by asking whether the code looked right.
|
| 95 |
+
*
|
| 96 |
+
* ONE function, exported, called by both `formatDisplay` and `makeCell` β they are meant to be
|
| 97 |
+
* one rendering, and the way they drifted was each holding its own copy of this test.
|
| 98 |
+
* `Number("")` is 0, so the empty case is excluded explicitly rather than relied upon.
|
| 99 |
+
*
|
| 100 |
+
* A TYPE PREDICATE, not a bare boolean: `makeCell` builds a `TextCell` from the value straight
|
| 101 |
+
* after this test, and without the narrowing the caller has to re-assert the string it just
|
| 102 |
+
* proved β which is the kind of cast that outlives the reason for it.
|
| 103 |
+
*/
|
| 104 |
+
export function formulaIsText(v: CellValue): v is string {
|
| 105 |
+
return typeof v === "string" && v.trim() !== "" && !Number.isFinite(Number(v));
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
/** A checkbox cell's boolean, out of the overlay's '1'-or-empty contract. */
|
| 109 |
export function checkboxOn(v: CellValue | boolean): boolean {
|
| 110 |
return v === "1" || v === 1 || v === true;
|
|
|
|
| 181 |
switch (field.type) {
|
| 182 |
case "currency":
|
| 183 |
return v == null || v === "" ? "" : "$" + numberText(num(v), field.format);
|
| 184 |
+
case "formula": {
|
| 185 |
+
// β A FORMULA MAY RETURN TEXT (owner item 2, 2026-07-31 β CONCATENATE, `&`, TEXT(),
|
| 186 |
+
// and any `IF(cond, "yes", "no")`). `makeCell` learned that; this function did not, and
|
| 187 |
+
// the two are supposed to be one rendering. So every surface that reads THIS one β
|
| 188 |
+
// ListView, KanbanView, the calendar's summary cells, the record-detail panel and ALL
|
| 189 |
+
// FOUR export formats β printed a text result as `0`, because `num("Buy now")` is NaN.
|
| 190 |
+
// The canvas showed the words and the file showed a zero, for the same cell.
|
| 191 |
+
//
|
| 192 |
+
// Found by rendering the owner's own Buy signal formula through the shipped bundle
|
| 193 |
+
// (_qa_owner_20260803). The branch below is `makeCell`'s test, verbatim: a non-blank,
|
| 194 |
+
// non-numeric STRING is its own display.
|
| 195 |
+
if (v == null || v === "") return "";
|
| 196 |
+
if (formulaIsText(v)) return String(v);
|
| 197 |
+
return numberText(num(v), field.format);
|
| 198 |
+
}
|
| 199 |
case "int":
|
|
|
|
| 200 |
return v == null || v === "" ? "" : numberText(num(v), field.format);
|
| 201 |
case "pct":
|
| 202 |
return v == null || v === "" ? "" : num(v).toFixed(1) + "%";
|