From 6b5b522be14972faa589fd50d56a57938f5851d9 Mon Sep 17 00:00:00 2001 From: enlineawork Date: Tue, 8 Sep 2026 18:22:47 -0300 Subject: [PATCH] fix(inventory): keep field yacimientos structural --- .../f3-field-inventory-structure.service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts b/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts index 75bc7bd..bd77ca9 100644 --- a/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts +++ b/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts @@ -123,13 +123,17 @@ export class F3FieldInventoryStructureService { [key: string]: unknown; }; - // F5: the Inventory screens count only concrete instances confirmed/created in field. - // Legacy/context/catalog records intentionally remain false until explicitly validated. + // Área/Yacimiento remain structural context. A concrete Installation/Subinstallation + // created in field is a real Inventory instance from the moment it is registered. await this.dataSource.query(` UPDATE assets - SET is_inventory_instance=true,updated_by=$2::uuid,updated_at=CURRENT_TIMESTAMP + SET is_inventory_instance=$3::boolean,updated_by=$2::uuid,updated_at=CURRENT_TIMESTAMP WHERE id=$1::uuid - `, [created.asset.id, principal.userId]); + `, [ + created.asset.id, + principal.userId, + typeCode === 'instalacion' || typeCode === 'subinstalacion', + ]); if (!family) return this.fieldInventory.detail(visitId, created.asset.id, principal);