@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / c62bb15
Fork 0

سامانه صدور فاکتور و حسابداری

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 4, 09:15 UTC

test(company): support standalone module harness while scoping runtime company reads

davoodmehraban89 committed Oct 14, 2026 at 11:49 UTC c62bb15df8e3cb08d398e65d7cc6f1f5ac922b0a
1 file changed +7 -1
js/phase5-enterprise.js
+7 -1
@@ -1,6 +1,12 @@
1 /* Phase 5 — complementary ERP: inventory, assets, FX, analytics, import/backup and integration outbox */
2 const P5_LABELS={opening:'افتتاحیه',adjustment_in:'تعدیل افزایشی',adjustment_out:'تعدیل کاهشی',transfer:'انتقال'};
3 -function p5Owned(k){return finoraScopedRows(k)}
3 +function p5Owned(k){
4 + if(typeof finoraScopedRows==='function')return finoraScopedRows(k);
5 + // Standalone domain-contract harnesses load this module without sync.js.
6 + const cid=afCompanyId(),single=typeof getMyCompanies!=='function'||getMyCompanies().length===1;
7 + return (datastore[k]||[]).filter(x=>x.ownerUserId===currentUser?.id&&
8 + (x.companyId===cid||(single&&!x.companyId)));
9 +}
10 function getMyWarehouses(){return p5Owned('warehouses')} function getMyStockMovements(){return p5Owned('stockMovements')}
11 function getMyInventoryCounts(){return p5Owned('inventoryCounts')} function getMyFixedAssets(){return p5Owned('fixedAssets')}
12 function getMyAssetDepreciations(){return p5Owned('assetDepreciations')} function getMyCurrencies(){return p5Owned('currencies')}