diff --git a/.gitignore b/.gitignore
index 3f25e79..accc825 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,15 @@ addons/*.png
.env
.venv
docker-compose.override.yml
+
+# Log / debug dump files
+*.txt
+*.log
+*_logs.txt
+shop_output.html
+upgrade_log.txt
+
+# One-off scripts (keep .ps1 compose scripts but ignore others)
+cleanup_*.py
+fix_*.py
+blog_posts_*.json
diff --git a/GIT_COMMIT_SUMMARY.md b/GIT_COMMIT_SUMMARY.md
deleted file mode 100644
index 884ce58..0000000
--- a/GIT_COMMIT_SUMMARY.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# Git Commit Summary - Chennora Theme Update
-
-## ✅ Files Added to Git:
-
-### New Images (3 files):
-1. `odoo-testing-addons/addons/dine360_theme_chennora/static/src/img/gobi-65.png` (88 KB)
-2. `odoo-testing-addons/addons/dine360_theme_chennora/static/src/img/unlimited-thali.png` (127 KB)
-3. `odoo-testing-addons/addons/dine360_theme_chennora/static/src/img/fish-curry.png` (100 KB)
-
-### Updated Files:
-1. `odoo-testing-addons/addons/dine360_theme_chennora/views/pages.xml` - New 3-card offer section
-2. `odoo-testing-addons/addons/dine360_theme_chennora/__manifest__.py` - Added main.css
-3. `odoo-testing-addons/addons/dine360_theme_chennora/views/layout.xml` - Added Bootstrap Icons
-4. `IMPLEMENTATION_SUMMARY.md` - Documentation
-5. `HOW_TO_UPDATE_THEME.md` - Update guide
-6. `docker-compose.yml` - Changed to client2
-
-## 📝 Commit Message:
-```
-Update Chennora theme with new offer cards and assets
-```
-
-## 🔄 Git Status:
-✅ **Committed locally** - All changes are saved in your local Git repository
-❌ **Not pushed to remote** - Authentication failed when trying to push
-
-## 🚀 To Push to Remote Repository:
-
-You need to authenticate with Git. Run one of these:
-
-### Option 1: Push with credentials
-```bash
-cd d:\ODOO_Final
-git push origin main
-```
-(You'll be prompted for username/password or token)
-
-### Option 2: Configure Git credentials
-```bash
-git config credential.helper store
-git push origin main
-```
-
-### Option 3: Use SSH instead of HTTPS
-```bash
-git remote set-url origin git@github.com:alaguraj/odoo-testing-addons.git
-git push origin main
-```
-
-## 📦 What's in the Commit:
-
-### Changes Made:
-- **3 new food images** for offer cards
-- **Updated homepage design** with dark cards
-- **Bootstrap Icons** added to layout
-- **Main CSS** (335KB) added to theme
-- **Documentation files** for implementation
-
-### Card Design:
-- Dark background (#04121D)
-- Text on left (70%), image on right (30%)
-- Yellow "ORDER NOW" buttons (#FECD4F)
-- Teal and yellow accent colors
-
-## 🔍 Verify the Commit:
-```bash
-git log --oneline -1
-git show HEAD --stat
-```
-
-## 📌 Next Steps:
-
-1. **Authenticate and push** to remote repository
-2. **Upgrade the theme** in Odoo (Apps → Chennora → Upgrade)
-3. **Refresh homepage** to see the new cards
-
-Your changes are safely committed locally! 🎉
diff --git a/HOW_TO_UPDATE_THEME.md b/HOW_TO_UPDATE_THEME.md
deleted file mode 100644
index b4e2454..0000000
--- a/HOW_TO_UPDATE_THEME.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# How to Update the Chennora Theme
-
-## The 3 cards are not showing because the theme module needs to be upgraded in Odoo.
-
-### Quick Fix - Upgrade via Web Interface:
-
-1. **Open your browser** and go to: `http://localhost:10002`
-
-2. **Login to Odoo** with your credentials
-
-3. **Go to Apps** (click the grid icon in top menu)
-
-4. **Remove the "Apps" filter**:
- - You'll see a search bar that says "Apps"
- - Click the ❌ (X) next to "Apps" to remove the filter
-
-5. **Search for "chennora"**:
- - Type "chennora" in the search box
- - You should see "Dine360 Theme Chennora"
-
-6. **Click "Upgrade"**:
- - Click the "Upgrade" button on the module card
- - Wait for the upgrade to complete
-
-7. **Go to Website**:
- - Click "Website" in the top menu
- - Or go to: `http://localhost:10002`
-
-8. **Refresh the page** (Ctrl + F5 or Cmd + Shift + R)
-
-### What Changed:
-
-✅ **3 New Food Images Added:**
-- `gobi-65.png` - Crispy Gobi 65
-- `unlimited-thali.png` - Unlimited Thali
-- `fish-curry.png` - Fiery Fish Curry
-
-✅ **New Card Design:**
-- Dark background (#04121D)
-- Text on left, image on right
-- Yellow "ORDER NOW" buttons
-- Matches your reference design
-
-### If Images Still Don't Show:
-
-The images are located at:
-```
-/dine360_theme_chennora/static/src/img/gobi-65.png
-/dine360_theme_chennora/static/src/img/unlimited-thali.png
-/dine360_theme_chennora/static/src/img/fish-curry.png
-```
-
-You can verify they load by visiting:
-- `http://localhost:10002/dine360_theme_chennora/static/src/img/gobi-65.png`
-- `http://localhost:10002/dine360_theme_chennora/static/src/img/unlimited-thali.png`
-- `http://localhost:10002/dine360_theme_chennora/static/src/img/fish-curry.png`
-
-### Alternative: Restart Everything
-
-If the upgrade doesn't work, try:
-
-```bash
-cd d:\ODOO_Final
-docker-compose down
-docker-compose up
-```
-
-Then upgrade the module again through the web interface.
diff --git a/IMPLEMENTATION_SUMMARY.md b/IMPLEMENTATION_SUMMARY.md
deleted file mode 100644
index c84446e..0000000
--- a/IMPLEMENTATION_SUMMARY.md
+++ /dev/null
@@ -1,142 +0,0 @@
-# Chennora Theme Implementation Summary
-
-## Completed Steps
-
-### 1. Asset Migration
-✅ **Copied main.css** from Vite project to Odoo theme
-- Source: `d:\chennora-final\chennora\src\assets\main.css`
-- Destination: `d:\ODOO_Final\odoo-testing-addons\addons\dine360_theme_chennora\static\src\css\main.css`
-
-✅ **Copied all assets** (images, icons, etc.)
-- Source: `d:\chennora-final\chennora\public\assets`
-- Destination: `d:\ODOO_Final\odoo-testing-addons\addons\dine360_theme_chennora\static\src\assets\`
-- Total: 1039 files copied
-
-✅ **Updated __manifest__.py**
-- Added main.css to assets_frontend
-- Added Bootstrap Icons CDN link to layout.xml
-
-### 2. Homepage Structure Analysis
-
-The Chennora Vite website homepage consists of these sections (in order):
-
-1. **Banner** - Hero carousel with 3 slides
-2. **Offer Cards** - 3 promotional cards (Gobi 65, Unlimited Thali, Fish Curry)
-3. **About Section** - Image + text about the restaurant
-4. **Today's Special** - CTA section with background image
-5. **Categories** - Feature category slider (18+ food categories)
-6. **Popular Menu** - Interactive menu with center image
-7. **Client Testimonials** - Google reviews carousel
-8. **FAQ** - Accordion with 3 questions
-9. **Blog** - Latest 3 blog posts
-10. **Gallery** - Image slider (8 images)
-
-### 3. Current Odoo Implementation Status
-
-✅ **Already Implemented in pages.xml:**
-- Banner carousel (3 slides) ✓
-- Offer cards section ✓
-- About section ✓
-- Today's Special/Why Choose section ✓
-- Categories grid ✓
-- Popular Deals section ✓
-- Testimonials carousel ✓
-- FAQ accordion ✓
-- Blog section ✓
-- Gallery masonry ✓
-
-## What's Missing
-
-### Critical Items:
-
-1. **CSS Asset Loading**
- - Main.css is added but needs verification that all styles load correctly
- - Asset paths need to be updated from `/assets/` to `/dine360_theme_chennora/static/src/assets/`
-
-2. **JavaScript Dependencies**
- - React Slick carousel (used in Vite) → Need Odoo equivalent or vanilla JS
- - Bootstrap Icons (added via CDN)
- - Custom animations and interactions
-
-3. **Dynamic Content**
- - Blog posts (currently hardcoded, need to pull from Odoo blog module)
- - Google Reviews API integration
- - Menu items (need to connect to product catalog)
-
-4. **Asset Path Updates in XML**
- - Update all image references in pages.xml to use correct Odoo paths
- - Currently using `/web/image/` for some, need consistency
-
-## Next Steps
-
-### Phase 1: Asset Path Correction
-```bash
-# Update all asset references in pages.xml from:
-/assets/img/...
-# to:
-/dine360_theme_chennora/static/src/assets/img/...
-```
-
-### Phase 2: Test and Verify
-1. Restart Odoo server
-2. Update the theme module
-3. Check homepage rendering
-4. Verify all images load
-5. Check CSS styling
-
-### Phase 3: Dynamic Content Integration
-1. Connect blog section to Odoo blog posts
-2. Integrate product catalog for menu items
-3. Set up Google Reviews API (if needed)
-
-### Phase 4: JavaScript Enhancements
-1. Add carousel functionality (if not using Odoo's built-in)
-2. Add smooth scroll animations
-3. Add interactive elements
-
-## File Locations
-
-### Odoo Theme Files:
-- **Main Theme**: `d:\ODOO_Final\odoo-testing-addons\addons\dine360_theme_chennora\`
-- **Layout**: `views/layout.xml`
-- **Pages**: `views/pages.xml`
-- **CSS**: `static/src/css/main.css`
-- **Assets**: `static/src/assets/`
-- **Images**: `static/src/img/` (banner images)
-
-### Vite Reference Files:
-- **Source**: `d:\chennora-final\chennora\`
-- **Components**: `src/Components/Home/`
-- **Assets**: `public/assets/`
-- **Main CSS**: `src/assets/main.css`
-
-## Commands to Resume
-
-```bash
-# Navigate to Odoo directory
-cd d:\ODOO_Final
-
-# Restart Odoo (if needed)
-docker-compose restart
-
-# Update module
-# Go to Apps → dine360_theme_chennora → Upgrade
-```
-
-## Key Differences: Vite vs Odoo
-
-| Feature | Vite (React) | Odoo (QWeb) |
-|---------|--------------|-------------|
-| Carousel | React Slick | Bootstrap Carousel |
-| Routing | React Router | Odoo Controllers |
-| State | useState/useEffect | Server-side rendering |
-| Assets | `/assets/` | `/module_name/static/` |
-| Styling | CSS Modules | Global CSS |
-
-## Notes
-
-- The homepage structure in pages.xml closely matches the Vite version
-- Main.css contains all the styling (335KB, 16,263 lines)
-- Bootstrap Icons added via CDN for icon support
-- All promotional images and content are already in place
-- Need to verify asset paths work correctly in Odoo context
diff --git a/PRIMARY_COLOR_CHANGES.md b/PRIMARY_COLOR_CHANGES.md
deleted file mode 100644
index ac844ad..0000000
--- a/PRIMARY_COLOR_CHANGES.md
+++ /dev/null
@@ -1,106 +0,0 @@
-# Odoo Primary Color Change - #fecd4f
-
-## Summary
-Successfully changed the entire Odoo site's primary color to **#fecd4f** (Golden Yellow).
-
-## Changes Made
-
-### 1. Created Theme Variables File
-**File:** `d:\Odoo\addons\dine360_dashboard\static\src\css\theme_variables.css`
-- Defined CSS custom properties (variables) for the primary color and all variations
-- Applied primary color to all common Odoo UI elements:
- - Buttons (primary, save, create)
- - Links and hover states
- - Active/selected states
- - Badges and tags
- - Progress bars
- - Checkboxes and radio buttons
- - Focus states
- - Navigation bar
- - Menu items
- - Kanban views
- - Pagination
- - Tabs
- - Dropdowns
- - Search bars
-
-### 2. Updated Home Menu CSS
-**File:** `d:\Odoo\addons\dine360_dashboard\static\src\css\home_menu.css`
-- App card hover effects now use primary color (#fecd4f)
-- App name hover color changed to primary color
-- User avatar background uses gradient with primary color
-- Badge notifications use primary color
-- AI icon gradient updated to include primary color
-
-### 3. Updated Manifest
-**File:** `d:\Odoo\addons\dine360_dashboard\__manifest__.py`
-- Added `theme_variables.css` to assets list (loads first)
-
-### 4. Existing Login Page
-**File:** `d:\Odoo\addons\dine360_dashboard\static\src\css\login_style.css`
-- Already uses #fecd4f in the gradient background
-- Login button uses gradient from secondary to primary color
-
-## Color Palette
-
-### Primary Colors
-- **Primary:** `#fecd4f` (Golden Yellow)
-- **Primary Dark:** `#e5b846`
-- **Primary Light:** `#ffd970`
-- **Primary Lighter:** `#ffe599`
-
-### Secondary Colors
-- **Secondary:** `#2bb1a5` (Teal/Turquoise)
-- **Secondary Dark:** `#259a8f`
-- **Secondary Light:** `#4dc4b8`
-
-### Gradients
-- **Primary Gradient:** `linear-gradient(135deg, #fecd4f 0%, #ffd970 100%)`
-- **Primary to Secondary:** `linear-gradient(135deg, #fecd4f 0%, #2bb1a5 100%)`
-- **Secondary to Primary:** `linear-gradient(to right, #2bb1a5, #fecd4f)`
-
-## Next Steps
-
-### To Apply Changes:
-1. **Restart Odoo Service:**
- ```bash
- docker-compose restart odoo
- ```
-
-2. **Update the Module:**
- ```bash
- docker-compose exec odoo odoo -u dine360_dashboard -d FOODIES-DELIGHT --stop-after-init
- ```
-
-3. **Clear Browser Cache:**
- - Press `Ctrl + Shift + Delete` (Windows)
- - Clear cached images and files
- - Or use hard refresh: `Ctrl + F5`
-
-### Verification:
-After restarting, check these elements for the primary color:
-- ✅ Login page background and buttons
-- ✅ Home dashboard app cards (hover effect)
-- ✅ Primary buttons throughout Odoo
-- ✅ Links and active menu items
-- ✅ Form save/create buttons
-- ✅ Navigation bar
-- ✅ Selected items in lists/kanban views
-- ✅ Badges and tags
-- ✅ Focus states on input fields
-
-## Customization
-
-To change the primary color in the future, simply edit:
-`d:\Odoo\addons\dine360_dashboard\static\src\css\theme_variables.css`
-
-Update the `--primary-color` variable at the top of the file:
-```css
-:root {
- --primary-color: #YOUR_COLOR_HERE;
- /* ... */
-}
-```
-
-Then restart Odoo and clear browser cache.
-
diff --git a/UBER_INTEGRATION_GUIDE.md b/UBER_INTEGRATION_GUIDE.md
deleted file mode 100644
index b03ce1d..0000000
--- a/UBER_INTEGRATION_GUIDE.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# Dine360 Uber Integration Guide
-
-This guide explains how to configure and use the Uber Integration module in your Odoo system.
-
-## 1. Configuration (Set up API)
-
-Before you can use the integration, you must link your Odoo instance with your Uber Developer account.
-
-### Steps:
-1. **Open Settings**: On your Odoo dashboard, click the **Uber Integration** icon.
-2. **Create New Config**: Click **New** to create a configuration.
-3. **Enter Credentials**:
- * **Name**: Give it a descriptive name (e.g., "Main Store Uber").
- * **Environment**: Set to **Sandbox** for testing or **Production** for live orders.
- * **Client ID & Client Secret**: Get these from your [Uber Developer Dashboard](https://developer.uber.com/).
- * **Customer ID**: Required only for **Uber Direct** (last-mile delivery).
-4. **Test Connection**: Click the **Test Connection** button to verify that Odoo can talk to Uber.
-
----
-
-## 2. Detailed Workflow
-
-The module handles two main flows: **Uber Eats (Incoming Orders)** and **Uber Direct (Outgoing Delivery)**.
-
-### A. Uber Eats Workflow (Incoming)
-1. **Syncing**: Odoo periodically checks for new orders on the Uber Eats platform.
-2. **POS Creation**: When a new order is found, Odoo automatically creates a **POS Order** with the `is_uber_order` flag.
-3. **KDS Notification**: If the `dine360_kds` module is active, the order is immediately sent to the kitchen display for preparation.
-4. **Automatic Confirmation**: Once processed, Odoo sends a confirmation back to Uber so the customer knows their food is being prepared.
-
-### B. Uber Direct Workflow (Outgoing Delivery)
-This is used when a customer orders directly through your POS, but you want to use an Uber driver for delivery.
-
-1. **Create Order**: Create a normal POS order for a customer.
-2. **Payment**: Confirm the payment and validate the order.
-3. **Request Delivery**:
- * Open the validated Order form.
- * Click the **"Request Uber Delivery"** button.
- * Odoo sends the order details (pickup address, dropoff address, items) to Uber.
-4. **Tracking**: Odoo receives an **Uber Delivery ID**.
-5. **Live Updates**: As the Uber driver moves, Odoo receives webhooks and automatically updates the `Uber Status` field on the order:
- * `Pending`: Order sent to Uber, looking for driver.
- * `Pickup`: Driver arrived at restaurant.
- * `In Transit`: Driver is on the way to the customer.
- * `Delivered`: Order completed!
-
----
-
-## 3. Webhook Setup (Crucial for Live Tracking)
-
-To get real-time status updates (like "Driver arrived"), you must configure the Webhook URL in your Uber Developer Portal:
-
-* **Webhook URL**: `https://your-odoo-domain.com/uber/webhook/delivery`
-* **Method**: `POST`
-
----
-
-## 4. Technical Architecture
-* **Module Name**: `dine360_uber`
-* **Security**: Restricted to `Point of Sale / Manager` group.
-* **Persistence**: All Uber statuses are stored directly on the `pos.order` record for easy reporting.
diff --git a/addons/Dine360_Chennora/__manifest__.py b/addons/Dine360_Chennora/__manifest__.py
index e3a6659..6d13734 100644
--- a/addons/Dine360_Chennora/__manifest__.py
+++ b/addons/Dine360_Chennora/__manifest__.py
@@ -11,6 +11,20 @@
'dine360_theme_chennora',
'dine360_kds',
'dine360_reservation',
+ 'dine360_uber',
+ 'dine360_recipe',
+ 'mail',
+ 'calendar',
+ 'contacts',
+ 'crm',
+ 'sale_management',
+ 'board',
+ 'point_of_sale',
+ 'account',
+ 'website',
+ 'purchase',
+ 'stock',
+ 'hr',
],
'uninstall_hook': 'uninstall_hook',
'data': [
diff --git a/addons/dine360_dashboard/controllers/__pycache__/__init__.cpython-310.pyc b/addons/dine360_dashboard/controllers/__pycache__/__init__.cpython-310.pyc
deleted file mode 100644
index 566d5ae..0000000
Binary files a/addons/dine360_dashboard/controllers/__pycache__/__init__.cpython-310.pyc and /dev/null differ
diff --git a/addons/dine360_dashboard/controllers/__pycache__/cors.cpython-310.pyc b/addons/dine360_dashboard/controllers/__pycache__/cors.cpython-310.pyc
deleted file mode 100644
index e986eec..0000000
Binary files a/addons/dine360_dashboard/controllers/__pycache__/cors.cpython-310.pyc and /dev/null differ
diff --git a/addons/dine360_dashboard/controllers/__pycache__/main.cpython-310.pyc b/addons/dine360_dashboard/controllers/__pycache__/main.cpython-310.pyc
deleted file mode 100644
index 028b542..0000000
Binary files a/addons/dine360_dashboard/controllers/__pycache__/main.cpython-310.pyc and /dev/null differ
diff --git a/addons/dine360_dashboard/controllers/main.py b/addons/dine360_dashboard/controllers/main.py
index 56c3cf9..4799358 100644
--- a/addons/dine360_dashboard/controllers/main.py
+++ b/addons/dine360_dashboard/controllers/main.py
@@ -15,50 +15,72 @@ from odoo.addons.website.controllers.main import Website
class ImageHome(Website):
@http.route('/', type='http', auth='public', website=True, sitemap=True)
def index(self, **kwargs):
+ # -----------------------------------------------------------
+ # WEBSITE EDITOR FIX
+ # When Odoo's Website editor loads the site, it opens it in an
+ # iframe. We must NOT intercept that request with our backend
+ # dashboard; instead let the real website homepage render so the
+ # editor can attach to it.
+ #
+ # Detection methods (any one is enough):
+ # 1. Sec-Fetch-Dest == 'iframe' → browser signals iframe load
+ # 2. enable_editor param present → explicit editor activation
+ # 3. ?debug= in query string → editor dev mode coming from /web
+ # -----------------------------------------------------------
+ fetch_dest = request.httprequest.headers.get('Sec-Fetch-Dest', '')
+ is_iframe = fetch_dest == 'iframe'
+ is_editor = kwargs.get('enable_editor') or request.params.get('enable_editor')
+
+ if is_iframe or is_editor:
+ # Let the standard Website controller render the homepage
+ return super(ImageHome, self).index(**kwargs)
+
+ # Not logged in → show the public website homepage
if not request.session.uid:
return request.render('website.homepage')
-
+
# Remove sudo() to respect Odoo's standard menu group restrictions
menus = request.env['ir.ui.menu'].search([
('parent_id', '=', False)
], order='sequence')
-
+
# User role checks
- is_admin = request.env.user.has_group('base.group_system') or request.env.user.has_group('dine360_restaurant.group_restaurant_admin')
- is_kitchen = request.env.user.has_group('dine360_restaurant.group_restaurant_kitchen')
+ try:
+ is_admin = request.env.user.has_group('base.group_system') or \
+ request.env.user.has_group('dine360_restaurant.group_restaurant_admin')
+ is_kitchen = request.env.user.has_group('dine360_restaurant.group_restaurant_kitchen')
+ except Exception:
+ is_admin = request.env.user.has_group('base.group_system')
+ is_kitchen = False
filtered_menus = []
seen_names = set()
for menu in menus:
- # 1. Hide "Apps" for non-admins (usually name is 'Apps' or xmlid has base.menu_management)
+ # 1. Hide "Apps" for non-admins
if (menu.name == 'Apps' or (menu.web_icon and menu.web_icon.startswith('base,'))) and not is_admin:
continue
-
- # 2. Hide "Kitchen (KDS)" for Waiters (only show for Kitchen Staff or Admin)
+
+ # 2. Hide "Kitchen (KDS)" for non-kitchen/non-admin users
if 'Kitchen' in menu.name or 'KDS' in menu.name:
if not (is_kitchen or is_admin):
continue
-
- # 3. De-duplicate by name to prevent double icons (like Kitchen showing twice)
+
+ # 3. De-duplicate by name
if menu.name in seen_names:
continue
seen_names.add(menu.name)
-
+
filtered_menus.append(menu)
-
+
# Low Stock Alerts (Ingredients)
low_stock_products = []
try:
- # Try to get low stock products if the model and method exist
ProductTemplate = request.env['product.template'].sudo()
if hasattr(ProductTemplate, 'get_low_stock_products'):
low_stock_products = ProductTemplate.get_low_stock_products(limit=5)
except Exception:
- # Fallback if module is not yet fully loaded or method missing
low_stock_products = []
-
-
return request.render('dine360_dashboard.image_home_template', {
'menus': filtered_menus,
'user_id': request.env.user,
diff --git a/addons/dine360_dashboard/data/branding_data.xml b/addons/dine360_dashboard/data/branding_data.xml
index 3cf40ad..46e4680 100644
--- a/addons/dine360_dashboard/data/branding_data.xml
+++ b/addons/dine360_dashboard/data/branding_data.xml
@@ -10,10 +10,8 @@
The culinary landscape of Brampton is changing, and Chennora is at the forefront of this revolution. We've combined the soulful flavors of a traditional Indian kitchen with the vibrant energy of a modern bar to create a unique Kitchen Bar concept.
" - } -] diff --git a/cleanup_bad_orders.py b/cleanup_bad_orders.py deleted file mode 100644 index 82e1db7..0000000 --- a/cleanup_bad_orders.py +++ /dev/null @@ -1,13 +0,0 @@ -from odoo import api, SUPERUSER_ID - -env = api.Environment(cr, SUPERUSER_ID, {}) - -# Find bad orders with WEB/ prefix -bad_orders = env['pos.order'].search([('pos_reference', 'like', 'WEB/%')]) -print('Found bad orders:', bad_orders.mapped('pos_reference')) - -if bad_orders: - bad_orders.unlink() - print('Deleted', len(bad_orders), 'bad orders') -else: - print('No bad orders found') diff --git a/fix_pos_references.py b/fix_pos_references.py deleted file mode 100644 index c9d5cee..0000000 --- a/fix_pos_references.py +++ /dev/null @@ -1,70 +0,0 @@ -import re -from odoo import api, SUPERUSER_ID - -env = api.Environment(cr, SUPERUSER_ID, {}) - -# The pattern Odoo core uses: re.search('([0-9-]){14,}', order.pos_reference).group(0) -# It needs at least 14 consecutive digits or hyphens, e.g. "00001-001-0001" -PATTERN = re.compile(r'([0-9-]){14,}') - -print("=" * 60) -print("Scanning ALL pos.orders for bad pos_reference values...") -print("=" * 60) - -# Find all orders that are in an open session (these are the ones loaded on POS open) -open_sessions = env['pos.session'].search([('state', '=', 'opened')]) -print(f"Open sessions found: {open_sessions.mapped('name')}") - -bad_orders = [] -all_orders = env['pos.order'].search([('session_id', 'in', open_sessions.ids)]) -print(f"Total orders in open sessions: {len(all_orders)}") - -for order in all_orders: - ref = order.pos_reference or '' - if not PATTERN.search(ref): - bad_orders.append(order) - print(f" BAD ORDER id={order.id}, pos_reference='{ref}', name='{order.name}'") - -print(f"\nTotal bad orders found: {len(bad_orders)}") - -if bad_orders: - print("\nOptions:") - print(" 1. DELETE bad orders") - print(" 2. FIX pos_reference to a valid format") - print("\nApplying FIX: setting pos_reference to valid format...") - - for order in bad_orders: - old_ref = order.pos_reference - # Generate a valid reference using the order ID padded to match the format - new_ref = f"Order {order.id:05d}-001-0001" - order.write({'pos_reference': new_ref}) - print(f" Fixed order id={order.id}: '{old_ref}' -> '{new_ref}'") - - print(f"\nFixed {len(bad_orders)} orders.") - print("Please restart the POS session and try again.") -else: - print("\nNo bad orders in open sessions. Checking ALL orders...") - - # Also check orders not in any session (orphan orders) - all_pos_orders = env['pos.order'].search([]) - print(f"Total pos.orders in database: {len(all_pos_orders)}") - - really_bad = [] - for order in all_pos_orders: - ref = order.pos_reference or '' - if not PATTERN.search(ref): - really_bad.append(order) - print(f" BAD ORDER id={order.id}, pos_reference='{ref}', session={order.session_id.name}, state={order.state}") - - print(f"\nTotal bad orders in entire DB: {len(really_bad)}") - if really_bad: - for order in really_bad: - old_ref = order.pos_reference - new_ref = f"Order {order.id:05d}-001-0001" - order.write({'pos_reference': new_ref}) - print(f" Fixed id={order.id}: '{old_ref}' -> '{new_ref}'") - print(f"\nFixed {len(really_bad)} orders. Try opening POS again.") - else: - print("\nAll pos_references look valid!") - print("The error might be from a DIFFERENT cause.") - print("Check: is the pricelist_id or sequence_id returning None?") diff --git a/shop_output.html b/shop_output.html deleted file mode 100644 index a972ef6..0000000 Binary files a/shop_output.html and /dev/null differ diff --git a/upgrade_log.txt b/upgrade_log.txt deleted file mode 100644 index 6705a13..0000000 Binary files a/upgrade_log.txt and /dev/null differ