# Fusion Central

**Complete ADP Billing Solution for Odoo 19**

Part of the Fusion Claim Assistant product family by Nexa Systems Inc.

## Overview

Fusion Central is a comprehensive solution for managing ADP (Assistive Devices Program) billing in Odoo. It provides automatic calculation of ADP and client portions, professional PDF reports, and seamless integration with your existing workflow.

## Features

### Automatic Portion Calculations
- **Per-line calculations** on sale orders and invoices
- **Client type based rules:**
  - REG: 75% ADP / 25% Client
  - ODS, OWP, ACS, LTC, SEN, CCA: 100% ADP / 0% Client
- Automatic recalculation on quantity or price changes
- Totals displayed on document headers

### Professional PDF Reports
- **Portrait and Landscape** orientations available
- Quotation, Sale Order, and Invoice reports
- Uses Odoo's default company header/footer via `web.external_layout`
- Includes:
  - Company logo and address (from company settings)
  - Billing and delivery address boxes with borders
  - ADP device codes from products (`x_adp_code`)
  - Per-line ADP and client portions with color coding
  - Serial number column
  - Authorizer and sales rep information
  - Payment terms
  - Signature section (if signed)

### Report Templates

| Report | Template ID | Model | Description |
|--------|-------------|-------|-------------|
| Quotation/Order (Portrait) | `fusion_claims.report_saleorder_portrait` | sale.order | Standard portrait layout |
| Quotation/Order (Landscape - ADP) | `fusion_claims.report_saleorder_landscape` | sale.order | Landscape with full ADP columns |
| Invoice (Portrait) | `fusion_claims.report_invoice_portrait` | account.move | Standard portrait layout |
| Invoice (Landscape) | `fusion_claims.report_invoice_landscape` | account.move | Landscape with full ADP columns |

### Report Styling

All reports follow a consistent style:
- **Font**: Arial, 10-12pt depending on section
- **Headers**: Blue background (#0066a1) with white text
- **ADP Portion Column**: Blue header (#1976d2), light blue rows (#e3f2fd)
- **Client Portion Column**: Orange header (#e65100), light orange rows (#fff3e0)
- **Bordered Tables**: All tables have 1px solid black borders
- **Totals**: Right-aligned with proper borders

### Configurable Settings
- Field mappings for existing Odoo Studio fields
- One-click field creation for new installations
- HTML editors for payment terms and refund policy
- Store address configuration
- Field mapping configuration

### ADP Claim Export
- Export invoices to comma-separated TXT format
- Compatible with ADP submission systems
- Automatic file naming with submission numbers
- Optional Documents app integration

## Installation

1. Copy the `fusion_claims` folder to your Odoo addons directory
2. Update the apps list in Odoo
3. Install "Fusion Central" from the Apps menu

## Configuration

### Quick Setup (Settings → Sales → Fusion Central)

1. **Create Fields:**
   - Click "Create Sale Order Fields"
   - Click "Create Invoice Fields"
   - Click "Create Product Fields"

2. **Or Detect Existing Fields:**
   - Click "Detect Existing Fields" if you have existing custom fields

3. **Configure Company Info:**
   - Store Address Line 1 & 2
   - Company Tagline
   - E-Transfer Email
   - Cheque Payable To

4. **Add Payment Terms:**
   - Use the HTML editor to format your payment terms

5. **Add Refund Policy:**
   - Enable "Include Refund Policy Page"
   - Paste your refund policy HTML

### Field Mappings

The module uses the following fields:

#### Sale Order Fields
| Field | Technical Name | Description |
|-------|---------------|-------------|
| Sale Type | x_fc_sale_type | ADP, ADP/ODSP, REG, etc. |
| Client Type | x_fc_client_type | REG, ODS, OWP, ACS, LTC, SEN, CCA |
| Authorizer | x_fc_authorizer_id | Many2one to res.partner |
| Claim Number | x_fc_claim_number | ADP claim reference |
| Delivery Date | x_fc_adp_delivery_date | Device delivery date |
| Client Ref 1 | x_fc_client_ref_1 | Client reference 1 |
| Client Ref 2 | x_fc_client_ref_2 | Client reference 2 |
| Service Start | x_fc_service_start_date | Service start date |
| Service End | x_fc_service_end_date | Service end date |

#### Sale Order Line Fields
| Field | Technical Name | Description |
|-------|---------------|-------------|
| Serial Number | x_fc_serial_number | Device serial number |
| ADP Portion | x_fc_adp_portion | Calculated ADP amount |
| Client Portion | x_fc_client_portion | Calculated client amount |
| Device Placement | x_fc_device_placement | L/R/N/A placement |

#### Invoice Fields
| Field | Technical Name | Description |
|-------|---------------|-------------|
| Invoice Type | x_fc_invoice_type | ADP, ADP Client Portion, ODSP, WSIB, etc. |
| Claim Number | x_fc_claim_number | ADP claim reference |
| Authorizer | x_fc_authorizer_id | Many2one to res.partner |
| Delivery Date | x_fc_adp_delivery_date | Device delivery date |

#### Product Fields
| Field | Technical Name | Description |
|-------|---------------|-------------|
| ADP Code | x_adp_code | ADP device code for billing |

## Usage

### Sale Orders
1. Create a sale order
2. Set Sale Type to "ADP" or "ADP/ODSP"
3. Set Client Type (REG, ODS, etc.)
4. Add products - ADP and Client portions calculate automatically
5. Print using Portrait or Landscape report

### Invoices
1. Create invoice (or generate from sale order)
2. Set Invoice Type to "ADP" or "ADP/ODSP"
3. Portions display automatically
4. Use "Export ADP" button to generate claim file
5. Print using Portrait or Landscape report

## Odoo 19 Compatibility Notes

This module has been updated for Odoo 19 with the following changes:

1. **QWeb Templates**: 
   - Removed `hasattr` calls (not supported in Odoo 19 QWeb)
   - Changed `product_uom` to `product_uom_id`
   - Changed `tax_id` to `tax_ids`
   - Use `t-else=""` instead of checking for `display_type == False`

2. **Report Templates**:
   - Use only `web.external_layout` for headers/footers
   - Removed duplicate header/footer template calls
   - Added explicit CSS borders (Bootstrap border classes don't render in PDF)

3. **Field Names**:
   - All fields use the `x_fc_*` naming convention

## Requirements

- Odoo 19.0
- Dependencies: base, sale, sale_management, account

## Changelog

### Version 19.0.1.0.0 (December 2025)
- Updated for Odoo 19 compatibility
- Rewrote all report templates with consistent styling
- Fixed QWeb template issues (hasattr, field names)
- Added explicit CSS borders for PDF rendering
- Improved authorizer field display (Many2one handling)
- Removed duplicate header/footer calls
- Standardized all field mappings to x_fc_* fields

### Version 18.0.1.0.0
- Initial release for Odoo 18

## Support

**Developer:** Nexa Systems Inc.
**Website:** https://www.nexasystems.ca
**Email:** support@nexasystems.ca

## License

Odoo Proprietary License v1.0 (OPL-1)

Copyright © 2024-2025 Nexa Systems Inc. All rights reserved.
