diff --git a/pharma_control_center/Dockerfile b/pharma_control_center/Dockerfile new file mode 100644 index 00000000000..097f363de39 --- /dev/null +++ b/pharma_control_center/Dockerfile @@ -0,0 +1,13 @@ +FROM odoo:18.0 + +USER root + +RUN apt-get update && apt-get install -y wkhtmltopdf + +RUN mkdir -p /mnt/extra-addons + +COPY ./pharma_control_center /mnt/extra-addons/pharma_control_center + +RUN chown -R odoo:odoo /mnt/extra-addons + +USER odoo \ No newline at end of file diff --git a/pharma_control_center/README.md b/pharma_control_center/README.md new file mode 100644 index 00000000000..a15967d4525 --- /dev/null +++ b/pharma_control_center/README.md @@ -0,0 +1,757 @@ +# Pharma Control Center (Odoo 18+) + +Pharma Control Center is an Odoo backend module for basic pharmacy operations: a medicine catalog (batch/expiry/custom stock), a per-user cart checkout flow (Sales Order + Invoice), an operational dashboard, and simple patient records with doctor assignment. + +This module is implemented as standard Odoo models + backend views (no website/portal pages). + +## What’s Included (As Implemented) + +- **Medicines** (`pharmacy.medicine`) + - Batch + expiry tracking (`expiry_date`, `days_to_expiry`, `expiry_status`) + - Custom stock quantity + reorder indicator (`quantity`, `reorder_level`, `need_reorder`) + - License category field (`green` / `blue` / `white`) used in medicine visibility record rules + - Kanban / list / form views + search filters + +- **Cart & checkout** (`pharmacy.cart`, `pharmacy.cart.line`) + - Add medicines to your cart (including quick add by barcode) + - Shows interaction warnings for medicines currently in the cart + - Checkout creates and confirms a `sale.order`, creates an invoice (`account.move`), posts it, reduces `pharmacy.medicine.quantity`, and clears the cart + +- **Dashboard** (`pharma.control.center`) + - Profile panel (avatar stored on the dashboard; name/email/phone synced to the linked `res.users` / `res.partner`) + - Live KPIs (medicine counts, stock value, expiring soon, etc.) + - “Today’s orders” summary + drill-down list + +- **Patients** (`pharmacy.patient`) + - Doctors can manage patients assigned to them (record rule on `doctor_id`) + - Managers can see all patients + +- **Drug interactions** (`pharmacy.interaction`) + - Managers define medicine pairs with severity + warning text + - Cart shows warnings; checkout blocks when any interaction is **Severe** + +- **Manager analytics** + - Graph/pivot views on `sale.order` under the **Analytics** menu (manager-only) + +## Dependencies + +Declared in [`__manifest__.py`](__manifest__.py): `base_setup`, `product`, `sale`, `account`. + +## Installation + +1. Put `pharma_control_center/` in one of your Odoo `addons_path` directories. +2. Restart Odoo, then go to **Apps** and click **Update Apps List**. +3. Search for **Pharma Control Center** and install it. + +## Configuration (Roles) + +Assign users to one of these groups: +- **Pharma Control Center / Patient** +- **Pharma Control Center / Doctor** +- **Pharma Control Center / Manager** + +## Demo Data + +When demo data is enabled, the module loads: +- Sample medicines in [`data/demo_medicines.xml`](data/demo_medicines.xml) +- Sample patients in [`data/demo_patients.xml`](data/demo_patients.xml) + +## Notes / Limitations + +- Inventory is tracked on `pharmacy.medicine.quantity` (this module does **not** use Odoo’s Inventory/Stock app and does not generate stock moves). +- Checkout posts the invoice automatically; this requires your Odoo Accounting configuration to be set up (journals, accounts, etc.). + +## Documentation + +- [ARCHITECTURE.md](docs/ARCHITECTURE.md) +- [TECHNICAL_DETAILS.md](docs/TECHNICAL_DETAILS.md) +- [SECURITY.md](docs/SECURITY.md) +- [USER_GUIDE.md](docs/USER_GUIDE.md) +- [DEMO_DATA.md](docs/DEMO_DATA.md) +- [CHANGELOG.md](docs/CHANGELOG.md) +- [TESTING.md](TESTING.md) + +## License + +LGPL-3 (see `license` in the manifest). +# 💊 Pharma Control Center (Odoo 18+ Module) + +## Overview + +**Pharma Control Center** is a comprehensive, production-ready Odoo 18+ module designed for modern pharmacy management systems. It provides a complete ecosystem for medicine cataloguing, batch and expiry tracking, intelligent inventory management, patient records with doctor assignments, a sophisticated cart-based ordering system, and real-time operational dashboards. The module strictly adheres to Odoo 18 conventions (using `` instead of deprecated ``), seamlessly integrates with Odoo's sales, accounting, and product modules, and implements multi-tier role-based access control (Patient / Doctor / Manager) with fine-grained security rules at both the model and record levels. + +**Key Highlights:** +- 🏥 **Professional-grade medicine management** with expiry tracking and license categories +- 👥 **Patient-doctor relationship system** with secure record visibility +- 🛒 **Cart-based ordering workflow** with one-click checkout and automatic invoicing +- 📊 **Real-time dashboard** with user profile, statistics, and operational alerts +- 🔐 **Enterprise-grade security** with role-based access control and record-level rules +- ✨ **Odoo 18 compliant** with modern views, computed fields, and QWeb templates + +--- + +## ✨ Key Features + +### 💊 Complete Medicine Management System + +#### Comprehensive Medicine Catalog +- **Full data model** including medicine name, manufacturer, batch number, barcode, and universal product code (UPC) +- **Hierarchical categorization** with parent-child category relationships for logical organization +- **License-based access model** (Green/Blue/White) determines which user groups can view and interact with each medicine +- **Storage conditions tracking** – room temperature, cold storage (2-8°C), and frozen storage support +- **Batch and traceability** – complete batch number tracking for recalls and regulatory compliance +- **Regulatory metadata** – dosage instructions, side effects documentation, and safety information + +#### Intelligent Pricing & Profitability +- **Dual pricing system** – selling price and cost price with automatic profit margin calculation +- **Real-time margin analytics** – computed field updates profit percentage dynamically +- **Price-based stock valuation** – total inventory value calculated as sum of (quantity × selling price) + +#### Advanced Stock Management +- **Real-time inventory tracking** – quantity-based stock status (in-stock, low-stock, out-of-stock) +- **Intelligent reorder system** – configurable reorder level with "Need Reorder" alerts +- **Low stock detection** – automatic flagging of medicines with 1-9 units remaining +- **Automatic stock reduction** – inventory decremented on successful cart checkout +- **Stock status badges** – visual indicators in list and kanban views for quick inventory assessment + +#### Expiry Management & Alerts +- **Automated expiry calculations** – computed field tracks remaining days until expiration +- **Three-tier expiry status** – Fresh (>30 days), Expiring Soon (≤30 days), Expired (