folder rename
This commit is contained in:
110
fusion_plating/fusion_plating_quality/models/fp_doc_control.py
Normal file
110
fusion_plating/fusion_plating_quality/models/fp_doc_control.py
Normal file
@@ -0,0 +1,110 @@
|
||||
# -*- 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 fields, models
|
||||
|
||||
|
||||
class FpDocControl(models.Model):
|
||||
"""Controlled document register.
|
||||
|
||||
Lightweight document control without depending on the Enterprise
|
||||
`documents` or `sign` modules. Each entry tracks the document name,
|
||||
revision, owner, lifecycle state, and the list of operators trained
|
||||
on this revision (a common audit ask).
|
||||
"""
|
||||
_name = 'fusion.plating.doc.control'
|
||||
_description = 'Fusion Plating — Controlled Document'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'doc_type, name, revision desc'
|
||||
|
||||
name = fields.Char(
|
||||
string='Title',
|
||||
required=True,
|
||||
tracking=True,
|
||||
)
|
||||
doc_type = fields.Selection(
|
||||
[
|
||||
('procedure', 'Procedure'),
|
||||
('work_instruction', 'Work Instruction'),
|
||||
('form', 'Form'),
|
||||
('standard', 'Standard'),
|
||||
('manual', 'Manual'),
|
||||
],
|
||||
string='Type',
|
||||
default='procedure',
|
||||
required=True,
|
||||
tracking=True,
|
||||
)
|
||||
revision = fields.Char(
|
||||
string='Revision',
|
||||
required=True,
|
||||
tracking=True,
|
||||
)
|
||||
effective_date = fields.Date(
|
||||
string='Effective Date',
|
||||
tracking=True,
|
||||
)
|
||||
review_date = fields.Date(
|
||||
string='Next Review',
|
||||
tracking=True,
|
||||
)
|
||||
owner_id = fields.Many2one(
|
||||
'res.users',
|
||||
string='Owner',
|
||||
default=lambda self: self.env.user,
|
||||
tracking=True,
|
||||
)
|
||||
state = fields.Selection(
|
||||
[
|
||||
('draft', 'Draft'),
|
||||
('in_review', 'In Review'),
|
||||
('approved', 'Approved'),
|
||||
('effective', 'Effective'),
|
||||
('obsolete', 'Obsolete'),
|
||||
],
|
||||
string='Status',
|
||||
default='draft',
|
||||
required=True,
|
||||
tracking=True,
|
||||
)
|
||||
attachment_ids = fields.Many2many(
|
||||
'ir.attachment',
|
||||
'fp_doc_control_attachment_rel',
|
||||
'doc_id',
|
||||
'attachment_id',
|
||||
string='Attachments',
|
||||
)
|
||||
trained_user_ids = fields.Many2many(
|
||||
'res.users',
|
||||
'fp_doc_control_trained_rel',
|
||||
'doc_id',
|
||||
'user_id',
|
||||
string='Trained Users',
|
||||
help='Operators who have been trained on this revision of the document.',
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
'res.company',
|
||||
string='Company',
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
def action_submit_for_review(self):
|
||||
self.write({'state': 'in_review'})
|
||||
|
||||
def action_approve(self):
|
||||
self.write({'state': 'approved'})
|
||||
|
||||
def action_make_effective(self):
|
||||
self.write({
|
||||
'state': 'effective',
|
||||
'effective_date': fields.Date.context_today(self),
|
||||
})
|
||||
|
||||
def action_mark_obsolete(self):
|
||||
self.write({'state': 'obsolete'})
|
||||
|
||||
def action_reset_to_draft(self):
|
||||
self.write({'state': 'draft'})
|
||||
Reference in New Issue
Block a user