Revert "chore(plating): retire fusion_plating_culture — not a priority"
This reverts commit 95310c459d.
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
# -*- 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 FpValueRecognition(models.Model):
|
||||
"""A peer recognition tied to a specific value.
|
||||
|
||||
Example: "I saw Sarah living Value #3 yesterday when she stayed late
|
||||
to re-mask a customer part after first-article inspection flagged a
|
||||
nick."
|
||||
|
||||
Recognitions start in draft, move to published, and can be archived
|
||||
when they roll off a stand-up wall or a newsletter.
|
||||
"""
|
||||
_name = 'fusion.plating.value.recognition'
|
||||
_description = 'Fusion Plating — Value Recognition'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'nomination_date desc, id desc'
|
||||
|
||||
name = fields.Char(
|
||||
string='Title',
|
||||
required=True,
|
||||
tracking=True,
|
||||
help='Short headline for the recognition, e.g. '
|
||||
'"Sarah stayed late for the customer".',
|
||||
default=lambda self: _('New Recognition'),
|
||||
)
|
||||
reference = fields.Char(
|
||||
string='Reference',
|
||||
readonly=True,
|
||||
copy=False,
|
||||
default=lambda self: _('New'),
|
||||
)
|
||||
value_id = fields.Many2one(
|
||||
'fusion.plating.value',
|
||||
string='Value',
|
||||
required=True,
|
||||
tracking=True,
|
||||
ondelete='restrict',
|
||||
)
|
||||
set_id = fields.Many2one(
|
||||
'fusion.plating.value.set',
|
||||
string='Value Set',
|
||||
related='value_id.set_id',
|
||||
store=True,
|
||||
readonly=True,
|
||||
)
|
||||
recognized_employee_id = fields.Many2one(
|
||||
'hr.employee',
|
||||
string='Recognized',
|
||||
required=True,
|
||||
tracking=True,
|
||||
help='The person being recognized.',
|
||||
)
|
||||
nominated_by_id = fields.Many2one(
|
||||
'res.users',
|
||||
string='Nominated By',
|
||||
default=lambda self: self.env.user,
|
||||
tracking=True,
|
||||
)
|
||||
nomination_date = fields.Datetime(
|
||||
string='Nominated On',
|
||||
default=fields.Datetime.now,
|
||||
tracking=True,
|
||||
)
|
||||
story = fields.Html(
|
||||
string='Story',
|
||||
help='What happened? Describe the moment you saw the value being '
|
||||
'lived.',
|
||||
)
|
||||
state = fields.Selection(
|
||||
[
|
||||
('draft', 'Draft'),
|
||||
('published', 'Published'),
|
||||
('archived', 'Archived'),
|
||||
],
|
||||
string='Status',
|
||||
default='draft',
|
||||
required=True,
|
||||
tracking=True,
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
'res.company',
|
||||
string='Company',
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
color = fields.Integer(
|
||||
string='Color Index',
|
||||
default=0,
|
||||
)
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
if not vals.get('reference') or vals['reference'] == _('New'):
|
||||
vals['reference'] = self.env['ir.sequence'].next_by_code(
|
||||
'fusion.plating.value.recognition'
|
||||
) or _('New')
|
||||
return super().create(vals_list)
|
||||
|
||||
def action_publish(self):
|
||||
for rec in self:
|
||||
rec.state = 'published'
|
||||
rec.message_post(body=_('Recognition published.'))
|
||||
return True
|
||||
|
||||
def action_archive_recognition(self):
|
||||
for rec in self:
|
||||
rec.state = 'archived'
|
||||
rec.message_post(body=_('Recognition archived.'))
|
||||
return True
|
||||
|
||||
def action_reset_to_draft(self):
|
||||
for rec in self:
|
||||
rec.state = 'draft'
|
||||
return True
|
||||
Reference in New Issue
Block a user