feat(fusion_plating): quote-to-cash infra, notifications, wizards, Tier 1 plating features

Quote-to-cash PDF reports (portrait + landscape variants, 16 new actions):
- Quotation / Sales Order, Work Order Traveller, Packing Slip, Bill of Lading,
  Certificate of Conformance (portrait added), Invoice, Payment Receipt
- Shared fp_portrait_styles + fp_landscape_styles base templates

Workflow gap fixes (fusion_plating_bridge_mrp):
- Auto-assign recipe from SO coating config in MrpProduction.action_confirm
- Auto-create draft CoC (fp.certificate) on MrpProduction.button_mark_done

Notifications overhaul (fusion_plating_notifications v2.0):
- Expanded TRIGGER_EVENTS to 7 (added quote_sent, mo_complete, shipped, payment_received)
- Shared _dispatch method replaces three duplicated send helpers
- Auto-attach PDF reports per template config (quote, SO, CoC, invoice, receipt, BoL)
- Rebuilt 7 email templates with fusion_claims accent-bar design
  (info/success color-coded, theme-safe, 600px max-width)
- New hooks: MrpProduction done, FpDelivery mark_delivered, AccountPayment post,
  SaleOrder action_quotation_send

Wizards (fusion_plating_configurator):
- fp.direct.order.wizard — skip quotation for repeat customers with PO in hand;
  optional new-revision drawing upload bumps fp.part.catalog revision and links
  new rev to the SO; creates + confirms the SO in one step
- fp.part.catalog.import.wizard — 3-step CSV import with dry-run preview,
  tolerant parsing (customer by name/email/xmlid, human-readable selections),
  duplicate detection, create-missing-customers option, single transaction commit
- Partner form stat buttons: Direct Order, Import Parts
- CSV template download button

Tier 1 practical plating features:
- T1.1 Hydrogen bake window enforcement (fp.coating.config.requires_bake_relief,
  auto-create fusion.plating.bake.window on plating WO finish, FpDelivery lockout
  when window is open)
- T1.2 Bath replenishment rules + pending suggestion queue
  (fusion.plating.bath.replenishment.rule + .suggestion, hook on bath log line
  create, operator Apply / Dismiss actions)
- T1.3 Rack/fixture library (fusion.plating.rack with MTO counter, strip
  schedule, lifecycle: active → needs_strip → stripping → retired)
- T1.4 Rework / strip-and-replate MOs (x_fc_is_rework, x_fc_original_production_id,
  Create Rework stat button on completed MOs)
- T1.5 Parts location (x_fc_current_location computed on mrp.production —
  "In progress: Alkaline Clean" / "Queued: Bake Oven" / "Ready to Ship")

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-16 23:41:12 -04:00
parent 7c7ef06057
commit d3dd6376a6
51 changed files with 5231 additions and 197 deletions

View File

@@ -5,7 +5,7 @@
{
'name': 'Fusion Plating',
'version': '19.0.1.0.0',
'version': '19.0.2.0.0',
'category': 'Manufacturing/Plating',
'summary': 'Core plating / metal finishing ERP: facilities, processes, tanks, baths, jobs, operators.',
'description': """
@@ -90,6 +90,8 @@ Copyright (c) 2026 Nexa Systems Inc. All rights reserved.
'views/fp_facility_views.xml',
'views/fp_bath_views.xml',
'views/fp_process_node_views.xml',
'views/fp_rack_views.xml',
'views/fp_bath_replenishment_views.xml',
'views/fp_menu.xml',
'data/fp_recipe_enp_alum_basic.xml',
],

View File

@@ -12,5 +12,7 @@ from . import fp_bath
from . import fp_bath_log
from . import fp_bath_log_line
from . import fp_bath_parameter
from . import fp_bath_replenishment_rule
from . import fp_process_node
from . import fp_rack
from . import res_company

View File

@@ -112,3 +112,47 @@ class FpBathLogLine(models.Model):
rec.status = 'warning'
else:
rec.status = 'ok'
# ------------------------------------------------------------------
# T1.2 — Auto-suggest replenishment on every log line
# ------------------------------------------------------------------
@api.model_create_multi
def create(self, vals_list):
lines = super().create(vals_list)
lines._spawn_replenishment_suggestions()
return lines
def _spawn_replenishment_suggestions(self):
"""For every out-of-spec reading, run the matching replenishment
rule and create a pending suggestion the operator can apply."""
Rule = self.env['fusion.plating.bath.replenishment.rule']
Suggestion = self.env['fusion.plating.bath.replenishment.suggestion']
for line in self:
if not line.parameter_id or not line.log_id.bath_id:
continue
bath = line.log_id.bath_id
rules = Rule._find_rules(bath, line.parameter_id.id)
for rule in rules:
dose = rule._compute_dose(
line.value, line.target_min, line.target_max, bath.volume,
)
if dose <= 0:
continue
Suggestion.create({
'bath_id': bath.id,
'log_line_id': line.id,
'rule_id': rule.id,
'parameter_id': line.parameter_id.id,
'current_value': line.value,
'target_min': line.target_min,
'target_max': line.target_max,
'product_name': rule.product_name,
'dose_amount': dose,
'dose_uom': rule.dose_uom,
'state': 'pending',
})
bath.message_post(
body=f'Replenishment suggested: add {dose} {rule.dose_uom} '
f'of {rule.product_name} ({line.parameter_id.name} '
f'reading: {line.value})',
)

View File

@@ -0,0 +1,161 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
from odoo import api, fields, models
class FpBathReplenishmentRule(models.Model):
"""Linear replenishment rule: when a chemistry reading drifts outside
target, calculate how much replenisher to add.
The formula is deliberately simple:
dose = deficit × bath.volume × dose_rate
where deficit = (target_min value) for below_min rules
or = (value target_max) for above_max rules.
Shops wanting non-linear or piecewise rules can extend this model.
"""
_name = 'fusion.plating.bath.replenishment.rule'
_description = 'Fusion Plating — Replenishment Rule'
_order = 'process_type_id, parameter_id'
name = fields.Char(string='Rule Name', required=True)
process_type_id = fields.Many2one(
'fusion.plating.process.type', string='Process Type',
help='If set, this rule applies to every bath running this process. '
'Leave blank and set bath_id for a bath-specific rule.',
)
bath_id = fields.Many2one(
'fusion.plating.bath', string='Specific Bath',
help='Narrow the rule to a single bath (overrides process-level rule).',
)
parameter_id = fields.Many2one(
'fusion.plating.bath.parameter', string='Parameter', required=True,
)
trigger = fields.Selection(
[('below_min', 'Reading Below Target Min'),
('above_max', 'Reading Above Target Max')],
string='Trigger', required=True, default='below_min',
)
product_name = fields.Char(
string='Replenisher Name', required=True,
help='Human-readable chemical name, e.g. "Nickel Sulfamate 30% — Grade A"',
)
product_id = fields.Many2one(
'product.product', string='Product (Inventory)',
help='Optional link to an inventory product for consumption tracking.',
)
dose_rate = fields.Float(
string='Dose Rate', required=True, digits=(12, 4),
help='Amount of replenisher per unit of parameter deficit per gallon '
'of bath volume. E.g. 0.5 means "add 0.5 mL per (g/L deficit) per gallon".',
)
dose_uom = fields.Selection(
[('ml', 'mL'), ('oz', 'fl oz'), ('g', 'g'), ('lb', 'lb'), ('l', 'L')],
string='Dose UoM', required=True, default='ml',
)
min_dose = fields.Float(
string='Minimum Dose', default=0.0,
help='Do not suggest doses below this (useful to avoid noise).',
)
max_dose = fields.Float(
string='Safety Cap', default=0.0,
help='Cap the suggested dose. 0 = no cap.',
)
notes = fields.Text(string='Operator Notes')
active = fields.Boolean(default=True)
@api.model
def _find_rules(self, bath, parameter_id):
"""Return rules applicable to this (bath, parameter). Bath-specific
rules take precedence over process-level ones.
"""
bath_rule = self.search([
('bath_id', '=', bath.id),
('parameter_id', '=', parameter_id),
('active', '=', True),
])
if bath_rule:
return bath_rule
return self.search([
('bath_id', '=', False),
('process_type_id', '=', bath.process_type_id.id),
('parameter_id', '=', parameter_id),
('active', '=', True),
])
def _compute_dose(self, value, target_min, target_max, bath_volume):
"""Return a dose amount for this rule given the reading context.
Returns 0.0 if the trigger doesn't apply.
"""
self.ensure_one()
deficit = 0.0
if self.trigger == 'below_min' and target_min and value < target_min:
deficit = target_min - value
elif self.trigger == 'above_max' and target_max and value > target_max:
deficit = value - target_max
if deficit <= 0:
return 0.0
dose = deficit * (bath_volume or 1.0) * self.dose_rate
if self.min_dose and dose < self.min_dose:
return 0.0
if self.max_dose and dose > self.max_dose:
dose = self.max_dose
return round(dose, 3)
class FpBathReplenishmentSuggestion(models.Model):
"""One suggestion generated from a bath-log reading. Operators mark
them applied or dismissed once the dose has been added."""
_name = 'fusion.plating.bath.replenishment.suggestion'
_description = 'Fusion Plating — Replenishment Suggestion'
_inherit = ['mail.thread']
_order = 'create_date desc, id desc'
bath_id = fields.Many2one(
'fusion.plating.bath', string='Bath', required=True, ondelete='cascade',
)
log_line_id = fields.Many2one(
'fusion.plating.bath.log.line', string='Triggering Reading',
ondelete='cascade',
)
rule_id = fields.Many2one(
'fusion.plating.bath.replenishment.rule', string='Rule',
ondelete='set null',
)
parameter_id = fields.Many2one(
'fusion.plating.bath.parameter', string='Parameter', required=True,
)
current_value = fields.Float(string='Current Reading', digits=(12, 4))
target_min = fields.Float(string='Target Min', digits=(12, 4))
target_max = fields.Float(string='Target Max', digits=(12, 4))
product_name = fields.Char(string='Replenisher', required=True)
dose_amount = fields.Float(string='Suggested Dose', digits=(12, 3))
dose_uom = fields.Selection(
[('ml', 'mL'), ('oz', 'fl oz'), ('g', 'g'), ('lb', 'lb'), ('l', 'L')],
string='UoM', required=True, default='ml',
)
state = fields.Selection(
[('pending', 'Pending'), ('applied', 'Applied'), ('dismissed', 'Dismissed')],
default='pending', tracking=True,
)
applied_at = fields.Datetime(readonly=True)
applied_by_id = fields.Many2one('res.users', readonly=True)
def action_apply(self):
for rec in self:
rec.write({
'state': 'applied',
'applied_at': fields.Datetime.now(),
'applied_by_id': self.env.user.id,
})
rec.bath_id.message_post(
body=f'Replenishment applied: {rec.dose_amount} {rec.dose_uom} '
f'of {rec.product_name} (parameter: {rec.parameter_id.name})'
)
def action_dismiss(self):
self.write({'state': 'dismissed'})

View File

@@ -0,0 +1,117 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
from odoo import api, fields, models, _
class FpRack(models.Model):
"""Plating rack / barrel / fixture.
Racks carry parts through baths and accumulate nickel themselves over
time. Once the rack's metal turnover (MTO) count exceeds the strip
interval, the rack must be stripped before re-use to avoid bald spots
on parts.
"""
_name = 'fusion.plating.rack'
_description = 'Fusion Plating — Rack / Fixture'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'facility_id, rack_type, name'
name = fields.Char(string='Rack ID', required=True, tracking=True)
rack_type = fields.Selection(
[('rack', 'Rack'), ('barrel', 'Barrel'),
('fixture', 'Fixture'), ('basket', 'Basket')],
string='Type', required=True, default='rack',
)
facility_id = fields.Many2one(
'fusion.plating.facility', string='Facility', required=True, tracking=True,
)
company_id = fields.Many2one(
'res.company', related='facility_id.company_id', store=True, readonly=True,
)
capacity = fields.Integer(
string='Capacity (parts)',
help='Max parts per load. Used for batch planning.',
)
contact_points = fields.Integer(
string='Contact Points',
help='Number of clips/tips that touch parts. Wear points for re-stripping.',
)
# --- Wear tracking ---
mto_count = fields.Float(
string='MTO (current)', default=0.0, tracking=True,
help='Metal turnover accumulated since last strip.',
)
strip_interval_mto = fields.Float(
string='Strip After (MTO)', default=3.0,
help='When MTO crosses this value, rack needs stripping.',
)
last_stripped_date = fields.Datetime(string='Last Stripped', tracking=True)
last_stripped_by_id = fields.Many2one(
'res.users', string='Stripped By', tracking=True,
)
strips_count = fields.Integer(string='Total Strips', default=0, readonly=True)
state = fields.Selection(
[('active', 'Active'),
('needs_strip', 'Needs Strip'),
('stripping', 'Stripping'),
('retired', 'Retired')],
string='Status', default='active', required=True, tracking=True,
compute='_compute_state', store=True, readonly=False,
)
status_color = fields.Integer(compute='_compute_status_color')
notes = fields.Html(string='Notes')
active = fields.Boolean(default=True)
_sql_constraints = [
('fp_rack_facility_name_uniq', 'unique(facility_id, name)',
'Rack ID must be unique per facility.'),
]
# ------------------------------------------------------------------
# Computes
# ------------------------------------------------------------------
@api.depends('mto_count', 'strip_interval_mto')
def _compute_state(self):
for rec in self:
if rec.state in ('stripping', 'retired'):
continue # Manually set — don't override
if rec.strip_interval_mto and rec.mto_count >= rec.strip_interval_mto:
rec.state = 'needs_strip'
elif rec.state != 'active':
rec.state = 'active'
@api.depends('state')
def _compute_status_color(self):
mapping = {'active': 4, 'needs_strip': 3, 'stripping': 2, 'retired': 10}
for rec in self:
rec.status_color = mapping.get(rec.state, 0)
# ------------------------------------------------------------------
# Actions
# ------------------------------------------------------------------
def action_start_strip(self):
self.write({'state': 'stripping'})
def action_mark_stripped(self):
for rec in self:
rec.write({
'state': 'active',
'mto_count': 0.0,
'last_stripped_date': fields.Datetime.now(),
'last_stripped_by_id': self.env.user.id,
'strips_count': rec.strips_count + 1,
})
rec.message_post(body=_('Rack stripped and returned to service.'))
def action_retire(self):
self.write({'state': 'retired', 'active': False})
def _increment_mto(self, delta=1.0):
"""Add `delta` to the rack's MTO count. Called by the WO finish hook."""
for rec in self:
rec.mto_count = (rec.mto_count or 0.0) + delta

View File

@@ -32,3 +32,12 @@ access_fp_process_node_manager,fp.process.node.manager,model_fusion_plating_proc
access_fp_process_node_input_operator,fp.process.node.input.operator,model_fusion_plating_process_node_input,group_fusion_plating_operator,1,0,0,0
access_fp_process_node_input_supervisor,fp.process.node.input.supervisor,model_fusion_plating_process_node_input,group_fusion_plating_supervisor,1,1,1,0
access_fp_process_node_input_manager,fp.process.node.input.manager,model_fusion_plating_process_node_input,group_fusion_plating_manager,1,1,1,1
access_fp_rack_operator,fp.rack.operator,model_fusion_plating_rack,group_fusion_plating_operator,1,1,0,0
access_fp_rack_supervisor,fp.rack.supervisor,model_fusion_plating_rack,group_fusion_plating_supervisor,1,1,1,0
access_fp_rack_manager,fp.rack.manager,model_fusion_plating_rack,group_fusion_plating_manager,1,1,1,1
access_fp_replenishment_rule_operator,fp.replenishment.rule.operator,model_fusion_plating_bath_replenishment_rule,group_fusion_plating_operator,1,0,0,0
access_fp_replenishment_rule_supervisor,fp.replenishment.rule.supervisor,model_fusion_plating_bath_replenishment_rule,group_fusion_plating_supervisor,1,1,1,0
access_fp_replenishment_rule_manager,fp.replenishment.rule.manager,model_fusion_plating_bath_replenishment_rule,group_fusion_plating_manager,1,1,1,1
access_fp_replenishment_suggestion_operator,fp.replenishment.suggestion.operator,model_fusion_plating_bath_replenishment_suggestion,group_fusion_plating_operator,1,1,1,0
access_fp_replenishment_suggestion_supervisor,fp.replenishment.suggestion.supervisor,model_fusion_plating_bath_replenishment_suggestion,group_fusion_plating_supervisor,1,1,1,0
access_fp_replenishment_suggestion_manager,fp.replenishment.suggestion.manager,model_fusion_plating_bath_replenishment_suggestion,group_fusion_plating_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
32 access_fp_process_node_input_operator fp.process.node.input.operator model_fusion_plating_process_node_input group_fusion_plating_operator 1 0 0 0
33 access_fp_process_node_input_supervisor fp.process.node.input.supervisor model_fusion_plating_process_node_input group_fusion_plating_supervisor 1 1 1 0
34 access_fp_process_node_input_manager fp.process.node.input.manager model_fusion_plating_process_node_input group_fusion_plating_manager 1 1 1 1
35 access_fp_rack_operator fp.rack.operator model_fusion_plating_rack group_fusion_plating_operator 1 1 0 0
36 access_fp_rack_supervisor fp.rack.supervisor model_fusion_plating_rack group_fusion_plating_supervisor 1 1 1 0
37 access_fp_rack_manager fp.rack.manager model_fusion_plating_rack group_fusion_plating_manager 1 1 1 1
38 access_fp_replenishment_rule_operator fp.replenishment.rule.operator model_fusion_plating_bath_replenishment_rule group_fusion_plating_operator 1 0 0 0
39 access_fp_replenishment_rule_supervisor fp.replenishment.rule.supervisor model_fusion_plating_bath_replenishment_rule group_fusion_plating_supervisor 1 1 1 0
40 access_fp_replenishment_rule_manager fp.replenishment.rule.manager model_fusion_plating_bath_replenishment_rule group_fusion_plating_manager 1 1 1 1
41 access_fp_replenishment_suggestion_operator fp.replenishment.suggestion.operator model_fusion_plating_bath_replenishment_suggestion group_fusion_plating_operator 1 1 1 0
42 access_fp_replenishment_suggestion_supervisor fp.replenishment.suggestion.supervisor model_fusion_plating_bath_replenishment_suggestion group_fusion_plating_supervisor 1 1 1 0
43 access_fp_replenishment_suggestion_manager fp.replenishment.suggestion.manager model_fusion_plating_bath_replenishment_suggestion group_fusion_plating_manager 1 1 1 1

View File

@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- ===== Rule List ===== -->
<record id="view_fp_replenishment_rule_list" model="ir.ui.view">
<field name="name">fp.replenishment.rule.list</field>
<field name="model">fusion.plating.bath.replenishment.rule</field>
<field name="arch" type="xml">
<list>
<field name="name"/>
<field name="process_type_id"/>
<field name="bath_id"/>
<field name="parameter_id"/>
<field name="trigger"/>
<field name="product_name"/>
<field name="dose_rate"/>
<field name="dose_uom"/>
<field name="active" widget="boolean_toggle"/>
</list>
</field>
</record>
<!-- ===== Rule Form ===== -->
<record id="view_fp_replenishment_rule_form" model="ir.ui.view">
<field name="name">fp.replenishment.rule.form</field>
<field name="model">fusion.plating.bath.replenishment.rule</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<h1><field name="name"/></h1>
</div>
<group>
<group string="Scope">
<field name="process_type_id"/>
<field name="bath_id"/>
<field name="parameter_id"/>
<field name="trigger"/>
</group>
<group string="Dose">
<field name="product_name"/>
<field name="product_id"/>
<field name="dose_rate"/>
<field name="dose_uom"/>
<field name="min_dose"/>
<field name="max_dose"/>
</group>
</group>
<group string="Notes">
<field name="notes" nolabel="1" colspan="2"/>
</group>
<group>
<field name="active" widget="boolean_toggle"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_fp_replenishment_rule" model="ir.actions.act_window">
<field name="name">Replenishment Rules</field>
<field name="res_model">fusion.plating.bath.replenishment.rule</field>
<field name="view_mode">list,form</field>
</record>
<!-- ===== Suggestion List ===== -->
<record id="view_fp_replenishment_suggestion_list" model="ir.ui.view">
<field name="name">fp.replenishment.suggestion.list</field>
<field name="model">fusion.plating.bath.replenishment.suggestion</field>
<field name="arch" type="xml">
<list decoration-info="state == 'pending'"
decoration-muted="state in ('applied','dismissed')"
default_order="create_date desc">
<field name="create_date" optional="show"/>
<field name="bath_id"/>
<field name="parameter_id"/>
<field name="current_value"/>
<field name="target_min"/>
<field name="target_max"/>
<field name="product_name"/>
<field name="dose_amount"/>
<field name="dose_uom"/>
<field name="state" widget="badge"
decoration-info="state == 'pending'"
decoration-success="state == 'applied'"
decoration-muted="state == 'dismissed'"/>
<button name="action_apply" type="object"
string="Apply" class="btn-primary"
invisible="state != 'pending'" icon="fa-check"/>
<button name="action_dismiss" type="object"
string="Dismiss"
invisible="state != 'pending'" icon="fa-times"/>
</list>
</field>
</record>
<!-- ===== Suggestion Form ===== -->
<record id="view_fp_replenishment_suggestion_form" model="ir.ui.view">
<field name="name">fp.replenishment.suggestion.form</field>
<field name="model">fusion.plating.bath.replenishment.suggestion</field>
<field name="arch" type="xml">
<form>
<header>
<button name="action_apply" string="Apply"
type="object" class="btn-primary"
invisible="state != 'pending'"/>
<button name="action_dismiss" string="Dismiss"
type="object" class="btn-secondary"
invisible="state != 'pending'"/>
<field name="state" widget="statusbar"
statusbar_visible="pending,applied"/>
</header>
<sheet>
<group>
<group string="Context">
<field name="bath_id"/>
<field name="parameter_id"/>
<field name="log_line_id"/>
<field name="rule_id"/>
</group>
<group string="Reading vs Target">
<field name="current_value"/>
<field name="target_min"/>
<field name="target_max"/>
</group>
</group>
<group string="Suggested Dose">
<group>
<field name="product_name"/>
<field name="dose_amount"/>
<field name="dose_uom"/>
</group>
<group>
<field name="applied_at"/>
<field name="applied_by_id"/>
</group>
</group>
</sheet>
<chatter/>
</form>
</field>
</record>
<record id="action_fp_replenishment_suggestion" model="ir.actions.act_window">
<field name="name">Replenishment Suggestions</field>
<field name="res_model">fusion.plating.bath.replenishment.suggestion</field>
<field name="view_mode">list,form</field>
<field name="context">{'search_default_pending': 1}</field>
</record>
</odoo>

View File

@@ -43,6 +43,24 @@
action="action_fp_tank"
sequence="30"/>
<menuitem id="menu_fp_racks"
name="Racks &amp; Fixtures"
parent="menu_fp_operations"
action="action_fp_rack"
sequence="35"/>
<menuitem id="menu_fp_replenishment_suggestions"
name="Replenishment Suggestions"
parent="menu_fp_operations"
action="action_fp_replenishment_suggestion"
sequence="40"/>
<menuitem id="menu_fp_replenishment_rules"
name="Replenishment Rules"
parent="menu_fp_config"
action="action_fp_replenishment_rule"
sequence="55"/>
<!-- ===== CONFIGURATION ===== -->
<menuitem id="menu_fp_config"
name="Configuration"

View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- ===== List ===== -->
<record id="view_fp_rack_list" model="ir.ui.view">
<field name="name">fusion.plating.rack.list</field>
<field name="model">fusion.plating.rack</field>
<field name="arch" type="xml">
<list decoration-danger="state == 'needs_strip'"
decoration-warning="state == 'stripping'"
decoration-muted="state == 'retired'">
<field name="name"/>
<field name="rack_type"/>
<field name="facility_id"/>
<field name="capacity"/>
<field name="mto_count"/>
<field name="strip_interval_mto"/>
<field name="last_stripped_date"/>
<field name="strips_count"/>
<field name="state" widget="badge"
decoration-success="state == 'active'"
decoration-danger="state == 'needs_strip'"
decoration-warning="state == 'stripping'"
decoration-muted="state == 'retired'"/>
</list>
</field>
</record>
<!-- ===== Form ===== -->
<record id="view_fp_rack_form" model="ir.ui.view">
<field name="name">fusion.plating.rack.form</field>
<field name="model">fusion.plating.rack</field>
<field name="arch" type="xml">
<form>
<header>
<button name="action_start_strip"
string="Start Strip"
type="object" class="btn-primary"
invisible="state != 'needs_strip'"/>
<button name="action_mark_stripped"
string="Mark Stripped"
type="object" class="btn-primary"
invisible="state != 'stripping'"/>
<button name="action_retire"
string="Retire"
type="object" class="btn-secondary"
invisible="state == 'retired'"
confirm="Retire this rack permanently?"/>
<field name="state" widget="statusbar"
statusbar_visible="active,needs_strip,stripping"/>
</header>
<sheet>
<div class="oe_title">
<h1><field name="name" placeholder="e.g. RACK-014"/></h1>
</div>
<group>
<group string="Identity">
<field name="rack_type"/>
<field name="facility_id"/>
<field name="capacity"/>
<field name="contact_points"/>
</group>
<group string="Wear &amp; Strip">
<field name="mto_count"/>
<field name="strip_interval_mto"/>
<field name="last_stripped_date"/>
<field name="last_stripped_by_id"/>
<field name="strips_count"/>
</group>
</group>
<group string="Notes">
<field name="notes" nolabel="1" colspan="2"/>
</group>
</sheet>
<chatter/>
</form>
</field>
</record>
<!-- ===== Kanban ===== -->
<record id="view_fp_rack_kanban" model="ir.ui.view">
<field name="name">fusion.plating.rack.kanban</field>
<field name="model">fusion.plating.rack</field>
<field name="arch" type="xml">
<kanban default_group_by="state">
<field name="status_color"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click oe_kanban_color_#{record.status_color.raw_value}">
<strong><field name="name"/></strong>
<div><field name="rack_type"/><field name="facility_id"/></div>
<div>MTO: <field name="mto_count"/> / <field name="strip_interval_mto"/></div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- ===== Search ===== -->
<record id="view_fp_rack_search" model="ir.ui.view">
<field name="name">fusion.plating.rack.search</field>
<field name="model">fusion.plating.rack</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="facility_id"/>
<filter name="needs_strip" string="Needs Strip"
domain="[('state', '=', 'needs_strip')]"/>
<filter name="active" string="Active"
domain="[('state', '=', 'active')]"/>
<separator/>
<group>
<filter name="group_facility" string="Facility"
context="{'group_by': 'facility_id'}"/>
<filter name="group_type" string="Type"
context="{'group_by': 'rack_type'}"/>
<filter name="group_state" string="Status"
context="{'group_by': 'state'}"/>
</group>
</search>
</field>
</record>
<record id="action_fp_rack" model="ir.actions.act_window">
<field name="name">Racks &amp; Fixtures</field>
<field name="res_model">fusion.plating.rack</field>
<field name="view_mode">list,kanban,form</field>
<field name="search_view_id" ref="view_fp_rack_search"/>
</record>
</odoo>