Master unit measures are scoped by company_id. Uniqueness is (company_id, code) and (company_id, name).
| Catalog role | Typical company_id |
Notes |
|---|---|---|
| Operating catalog (existing FKs) | 8 |
Legacy rows keep the same id after migration. |
| Template for new companies | 1 |
Active rows cloned from company 8; use CLI clone to onboard. |
Onboard a new company:
php artisan inventory:clone-unit-measures --from=1 --to={companyId}
/v1/inventory/master/unit-measures/v1/inventory/master/unit-measure-kpis/v1/inventory/master/product-unit-measures| Header | Type | Description |
|---|---|---|
Authorization |
string |
Bearer <token> OAuth2 token. |
x-app-stage |
string |
Current tenant stage (dev, staging, prod). |
x-app-uid |
string |
Authenticated user UUID. |
| Parameter | Type | Default | Description |
|---|---|---|---|
companyId |
integer |
Required | Active operating company ID. |
view |
string |
A |
State: A (Active), I (Inactive), D (Trashed), ALL. |
unit-measures)GET /v1/inventory/master/unit-measures?companyId=8&view=A
200 OK{
"success": true,
"message": "Proceso realizado correctamente",
"data": [
{
"id": 42,
"company_id": 8,
"code": "UND",
"name": "UNIDAD",
"iso_unit": "NIU",
"label": ["U", "S"],
"status": "A"
}
]
}
POST /v1/inventory/master/unit-measures?companyId=8
Content-Type: application/json
{
"company_id": 8,
"code": "SIXPACK",
"name": "SIX PACK (6 UNIDADES)",
"iso_unit": "PK",
"label": ["U", "S"],
"status": "A"
}
company_id in the body must match companyId in the query (middleware).
Product resource lists (weight/volume/dimension/unit pickers) also filter by companyId via LoadUnitsAction.
unit-measure-kpis)See existing KPI section; KPI rows already require company_id.
product-unit-measures)Bindings reference unit_measure_id that must belong to the same company as the product / presentation row.
GET /v1/inventory/master/product-unit-measures?companyId=8
POST /v1/inventory/master/product-unit-measures?companyId=8
PUT /v1/inventory/master/product-unit-measures/{id}?companyId=8
DELETE /v1/inventory/master/product-unit-measures/{id}?companyId=8
Pass companyId and company_id (same value) on query strings for product presentation endpoints; middleware accepts either form.
| Operation | HTTP |
|---|---|
| Presentation grid (unit-rows) | GET /v1/inventory/product/products/{idOrCode}/unit-rows?companyId=8&company_id=8 |
| Operational UoM roles on product | PUT /v1/inventory/product/products/{id}/unit-measures?companyId=8&company_id=8 |
| Presentation list (picker) | GET /v1/inventory/product/products/{id}/unit-measures?companyId=8&company_id=8 |
Body on PUT .../unit-measures should include company_id matching the query when updating warehousing / buy / sell unit pointers.
GET /v1/inventory/product/product-resources/units?companyId=8&company_id=8
GET /v1/inventory/product/product-resources/units-weight?companyId=8
LoadUnitsAction returns only unit_measures where company_id = companyId.
| Concern | Implementation |
|---|---|
| Active company | src/hooks/use-scoped-company-id.js |
| Option lists | src/utils/inventory/filter-unit-measures-by-company.js |
| Product forms | product-form.js, product-express-form.js |
| Presentaciones tab | product-unit-measures-panel.js + product-unit-measure-form.js + row actions |
| Master UoM | maintenance-unit-measures-container.js |
Agent skill (frontend): goal-front/.agents/skills/unit-measures-company-scoping/SKILL.md
User manuals: Unidades de medida (maestro), Presentaciones del producto