:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): add katana fulfillment, bom and row tables (#113859)
Tom Owersf8b0a8127c9c
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 07d32e68a1d8..6ce0fdfe3da0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -4746,12 +4746,12 @@ Diffed against: <https://api.katanamrp.com/v1/openapi.json>- [x] `sales_order_rows` — line items behind sales_orders — required for any revenue-by-product or product-mix analysis (high)- [x] `purchase_order_rows` — line items behind purchase_orders, with quantities and purchase prices (high)-- [ ] `bom_rows` — bill-of-materials linking products/variants to the materials they consume (high)+- [x] `bom_rows` — bill-of-materials linking products/variants to the materials they consume (high)- [x] `manufacturing_order_recipe_rows` — actual ingredient consumption per manufacturing order — yield and material-variance analysis (high)- [x] `manufacturing_order_productions` — completed production output per manufacturing order; manufacturing_orders alone only carries planned state (high)-- [ ] `sales_order_fulfillments` — shipment/fulfillment records — the transition from order to delivered (high)-- [ ] `sales_return_rows` — line items behind sales_returns, needed to attribute returns to products (medium)-- [ ] `manufacturing_order_operation_rows` — per-operation timings and assigned operators, for throughput and labor cost (medium)+- [x] `sales_order_fulfillments` — shipment/fulfillment records — the transition from order to delivered (high)+- [x] `sales_return_rows` — line items behind sales_returns, needed to attribute returns to products (medium)+- [x] `manufacturing_order_operation_rows` — per-operation timings and assigned operators, for throughput and labor cost (medium)- [ ] `price_list_rows` — priced items per price list; price_lists alone is only the header (medium)- [ ] `stocktake_rows` — counted vs expected quantity per stocktake line — the actual shrinkage numbers (medium)- [ ] `bin_locations and bin_inventory` — bin-level stock lookup and on-hand quantities below the location grain we already sync (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/katana/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/katana/canonical_descriptions.pyindex 4ec3f202853f..ae5557f7f8e8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/katana/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/katana/canonical_descriptions.py@@ -59,6 +59,20 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"is_sellable": "Whether the service can be sold.",},},+ "bom_rows": {+ "description": "Bill of materials rows: the ingredient variants and quantities needed to make one unit of a product variant.",+ "docs_url": f"{_DOCS}/getallbomrows",+ "columns": {+ "id": "Unique identifier for the BOM row.",+ "product_item_id": "Product the BOM row belongs to.",+ "product_variant_id": "Product variant the BOM row belongs to.",+ "ingredient_variant_id": "Material or subassembly variant used to make the product variant.",+ "quantity": "Quantity of the ingredient used to manufacture one unit of the product.",+ "notes": "Internal comments on the row.",+ "created_at": "Timestamp when the row was created.",+ "updated_at": "Timestamp when the row was last updated.",+ },+ },"customers": {"description": "Customers you sell to, including contact and billing details.","docs_url": f"{_DOCS}/list-all-customers",@@ -206,6 +220,30 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"deleted_at": "Timestamp when the production was deleted, if deleted.",},},+ "manufacturing_order_operation_rows": {+ "description": "Operations of manufacturing orders, with planned and actual time and cost and the assigned operators.",+ "docs_url": f"{_DOCS}/getallmanufacturingorderoperationrows",+ "columns": {+ "id": "Unique identifier for the operation row.",+ "manufacturing_order_id": "Manufacturing order the operation belongs to.",+ "status": "Status of the operation.",+ "operation_id": "Operation performed on this row.",+ "operation_name": "Name of the operation.",+ "resource_id": "Resource used for the operation.",+ "resource_name": "Name of the resource used for the operation.",+ "assigned_operators": "Operators assigned to the operation.",+ "completed_by_operators": "Operators who completed the operation.",+ "planned_time_per_unit": "Planned time per unit of product.",+ "total_actual_time": "Actual total time spent on the operation.",+ "planned_cost_per_unit": "Planned cost per unit of product.",+ "total_actual_cost": "Actual total cost of the operation.",+ "cost_per_hour": "Hourly cost of the operation.",+ "completed_at": "Timestamp when the operation was completed.",+ "created_at": "Timestamp when the row was created.",+ "updated_at": "Timestamp when the row was last updated.",+ "deleted_at": "Timestamp when the row was deleted, if deleted.",+ },+ },"sales_returns": {"description": "Returns raised against sales orders, with refund and restock status.","docs_url": f"{_DOCS}/getallsalesreturns",@@ -218,6 +256,45 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"return_location_id": "Location the goods are returned to.",},},+ "sales_return_rows": {+ "description": "Line items on sales returns: the variant returned, quantity, price and restock location per row.",+ "docs_url": f"{_DOCS}/getallsalesreturnrows",+ "columns": {+ "id": "Unique identifier for the sales return row.",+ "sales_return_id": "Sales return the row belongs to.",+ "variant_id": "Variant returned on this row.",+ "sales_order_row_id": "Sales order row the items were originally sold on.",+ "fulfillment_row_id": "Sales order fulfillment row the items were shipped on.",+ "quantity": "Quantity returned.",+ "net_price_per_unit": "Net price per unit of the returned items.",+ "reason_id": "Return reason for the row.",+ "restock_location_id": "Location the returned items are restocked to.",+ "batch_transactions": "Batches the returned items are restocked to, with quantities.",+ "created_at": "Timestamp when the row was created.",+ "updated_at": "Timestamp when the row was last updated.",+ },+ },+ "sales_order_fulfillments": {+ "description": "Shipments of sales orders, with packing and delivery status, tracking details and the fulfilled rows.",+ "docs_url": f"{_DOCS}/list-all-sales-order-fulfillments",+ "columns": {+ "id": "Unique identifier for the sales order fulfillment.",+ "sales_order_id": "Sales order the fulfillment belongs to.",+ "picked_date": "Timestamp when the fulfillment was first marked as packed or delivered.",+ "status": "Fulfillment status, PACKED or DELIVERED.",+ "invoice_status": "Invoicing status of the fulfillment.",+ "conversion_rate": "Currency rate from the sales order currency to the factory's base currency.",+ "conversion_date": "Date of the conversion rate used.",+ "tracking_number": "Shipment tracking number from the carrier.",+ "tracking_url": "Link to the shipment's online tracking data.",+ "tracking_carrier": "Carrier used for shipping.",+ "tracking_method": "Shipping method used.",+ "packer_id": "Packer who packed the order, when the warehouse management add-on is enabled.",+ "sales_order_fulfillment_rows": "Sales order rows fulfilled, with quantities and batch, serial and bin allocations.",+ "created_at": "Timestamp when the fulfillment was created.",+ "updated_at": "Timestamp when the fulfillment was last updated.",+ },+ },"stock_adjustments": {"description": "Manual stock corrections that increase or decrease on-hand quantities.","docs_url": f"{_DOCS}/getallstockadjustments",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/katana/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/katana/settings.pyindex c1cb2dfc3ee2..8318dd7124d9 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/katana/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/katana/settings.py@@ -38,6 +38,7 @@ KATANA_ENDPOINTS: dict[str, KatanaEndpointConfig] = {"materials": KatanaEndpointConfig(name="materials", path="/materials", incremental_fields=_UPDATED_AND_CREATED),"variants": KatanaEndpointConfig(name="variants", path="/variants", incremental_fields=_UPDATED_AND_CREATED),"services": KatanaEndpointConfig(name="services", path="/services", incremental_fields=_UPDATED_AND_CREATED),+ "bom_rows": KatanaEndpointConfig(name="bom_rows", path="/bom_rows", incremental_fields=_UPDATED_AND_CREATED),# --- Partners ---"customers": KatanaEndpointConfig(name="customers", path="/customers", incremental_fields=_UPDATED_AND_CREATED),"suppliers": KatanaEndpointConfig(name="suppliers", path="/suppliers", incremental_fields=_UPDATED_AND_CREATED),@@ -54,6 +55,9 @@ KATANA_ENDPOINTS: dict[str, KatanaEndpointConfig] = {"sales_returns": KatanaEndpointConfig(name="sales_returns", path="/sales_returns", incremental_fields=_UPDATED_AND_CREATED),+ "sales_order_fulfillments": KatanaEndpointConfig(+ name="sales_order_fulfillments", path="/sales_order_fulfillments", incremental_fields=_UPDATED_AND_CREATED+ ),# --- Order line items ---"sales_order_rows": KatanaEndpointConfig(name="sales_order_rows", path="/sales_order_rows", incremental_fields=_UPDATED_AND_CREATED@@ -71,6 +75,14 @@ KATANA_ENDPOINTS: dict[str, KatanaEndpointConfig] = {path="/manufacturing_order_productions",incremental_fields=_UPDATED_AND_CREATED,),+ "manufacturing_order_operation_rows": KatanaEndpointConfig(+ name="manufacturing_order_operation_rows",+ path="/manufacturing_order_operation_rows",+ incremental_fields=_UPDATED_AND_CREATED,+ ),+ "sales_return_rows": KatanaEndpointConfig(+ name="sales_return_rows", path="/sales_return_rows", incremental_fields=_UPDATED_AND_CREATED+ ),# --- Stock movements ---"stock_adjustments": KatanaEndpointConfig(name="stock_adjustments", path="/stock_adjustments", incremental_fields=_UPDATED_AND_CREATEDdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/katana/tests/test_katana.py b/products/warehouse_sources/backend/temporal/data_imports/sources/katana/tests/test_katana.pyindex d85137954ee8..da9286917f69 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/katana/tests/test_katana.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/katana/tests/test_katana.py@@ -237,6 +237,10 @@ class TestKatanaSourceResponse:("inventory_movements", ["id"], "created_at"),("sales_order_rows", ["id"], "created_at"),("manufacturing_order_productions", ["id"], "created_at"),+ ("bom_rows", ["id"], "created_at"),+ ("sales_order_fulfillments", ["id"], "created_at"),+ ("manufacturing_order_operation_rows", ["id"], "created_at"),+ ("sales_return_rows", ["id"], "created_at"),])def test_source_response_shape(self, endpoint: str, expected_pk: list[str], partition_key: str | None) -> None: