bemade-addons/helpdesk_sale_order_ai/models/sale_order.py
mathis ed9dda9bea [ADD] openwebui_connector, helpdesk_sale_order_ai: AI-powered sales order generation from helpdesk tickets
This commit introduces AI integration for helpdesk tickets to automatically generate sales orders:

- openwebui_connector: New module providing integration with OpenWebUI AI service
  * Configurable API connection (key, base URL, model)
  * AI prompt template system for reusable prompts
  * Uses Claude 3 Sonnet model by default

- helpdesk_sale_order_ai: Extends helpdesk_sale_order with AI capabilities
  * AI-powered analysis of ticket content to suggest products
  * Smart product quantity parsing from various formats
  * Dedicated UI tab for AI suggestions in helpdesk tickets
  * Auto-creation of sales orders with matched products

The integration streamlines the process of converting customer support requests into sales opportunities.
2025-07-15 15:18:01 -04:00

29 lines
977 B
Python

# -*- coding: utf-8 -*-
from odoo import models, fields, api
class SaleOrder(models.Model):
_inherit = 'sale.order'
# Add missing_product_count field to avoid view errors
# This is needed because some views expect this field
missing_product_count = fields.Integer(
string='Missing Products Count',
default=0,
help='Number of products that could not be found in the database'
)
# Add has_missing_products field to avoid view errors
has_missing_products = fields.Boolean(
string='Has Missing Products',
default=False,
help='Whether this sale order has products that could not be found in the database'
)
# Add ticket_id field to link sale orders to helpdesk tickets
ticket_id = fields.Many2one(
'helpdesk.ticket',
string='Helpdesk Ticket',
readonly=True,
copy=False,
help='Helpdesk ticket from which this sale order was created'
)