How alqasmii/library-management- works
Project type and purpose
• This is a standalone Odoo v15+ module named baramej_library_system (packaged under custom/custom/baramej_library_system).
• It implements a full-stack Library Management System: Python-based business logic (models, cron jobs), XML/QWeb-based UI, JS widget for barcode scanning, scheduled actions for overdue detection and email reminders, and PostgreSQL for persistence.
Architectural overview
• At the highest level the system comprises:
a. The Odoo application server (Python runtime, web server, cron scheduler)
b. The PostgreSQL database
c. External integrations: USB barcode scanner (keyboard-wedge), SMTP mail server
d. The custom module code (models, views, data, security, static assets, tests)
• It follows the classic MVC/MVT pattern:
• Models: Python files under models/ (map to DB tables via Odoo ORM)
• Views/Templates: XML files under views/ and QWeb templates (rendered as web pages)
• Controller/UI logic: JS widget (barcode_scanner.js) for client-side interactions
• Cron jobs & data files: scheduled actions & demo data under data/ and demo/
• Security layer: access control under security/
Main components
• Frontend layer:
• Web browser / Odoo web client
• QWeb/XML views (CRUD screens, dashboard)
• JavaScript widget (barcode_scanner.js)
• Backend layer:
• Odoo server (Python)
– Models: library_member.py, library_book.py, library_borrow.py, etc.
– Wizards: library_barcode_scan.py
– Cron scheduler: overdue detection, email reminders (ir_cron.xml)
– Business rules & computed fields (limits, fines)
– Security engine (record rules & groups)
• Persistence layer:
• PostgreSQL database (tables for members, books, loans, categories…)
• External services:
• SMTP mail server (email reminders)
• USB barcode scanner (keyboard-wedge input into JS widget)
• Auxiliary:
• demo data loader
• translation files (i18n/en.po)
• tests suite (unittest-based test files)
Relationships and data flow
• User → Browser → QWeb/XML view
→ HTTP request to Odoo server → Model methods via ORM → DB → returns data → rendered in view
• Barcode scan: user scans into JS widget → widget sends RPC to Odoo wizard → creates/up-dates library.borrow record
• Cron jobs: Odoo scheduler invokes Python methods on library.borrow → updates overdue flags → triggers mail templates → SMTP server
• Security: Web request passes through record rules & ir.model.access filters based on user group
• Dashboard: server aggregates data (graph/pivot views) → QWeb renders charts
Architectural patterns and design principles
• MVC/MVT separation: models vs views vs client-side widget vs data vs security
• Modular design: single Odoo module with clear subdirectories (models, views, data, security, static, tests)
• Event-driven tasks: Odoo cron jobs for overdue detection & reminders
• Layered security: model-level access, record rules, user roles/groups
• Extensibility via standard Odoo API (data files, XML hooks, Python inheritance)
Technologies and frameworks
• Backend: Odoo 15+ framework, Python 3.8+, Odoo ORM, ir.cron scheduler
• Frontend: QWeb/XML views, Owl.js (Odoo native), JavaScript barcode widget
• Database: PostgreSQL 12+
• Email: Odoo mail module (SMTP integration)
• Testing: Odoo TestCase (unittest), GitHub Actions CI
Detail level
• Don’t overload with every single XML file; group by function (Views vs Data vs Security)
• Explicitly call out key models and workflows (Borrow → Overdue → Reminder)
• Essential modules and patterns, avoiding too much low-level detail