Plan 1 of fusion_maintenance, verified on the Westin Enterprise sandbox (westin-fr-test) via odoo shell. Maintenance policy (enabled/interval/flat fee/service product) on the equipment category + per-product fee override; contract gains fee/source/serial/policy/currency; fixed the dead _spawn_maintenance_contracts and wired it into the existing action_confirm (delivery-date anchor w/ fallback, two-regime serial dedup, fee resolution product->category); reminder email shows the flat fee; category form exposes the policy. Verified: trigger creates 1 priced contract (fee 149, next_due commitment+6mo, source=sale); idempotent on re-confirm; product override beats category; no contract when category not maintainable; fee renders as $149.00. v19.0.2.3.0. NOTE: mail_template_data.xml is noupdate=1 -> the fee line loads on fresh install (the prod deploy) but NOT on -u of an already-installed system. The Westin prod-config test container (workers + log_level=warn) does not run --test-enable post_install tests (a pre-existing module load issue under the test phase), so behaviour was verified by odoo shell instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2024-2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class ProductTemplate(models.Model):
|
|
_inherit = 'product.template'
|
|
|
|
x_fc_repair_category_id = fields.Many2one(
|
|
'fusion.repair.product.category',
|
|
string='Repair Category',
|
|
help='Medical equipment category - drives intake template selection and '
|
|
'technician skills filter for repairs of this product.',
|
|
)
|
|
x_fc_warranty_months = fields.Integer(
|
|
string='Warranty (Months)',
|
|
default=12,
|
|
help='Default warranty period for new units of this product. Used to auto-detect '
|
|
'warranty status on repair intake (delivery date + warranty months >= today).',
|
|
)
|
|
x_fc_maintenance_interval_months = fields.Integer(
|
|
string='Maintenance Interval (Months)',
|
|
default=0,
|
|
help='If > 0, delivering a unit of this product auto-creates a maintenance contract '
|
|
'with this recurring interval. Phase 3 feature.',
|
|
)
|
|
x_fc_maintenance_fee = fields.Monetary(
|
|
string='Maintenance Fee (override)', currency_field='currency_id',
|
|
help='Per-product override of the category maintenance fee. 0 = use the category fee.',
|
|
)
|
|
x_fc_intake_template_id = fields.Many2one(
|
|
'fusion.repair.intake.template',
|
|
string='Intake Template Override',
|
|
help='Optional override of the intake template normally chosen from the '
|
|
'repair category. Leave empty to use category default.',
|
|
)
|
|
# Bundle 9: store labor warranty granted at point of sale.
|
|
x_fc_labor_warranty_years = fields.Integer(
|
|
string='Store Labor Warranty (years)',
|
|
default=0,
|
|
help='Years of store labor warranty granted when this product is sold. '
|
|
'0 = no warranty. Setting this triggers a fusion.repair.labor.warranty '
|
|
'record per unit on sale-order confirm.',
|
|
)
|