# Manual Generic Product Setup in Odoo

## Why Manual Setup?

The API user doesn't have permission to create products in Odoo. This is actually good for security! We'll create the product manually through the Odoo UI.

## Step-by-Step Instructions

### 1. Log into Odoo
- Go to: https://dfaz.ipos.co.zw
- Log in with admin credentials

### 2. Navigate to Products
- Click on **Sales** app (or **Inventory** app)
- Go to **Products** → **Products**
- Click **Create** button

### 3. Fill in Product Details

**General Information:**
- **Product Name:** `Internet Service (Portal Generic)`
- **Product Type:** `Service`
- **Can be Sold:** ✅ Checked
- **Can be Purchased:** ❌ Unchecked

**Sales Tab:**
- **Sales Price:** `0.00` (price will come from order lines)
- **Customer Taxes:** Select your VAT tax (usually 16% VAT)
- **Description for Customers:** 
  ```
  Generic product for customer portal orders.
  Actual service details are in the order line description.
  ```

**General Information Tab:**
- **Internal Reference:** `PORTAL-GENERIC` (optional)
- **Product Category:** Select appropriate category (e.g., "Services" or "Internet Services")

### 4. Save the Product
- Click **Save** button
- Note the product ID from the URL (e.g., `/web#id=123&...`)

### 5. Get the Product ID

**Method 1: From URL**
- After saving, look at the browser URL
- Find the number after `id=`
- Example: `https://dfaz.ipos.co.zw/web#id=456&...` → Product ID is `456`

**Method 2: From Product Form**
- With the product open, click the **⚙️ (gear icon)** or **Debug** menu
- Look for "ID" field
- Note the number

### 6. Update .env File

Add this line to your `.env` file:

```env
ODOO_GENERIC_PRODUCT_ID=456  # Replace 456 with your actual product ID
```

### 7. Update Other Settings

Add these to your `.env` file if not already present:

```env
# Green Zone Automation
AUTO_APPROVE_HIGH_FEASIBILITY=true
AUTO_CREATE_ORDER_LINES=true
AUTO_SCHEDULE_INSTALLATION=false
AUTO_ACTIVATE_SERVICE=false

# Odoo Configuration
ODOO_VAT_TAX_ID=1  # Usually 1, verify in Odoo under Accounting → Configuration → Taxes
```

### 8. Clear Config Cache

```bash
cd afinet-portal-backend
php artisan config:clear
php artisan cache:clear
```

### 9. Verify Setup

Run this command to verify the configuration:

```bash
php artisan tinker
>>> config('services.odoo.generic_product_id')
# Should return your product ID (e.g., 456)
```

## Alternative: Use Existing Product

If you already have a generic "Internet Service" or "Broadband Service" product in Odoo:

1. Find the product in Odoo
2. Note its ID
3. Add to `.env`: `ODOO_GENERIC_PRODUCT_ID=<existing_product_id>`

## Verification

After setup, create a test order and verify:

1. ✅ Order created in portal
2. ✅ Order synced to Odoo
3. ✅ Order has order line with pricing
4. ✅ Order notes contain detailed pricing breakdown

## Troubleshooting

### Can't Find Product ID

**Option A: Use Developer Mode**
1. In Odoo, go to Settings
2. Activate Developer Mode
3. Open the product
4. ID will be visible in the form

**Option B: Use Database Query**
1. In Odoo, go to Settings → Technical → Database Structure → Models
2. Search for "product.product"
3. Click "Records"
4. Find your product and note the ID

### Wrong Tax ID

To find the correct VAT tax ID:
1. Go to Accounting → Configuration → Taxes
2. Open your VAT tax (e.g., "VAT 16%")
3. Note the ID from the URL or developer mode

## Summary

✅ **What You Need:**
- Product ID from Odoo
- VAT Tax ID (usually 1)

✅ **What to Update:**
- `.env` file with `ODOO_GENERIC_PRODUCT_ID`
- Clear config cache

✅ **Result:**
- Orders will have order lines in Odoo
- Pricing will show correctly
- No more $0.00 orders!

---

**Next:** After completing this setup, test with a high feasibility order to verify everything works!
