Files
ERP-APP-INVENTORY/README.md
BACHIR SOULDI 37b0762921 first commit
2026-07-16 14:29:15 +01:00

74 lines
3.8 KiB
Markdown

# Inventory App
A Flutter mobile app for conducting physical stock inventories against an [Axelor](https://axelor.com/) ERP backend. Warehouse staff scan product QR codes, count stock by zone, and submit inventory lines directly to Axelor's REST API.
## Features
- **Login** against the Axelor ERP using session-cookie authentication, with the session persisted locally and re-validated on app start.
- **Inventory counting** — scan a product QR code, pick a zone/stock location, choose a counting type (`Comptage 1`, `Comptage Contrôle`), enter a quantity and condition, and submit the count as an `InventoryLine`.
- **Zone scanning** — scan a location QR code to auto-select the stock location for the current count.
- **Product creation** — create a new product on the fly (name, family/sub-family, serial number, condition) with an initial inventory line, including a picture upload flow.
- **My Scans** — review the inventory lines the current user has already submitted.
- **Bureau inventory** — a dedicated search/review screen for inventory lines at a given location.
- **Panoramic viewer** — 360° image viewer tab.
- **Profile** — view the logged-in user's Axelor profile and log out.
- **Light/dark theme** support.
## Tech stack
- [Flutter](https://flutter.dev/) / Dart
- [GetX](https://pub.dev/packages/get) for state management, routing, and dependency injection
- [Dio](https://pub.dev/packages/dio) + [cookie_jar](https://pub.dev/packages/cookie_jar) for HTTP calls and session-cookie handling against Axelor's REST API
- [get_storage](https://pub.dev/packages/get_storage) for local session persistence
- [qr_code_scanner_plus](https://pub.dev/packages/qr_code_scanner_plus) for QR scanning
- [image_picker](https://pub.dev/packages/image_picker) for product photo capture/upload
## Project structure
```
lib/
controllers/ # GetX controllers (home, user, theme, simple UI state)
models/ # Axelor entity DTOs (Product, Depot, InventoryLine, TrackingNumber, ...)
service/ # AxelorClient (REST API) and product image upload flow
views/ # Screens (login, home, QR scanner, product view, profile, ...)
widgets/ # Shared glassmorphism-style UI components
utils.dart # Local, gitignored config (Axelor endpoints) — see Setup below
constants.dart # App-wide constants and text styles
```
## Setup
### Prerequisites
- [Flutter SDK](https://flutter.dev/docs/get-started/install) (Dart SDK `^3.7.2`, see `pubspec.yaml`)
- Access to an Axelor ERP instance to point the app at
### 1. Install dependencies
```bash
flutter pub get
```
### 2. Configure the Axelor endpoint (required — the app will not build without this)
Two files hold real, environment-specific values and are gitignored so they never get committed. Copy each template and fill in your own values:
```bash
cp lib/utils.example.dart lib/utils.dart
cp android/app/src/main/res/xml/network_security_config.xml.example android/app/src/main/res/xml/network_security_config.xml
```
- **`lib/utils.dart`** — sets `Utils.url` (the Axelor base URL, e.g. `https://your-erp-host.example.com/prod`) and `Utils.ticketUrl` (an external ticketing link opened from the drawer).
- **`android/.../network_security_config.xml`** — Android's cleartext-traffic domain allowlist. Set the `<domain>` entry to match the host in `Utils.url` (only needed if your ERP is served over plain HTTP; otherwise this can be left with a dummy value).
### 3. Run the app
```bash
flutter run
```
## Notes
- The inventory ID targeted by counts is hardcoded in [`lib/constants.dart`](lib/constants.dart) (`kInventoryId`) — update it to match the active inventory in your Axelor instance.
- Session cookies are persisted via `get_storage` and validated against Axelor on each app start; an invalid/expired session bounces the user back to the login screen.