Odoo
Implementation
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Project (project) • Sales (sale_management) • Discuss (mail) |
| Lines of code | 81 |
| Technical Name |
add_analytic_account |
| License | LGPL-3 |
| Website | https://lucidbrainz.com/?i=1 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Project (project) • Sales (sale_management) • Discuss (mail) |
| Lines of code | 81 |
| Technical Name |
add_analytic_account |
| License | LGPL-3 |
| Website | https://lucidbrainz.com/?i=1 |
Analytic Account Auto-Creation - Sales Order Integration
Automatically Create & Link Analytic Accounts with Sales Orders - Supply, Project & Maintenance Type Classification for Odoo 18
Overview
Analytic Account Auto-Creation by LucidBrainz is an intelligent automation solution for Odoo 18 that automatically creates analytic accounts when you confirm sales orders, eliminating manual data entry and ensuring 100% accurate linkage between sales and accounting. Say goodbye to forgotten analytic accounts and inconsistent cost tracking! This smart module helps you streamline sales-to-accounting workflow, categorize orders by type (Supply/Project/Maintenance), automatically link accounts with proper analytic plans, and maintain organized cost centers without any manual intervention. Perfect for project-based businesses, service companies, manufacturing firms, construction companies, IT solution providers, consulting firms, maintenance service providers, and any organization that needs automated cost tracking, project accounting, departmental analysis, or order-wise revenue/expense monitoring. The module features sale type classification field, automatic account creation on order confirmation, intelligent plan assignment (Supply plan for Supply type orders), seamless project integration, computed sale type on analytic accounts, bidirectional data synchronization, group by sale type filtering, clean UI integration in sales and accounting, and zero configuration required after installation. It intelligently works through a simple three-step automated workflow: (1) User selects Sale Type (Supply/Project/Maintenance) on sale order creation, (2) On clicking "Confirm" button, system automatically creates analytic account matching order name and assigns appropriate analytic plan, (3) Created analytic account is automatically linked to the sale order's "Analytic Account" field showing instant relationship. The system provides complete visibility and traceability through enhanced forms and views showing sale type on both sales orders and analytic accounts, automatic name matching, plan assignment based on type, and project-based sale type inheritance when orders are linked to projects. When you confirm an order, the module automatically searches for existing analytic accounts by name to avoid duplicates, creates new account only if needed with matching name (Order Number), proper analytic plan, and company assignment, then instantly links it to the order's "Other Information" tab showing Analytic Account field populated with the newly created or existing account. The analytic account form now displays a computed Sale Type field that intelligently determines type from linked projects' sale orders or direct sale order name match, ensuring consistent classification across modules with real-time updates when source data changes. Ideal for businesses that want to eliminate manual analytic account creation, ensure 100% order-to-account linkage, categorize revenue streams by type, track project costs automatically, maintain organized cost centers, improve accounting accuracy, reduce data entry errors, speed up order processing, and generate type-wise financial reports for better business intelligence and decision-making!
Key Features
- Automatic Account Creation: When you click "Confirm" on a sale order, the module automatically creates a corresponding analytic account with matching name. No manual creation needed, zero data entry errors
- Sale Type Classification: Three-way categorization system - Supply, Project, and Maintenance types. Select on sale order form to classify your business operations and revenue streams clearly
- Instant Order-Account Linkage: Created analytic account automatically populates in sale order's "Analytic Account" field (Other Information tab). Shows immediate relationship between sales and accounting
- Smart Plan Assignment: For Supply type orders, automatically assigns "Supply" analytic plan using intelligent search (ilike 'Supply'). Ensures proper cost center organization without manual plan selection
- Duplicate Prevention: Before creating new account, searches for existing analytic account with matching order name. If found, links existing account instead of creating duplicate
- Computed Sale Type Field: Analytic accounts display computed sale_type field with store=True. Value calculated from linked project's sale order or direct name match ensuring data consistency
- Project Integration: For project-based orders, sale type inherited from project_ids.sale_order_id.sale_type relationship. Seamless integration with Odoo's project management module
- Group By Sale Type: Analytic accounts list view includes "Group By Sale Type" filter. Quickly view and analyze accounts categorized as Supply, Project, or Maintenance in one click
- Clean UI Integration: Sale Type field added to sale order form (Other Information → Sales Person section) and analytic account form (after Partner field). Native Odoo look and feel
- Post-Confirmation Processing: Account creation triggers in action_confirm() method override. Executes after standard confirmation ensuring all Odoo validations pass before creating accounting records
- Company-Aware Creation: Created analytic accounts inherit company from sale order. Multi-company compatible with proper company_id assignment and access restrictions
- Order Name Matching: Analytic account name set to '%s' % (order.name) ensuring perfect match with sale order number. Easy identification and linking between sales and accounting records
- Bidirectional Synchronization: Sale type flows from sale order to analytic account. Computed field updates automatically when source data (project links or order names) changes
- Selection Field Options: Both models use identical Selection field definition - ('supply', 'Supply'), ('project', 'Project'), ('maintenance', 'Maintenance'). Consistent across entire system
- Model Inheritance Pattern: Uses _inherit on 'sale.order' and 'account.analytic.account' models. Clean code structure following Odoo best practices for module development
- Stored Computed Field: sale_type on analytic account uses compute="compute_sale_type" with store=True. Database-stored for fast filtering and reporting without runtime computation overhead
- Dependency Tracking: Computed field decorated with @api.depends('name', 'project_ids', 'project_ids.sale_order_id.sale_type'). Auto-recalculates when any dependent field changes
- State-Based Readonly: Analytic Account field on sale order readonly after confirmation using states={'sale': [('readonly', True)], 'done': [('readonly', True)], 'cancel': [('readonly', True)]}
- Smart Search Logic: Uses search([('name', '=', order.name)]) for exact match and search([('name', 'ilike', 'Supply')]) for fuzzy plan matching. Flexible search patterns for reliable data retrieval
- XPath View Inheritance: XML views use xpath positioning (expr="//field[@name='partner_id']" position="after"). Precise UI element placement without form recreation
- Module Dependencies: Depends on base, account, sale, project, sale_project modules. Ensures all required Odoo features available for seamless integration
- Zero Configuration Setup: Works out-of-box after installation. No additional settings, configurations, or server actions required. Just install and start using immediately
- Automatic Workflow Trigger: Account creation logic embedded in action_confirm() override with super() call. Maintains all standard Odoo sale order confirmation behaviors plus custom automation
- Multi-Order Processing: Uses for order in self loop handling multiple selected orders. Batch confirmation creates accounts for all orders in single operation
- Conditional Account Creation: Only creates account for 'supply' type orders (if order.sale_type == 'supply'). Other types link to existing accounts without creating new ones
- Enhanced Form Views: Analytic account form shows Sale Type field for easy visual identification. Sale order form shows both Sale Type selection and resulting Analytic Account link
- Reporting Enhancement: Group by sale type enables powerful reporting capabilities. Generate revenue analysis, cost tracking, and profitability reports segmented by Supply/Project/Maintenance categories
- Audit Trail Support: Automatic account creation creates clear audit trail. Every confirmed order has linked analytic account showing who created, when created, and type classification
- Extensible Architecture: Clean inheritance structure allows easy customization. Add new sale types, modify creation logic, or integrate with other custom modules without conflicts
Module Screenshots
Sale order S00027 form showing "Other Info" tab with:
• Salesperson: Mitchell Admin
• Sales Team: Sales
• Sale Type: Dropdown with Supply/Project/Maintenance options
• Analytic Account: "Active account" field (will auto-populate after confirmation)
User selects sale type before confirming order for proper categorization
Accounting → Analytic Accounts showing:
• Multiple analytic accounts created for different customers
• Name column: Account names (Active account, Asustek, Camp to Camp, etc.)
• Customer column: Linked customers (Abigail Peterson, Wood Corner, Azure Interior, etc.)
• Plan column: All showing "Project" plan assignment
• Debit/Credit/Balance: Financial columns with 0.00 values
Shows 27 total analytic accounts with pagination (1-27 / 27)
Accounting → Configuration → Analytic Plans showing:
• Project plan: Default Applicability = Optional, Color = Blue
• Departments plan: Default Applicability = Optional, Color = Red
• Internal plan: Default Applicability = Unavailable, Color = Cyan
These plans organize analytic accounts into different categories. Module automatically assigns "Supply" plan when creating accounts for Supply type orders
Settings → Technical → Models → sale.order showing:
• sale.order model: Base model description "Sales Order"
• sale.order.discount: Discount Wizard (Transient Model)
• sale.order.spreadsheet: Quotation Spreadsheet
• sale.order.template: Quotation Template
• sale.order.line: Sales Order Line
Module extends sale.order model adding sale_type field and action_confirm override
Settings → Technical → Models → account.analytic.account showing:
• Model: account.analytic.account
• Description: Analytic Account
• Type: Base Object (not Transient Model)
Module extends this model adding computed sale_type field with dependencies on name, project_ids, and project_ids.sale_order_id.sale_type
Our Services
Odoo
Customization
Odoo
Migration
Support &
Maintenance
📞 Contact UsWhatsApp: Email: Website: |
🌐 Follow Us📘 Facebook 📸 Instagram 💼 LinkedIn 🎥 YouTube |
© 2025 LucidBrainz | All Rights Reserved
Please log in to comment on this module