---
tags: [products, cross-module]
module: Products
---

# CrossModuleDependencies

## Connections
[[_Products]] · [[[Model]Product]] · [[[Model]WarehouseProduct]] · [[[Model]CostCenter]] · [[[Observer]Observers]] · [[[Service]ProductServices]] · [[[Service]CostCenterServices]]

---

## Accounting Module
| Used | Type | Purpose |
|---|---|---|
| [[[Model]Account]] | Model | Product has 4 account FKs (inventory/selling/purchasing/additional_cost) |
| `JournalRecord` | Model | CostCenter.journalRecords hasMany |
| [[[Enum]Enums]] `AccountsEnum` | Enum | Default account types |
| `IntegratedTransactionFieldsEnum` | Enum | Integration field mapping |
| `AccountsRepository` | Repo | Account lookups for product form |
| `ListingAccountsService` | Service | Account dropdown |
| `RetrievingSubCategoriesWithActiveAccountsService` | Service | Filtered account dropdown |
| `AccountIsActiveRule` | Rule | Validates linked accounts are active |
| `ProductTaxAccountIsActiveRule` | Rule | Tax account validation |
| `SellingPurchaseInventoryAccountsAreActiveRule` | Rule | Validates all 3 product accounts |
| `AccountResource` | API Resource | Account data in product API responses |

---

## CompanyUser Module
| Used | Type | Purpose |
|---|---|---|
| [[[Model]User]] | Model | `created_by` on products; notification targets |
| `NotificationsEnum` | Enum | Notification type keys |
| `ScreensEnum` | Enum | Navigation screen keys |
| `RetrievingUsersByPermissionService` | Service | Find users to notify for low-stock alerts |
| `FormatDateAndTimeTrait` | Trait | Date formatting on CostCenter |

---

## Inventory Module
| Used | Type | Purpose |
|---|---|---|
| [[Inventory/[Model]Warehouse\|[Model]Warehouse]] | Model | WarehouseProduct.warehouse_id; Product.recipe_warehouse_id |
| [[Inventory/[Model]WarehouseProductLog\|[Model]WarehouseProductLog]] | Model | Checked in WarehouseProduct.canBeDeleted() |
| `Requisition` | Model | Product hasMany via line items |
| [[Inventory/[Enum]Enums\|[Enum]Enums]] `WarehouseProductLogTypeEnum` | Enum | Log direction for stock changes |
| `WarehouseProductLogDTO` | DTO | Passed when logging stock movement |
| `WarehousesRepository` | Repo | Warehouse lookups |
| `WarehouseProductLogTrait` | Trait | Used to log stock transactions |
| `WarehouseSummaryResource` | API Resource | Warehouse data in product API |

---

## Purchases Module
| Used | Type | Purpose |
|---|---|---|
| `PurchaseBill` / `PurchaseBillDetails` | Model | Product hasMany bill line items |
| `BillReturn` / `BillReturnDetail` | Model | Product hasMany return line items |
| `Expense` / `ExpenseDetail` | Model | Product hasMany expense line items |
| `SupplierPaymentReceipt` | Model | CostCenter link |
| `PurchaseBillsDetailsRepository` | Repo | Bill detail lookups |

---

## Sales Module
| Used | Type | Purpose |
|---|---|---|
| `Invoice` / `InvoiceDetail` | Model | Product hasMany invoice line items |
| `InvoiceReturn` / `InvoiceReturnDetail` | Model | Product hasMany return line items |
| `EstimateDetail` | Model | Product hasMany estimate line items |
| `CustomerPaymentReceipt` | Model | CostCenter link |
| `TaxTypeEnum` / `UnitCodesEnum` | Enum | ZATCA e-invoicing compliance |
| `CheckCustomerIsZatcaCompliantService` | Service | ZATCA validation on product form |

---

## Settings Module
| Used | Type | Purpose |
|---|---|---|
| [[Settings/[Model]Tax\|[Model]Tax]] | Model | Product.tax_id |
| [[Settings/[Enum]Enums\|[Enum]Enums]] `CustomFieldsEnum` | Enum | Custom field module keys |
| [[Settings/[Enum]Enums\|[Enum]Enums]] `FeaturesEnum` | Enum | INVENTORY feature flag (low-stock notifications) |
| [[Settings/[Enum]Enums\|[Enum]Enums]] `InventorySystemEnum` | Enum | Negative stock config |
| [[Settings/[Repo]Repositories\|[Repo]Repositories]] `TaxesRepository` | Repo | Tax dropdown |
| [[Settings/[Repo]Repositories\|[Repo]Repositories]] `AccountingSettingsRepository` | Repo | Default accounts config |
| [[Settings/[Repo]Repositories\|[Repo]Repositories]] `GeneralSettingsRepository` | Repo | Currency + company settings |
| [[Settings/[Service]TaxServices\|[Service]TaxServices]] `GettingCurrentDefaultTaxService` | Service | Default tax on product form |
| [[Settings/[Service]TaxServices\|[Service]TaxServices]] `ListingTaxesService` | Service | Tax dropdown |
| [[Settings/[Service]SettingsServices\|[Service]SettingsServices]] `RetrievingCustomFieldsByModuleService` | Service | Custom fields for products |
| [[Settings/[Service]SettingsServices\|[Service]SettingsServices]] `GeneratingDynamicImportingValidatorForCustomFiledsByModule` | Service | Dynamic import validation |
| [[Settings/[Service]SettingsServices\|[Service]SettingsServices]] `ReformattingImportingRequestService` | Service | Import data reformatting |
| [[Settings/[Service]SettingsServices\|[Service]SettingsServices]] `RetrievingInventorySystemService` | Service | Inventory system type |
| `TaxResource` | API Resource | Tax in product API |

---

## Tenant Module
| Used | Type | Purpose |
|---|---|---|
| `Website` | Model | Domain/subdomain routing |
| `FeatureNameEnum` | Enum | CostCenters feature tracking |
| `RetrievingTenantBySubdomainService` | Service | Tenant context in jobs |
| `UpdatingLastActivityService` | Service | Called by ProductObserver + CostCenterObserver on create |

---

## App (Core)
| Used | Type | Purpose |
|---|---|---|
| `TenantBaseController` | Base class | All web controllers |
| `BaseRepository` | Base class | All repositories |
| `Upload` | Service | Product image upload |
| `CacheClientService` | Service | Pattern-based cache clear on product CRUD |
| `PrintingPDFService` | Service | PDF export |
| `HasTranslatableFields` | Trait | name_ar/en on all models |
| `AuditableTrait` | Trait | OwenIt auditing on all primary models |
| `CascadeSoftDeletes` | Trait | Product, CostCenter cascade to children |
