Files
Odoo-Modules/fusion_plating/fusion_plating/models/fp_work_role.py
gsinghpal d9f58b9851 changes
2026-04-26 15:05:17 -04:00

63 lines
2.5 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
#
# Phase 1 (Sub 11) — relocated from fusion_plating_bridge_mrp. The model
# never had MRP fields; the bridge module was just its initial home.
from odoo import api, fields, models
class FpWorkRole(models.Model):
"""A shop role assigned to a recipe step and to the employees who
can perform it.
Shops run the same part with different staffing models:
- One employee does every step (small shop): give them every role.
- Specialists per operation (masking person, racker, plater): one
role each.
- Cross-trained workers: multiple roles per worker.
The model is intentionally flat — no hierarchy, no workflow. Roles
are just tags that the step auto-assignment compares.
"""
_name = 'fp.work.role'
_description = 'Fusion Plating — Shop Work Role'
_order = 'sequence, code'
name = fields.Char(string='Role Name', required=True, translate=True)
code = fields.Char(string='Code', required=True,
help='Short stable identifier used in auto-assignment.')
sequence = fields.Integer(default=10)
description = fields.Char(
string='Description',
help='Short operator-facing description of what this role covers.',
)
icon = fields.Selection(
[('fa-scissors', 'Scissors (masking)'),
('fa-cogs', 'Cogs (racking)'),
('fa-flask', 'Flask (plating)'),
('fa-fire', 'Fire (oven)'),
('fa-search', 'Inspection'),
('fa-wrench', 'Wrench (rework)'),
('fa-user', 'Generic worker')],
string='Icon', default='fa-user',
)
active = fields.Boolean(default=True)
mastery_required = fields.Integer(
string='Mastery Threshold',
default=lambda self: self._default_mastery_required(),
help='Number of successful step completions a worker needs on this '
"role before they're added to its qualified-operators list "
'automatically. 1 = promote on first success; 3 = solid '
"default for everyday roles; 5+ for tasks that need real "
'practice. Defaults from Settings > Fusion Plating > '
'Default Mastery Threshold.',
)
@api.model
def _default_mastery_required(self):
return self.env.company.x_fc_default_mastery_threshold or 3