Files
Odoo-Modules/fusion_plating/fusion_plating_bridge_documents/models/fp_fair.py
gsinghpal 8c76a16366 chore(plating): de-dash shipped code + intake-neutral customer emails
Replace em-dashes and en-dashes with hyphens across 789 shipped source
files (py/xml/js/scss) so the delivered module reads as human-written;
em-dashes had become a recognizable AI-generated tell. Internal .md dev
notes are excluded. The WO-sticker mojibake strippers keep their dash
search targets (now written — / –). No logic changes: comments
and display strings only; validated with py_compile + lxml parse.

Rewrite the 7 customer notification emails to be intake-neutral
(ship-in / drop-off / pickup) and repair-aware, and fix the Shipped
email documents line (packing slip vs bill of lading; certificate only
when issued). Subjects use a hyphen separator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 00:16:19 -04:00

66 lines
2.2 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.
from odoo import _, api, fields, models
_FOLDER_XMLID = 'fusion_plating_bridge_documents.documents_folder_plating_quality'
class FpFair(models.Model):
"""Bridge extension: expose Documents workspace on FAIRs."""
_inherit = 'fusion.plating.fair'
x_fc_document_ids = fields.Many2many(
'documents.document',
'fp_bridge_fair_document_rel',
'fair_id',
'document_id',
string='Quality Documents',
compute='_compute_x_fc_document_ids',
store=False,
help='Documents in the Plating - Quality workspace mirrored from '
'attachments on this FAIR.',
)
x_fc_document_count = fields.Integer(
string='# Documents',
compute='_compute_x_fc_document_ids',
store=False,
)
@api.depends('message_attachment_count')
def _compute_x_fc_document_ids(self):
Document = self.env.get('documents.document') if 'documents.document' in self.env else None
for rec in self:
if not Document:
rec.x_fc_document_ids = False
rec.x_fc_document_count = 0
continue
docs = Document.sudo().search([
('attachment_id.res_model', '=', 'fusion.plating.fair'),
('attachment_id.res_id', '=', rec.id),
])
rec.x_fc_document_ids = docs
rec.x_fc_document_count = len(docs)
def action_view_documents(self):
self.ensure_one()
folder_id = self._get_default_folder_id()
ctx = {}
if folder_id:
ctx['default_folder_id'] = folder_id
ctx['searchpanel_default_folder_id'] = folder_id
return {
'name': _('Quality Documents'),
'type': 'ir.actions.act_window',
'res_model': 'documents.document',
'view_mode': 'kanban,list,form',
'domain': [('id', 'in', self.x_fc_document_ids.ids)],
'context': ctx,
}
def _get_default_folder_id(self):
folder = self.env.ref(_FOLDER_XMLID, raise_if_not_found=False)
return folder.id if folder else 0