feat(fusion_claims): allow order-less tasks + service-repair SO flag
Relaxes _check_order_link to a no-op (service bookings auto-create their SO; in-shop/walk-in tasks may have none) and adds x_fc_is_service_repair on sale.order. The 'Service Repair' crm.tag from the plan is intentionally omitted: fusion_claims does not depend on crm and sale.order has no tag_ids; the boolean flag is the repair-SO identity. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -338,6 +338,11 @@ class SaleOrder(models.Model):
|
||||
help='Type of sale for billing purposes. This field determines the workflow and billing rules.',
|
||||
)
|
||||
|
||||
x_fc_is_service_repair = fields.Boolean(
|
||||
string='Service Repair', copy=False,
|
||||
help='Auto-created from the technician service booking wizard.',
|
||||
)
|
||||
|
||||
x_fc_sale_type_locked = fields.Boolean(
|
||||
string='Sale Type Locked',
|
||||
compute='_compute_sale_type_locked',
|
||||
|
||||
@@ -9,7 +9,7 @@ features to the base fusion.technician.task model.
|
||||
"""
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.exceptions import UserError
|
||||
from markupsafe import Markup
|
||||
import logging
|
||||
|
||||
@@ -104,15 +104,9 @@ class FusionTechnicianTaskClaims(models.Model):
|
||||
|
||||
@api.constrains('sale_order_id', 'purchase_order_id')
|
||||
def _check_order_link(self):
|
||||
for task in self:
|
||||
if task.x_fc_sync_source:
|
||||
continue
|
||||
if task.task_type == 'ltc_visit':
|
||||
continue
|
||||
if not task.sale_order_id and not task.purchase_order_id:
|
||||
raise ValidationError(_(
|
||||
"A task must be linked to either a Sale Order (Case) or a Purchase Order."
|
||||
))
|
||||
# Relaxed 2026-06: service bookings auto-create their SO, and in-shop /
|
||||
# walk-in tasks may legitimately have none. No order link is required anymore.
|
||||
return
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# HOOK OVERRIDES
|
||||
|
||||
Reference in New Issue
Block a user