changes
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
{
|
||||
'name': 'Fusion Plating — Receiving & Inspection',
|
||||
'version': '19.0.3.1.0',
|
||||
'version': '19.0.3.3.0',
|
||||
'category': 'Manufacturing/Plating',
|
||||
'summary': 'Parts receiving, inspection, damage logging, and manufacturing gate.',
|
||||
'description': """
|
||||
@@ -31,7 +31,6 @@ Provides:
|
||||
'depends': [
|
||||
'fusion_plating_configurator',
|
||||
'sale_management',
|
||||
'mrp',
|
||||
],
|
||||
'data': [
|
||||
'security/fp_receiving_security.xml',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Phase 6 (Sub 11) — drop legacy MRP column from fp_racking_inspection.
|
||||
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
cr.execute("ALTER TABLE fp_racking_inspection DROP COLUMN IF EXISTS production_id")
|
||||
_logger.info("Sub 11: dropped production_id from fp_racking_inspection")
|
||||
@@ -8,4 +8,5 @@ from . import fp_receiving_line
|
||||
from . import fp_receiving
|
||||
from . import fp_racking_inspection
|
||||
from . import sale_order
|
||||
from . import mrp_production
|
||||
# Phase 6 (Sub 11) — mrp_production hook retired.
|
||||
# from . import mrp_production
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# only). One record per MO.
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
class FpRackingInspection(models.Model):
|
||||
@@ -19,13 +19,13 @@ class FpRackingInspection(models.Model):
|
||||
_order = 'create_date desc, id desc'
|
||||
|
||||
name = fields.Char(compute='_compute_name', store=True)
|
||||
production_id = fields.Many2one(
|
||||
'mrp.production',
|
||||
string='Manufacturing Order',
|
||||
required=True,
|
||||
ondelete='cascade',
|
||||
index=True,
|
||||
tracking=True,
|
||||
# Phase 6 (Sub 11) — production_id retired (MRP module gone).
|
||||
# x_fc_job_id is the canonical link. Declared here so this module's
|
||||
# views can reference it at view-load time; fusion_plating_jobs adds
|
||||
# the constraints + compute overrides via inheritance.
|
||||
x_fc_job_id = fields.Many2one(
|
||||
'fp.job', string='Plating Job',
|
||||
index=True, ondelete='cascade',
|
||||
)
|
||||
sale_order_id = fields.Many2one(
|
||||
'sale.order',
|
||||
@@ -81,33 +81,27 @@ class FpRackingInspection(models.Model):
|
||||
flagged_count = fields.Integer(compute='_compute_line_stats')
|
||||
has_variance = fields.Boolean(compute='_compute_line_stats')
|
||||
|
||||
_sql_constraints = [
|
||||
('fp_racking_insp_mo_uniq',
|
||||
'unique(production_id)',
|
||||
'Only one racking inspection per manufacturing order.'),
|
||||
]
|
||||
# Phase 6 (Sub 11) — production_id retired (MRP module gone). The
|
||||
# uniqueness constraint that used to ride on production_id is now
|
||||
# enforced via @api.constrains on x_fc_job_id (added by
|
||||
# fusion_plating_jobs).
|
||||
|
||||
# ---- Computes ------------------------------------------------------------
|
||||
|
||||
@api.depends('production_id.name', 'partner_id.name')
|
||||
@api.depends('partner_id.name')
|
||||
def _compute_name(self):
|
||||
# Override in fusion_plating_jobs reads x_fc_job_id; this base
|
||||
# version is the bare-bones fallback.
|
||||
for rec in self:
|
||||
if rec.production_id:
|
||||
rec.name = _('Inspection — %s') % rec.production_id.name
|
||||
else:
|
||||
rec.name = _('Racking Inspection')
|
||||
rec.name = _('Racking Inspection')
|
||||
|
||||
@api.depends('production_id.origin')
|
||||
@api.depends('partner_id')
|
||||
def _compute_sale_order(self):
|
||||
SO = self.env['sale.order']
|
||||
# Override in fusion_plating_jobs walks x_fc_job_id.sale_order_id;
|
||||
# this base version is a fallback.
|
||||
for rec in self:
|
||||
so = False
|
||||
if rec.production_id and rec.production_id.origin:
|
||||
so = SO.search(
|
||||
[('name', '=', rec.production_id.origin)], limit=1,
|
||||
)
|
||||
rec.sale_order_id = so or False
|
||||
rec.partner_id = so.partner_id if so else False
|
||||
rec.sale_order_id = rec.sale_order_id or False
|
||||
rec.partner_id = rec.partner_id or False
|
||||
|
||||
@api.depends('sale_order_id')
|
||||
def _compute_receiving_id(self):
|
||||
@@ -160,7 +154,7 @@ class FpRackingInspection(models.Model):
|
||||
rec.activity_schedule(
|
||||
'mail.mail_activity_data_todo',
|
||||
summary=_('Racking discrepancy on %s') % (
|
||||
rec.production_id.name or ''
|
||||
rec.name or ''
|
||||
),
|
||||
note=_(
|
||||
'%(n)d line(s) flagged — review before starting '
|
||||
@@ -224,3 +218,12 @@ class FpRackingInspectionLine(models.Model):
|
||||
def _compute_qty_variance(self):
|
||||
for rec in self:
|
||||
rec.qty_variance = (rec.qty_found or 0) - (rec.qty_expected or 0)
|
||||
|
||||
@api.depends('part_catalog_id', 'part_number', 'qty_found', 'qty_expected')
|
||||
def _compute_display_name(self):
|
||||
for rec in self:
|
||||
label = (rec.part_catalog_id.display_name
|
||||
or rec.part_number
|
||||
or 'Inspection Line')
|
||||
qty = '%d/%d' % (rec.qty_found or 0, rec.qty_expected or 0)
|
||||
rec.display_name = '%s (%s)' % (label, qty)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
# Part of the Fusion Plating product family.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class FpReceivingDamage(models.Model):
|
||||
@@ -36,3 +36,16 @@ class FpReceivingDamage(models.Model):
|
||||
customer_notified = fields.Boolean(string='Customer Notified')
|
||||
customer_response = fields.Text(string='Customer Response')
|
||||
resolved = fields.Boolean(string='Resolved')
|
||||
|
||||
@api.depends('severity', 'description', 'receiving_id')
|
||||
def _compute_display_name(self):
|
||||
labels = dict(self._fields['severity'].selection)
|
||||
for rec in self:
|
||||
severity = labels.get(rec.severity, rec.severity or '')
|
||||
desc = (rec.description or '').strip().split('\n', 1)[0][:40]
|
||||
bits = []
|
||||
if severity:
|
||||
bits.append(severity)
|
||||
if desc:
|
||||
bits.append(desc)
|
||||
rec.display_name = ': '.join(bits) or 'Damage'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
# Part of the Fusion Plating product family.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class FpReceivingLine(models.Model):
|
||||
@@ -31,3 +31,10 @@ class FpReceivingLine(models.Model):
|
||||
string='Condition', default='good',
|
||||
)
|
||||
notes = fields.Text(string='Notes')
|
||||
|
||||
@api.depends('part_number', 'part_catalog_id', 'received_qty', 'expected_qty')
|
||||
def _compute_display_name(self):
|
||||
for rec in self:
|
||||
label = rec.part_number or rec.part_catalog_id.display_name or 'Receiving Line'
|
||||
qty = '%d/%d' % (rec.received_qty or 0, rec.expected_qty or 0)
|
||||
rec.display_name = '%s (%s)' % (label, qty)
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="production_id" readonly="1"/>
|
||||
<field name="x_fc_job_id" readonly="1"/>
|
||||
<field name="sale_order_id" readonly="1"/>
|
||||
<field name="receiving_id" readonly="1"/>
|
||||
</group>
|
||||
@@ -98,7 +98,7 @@
|
||||
decoration-success="state == 'done'"
|
||||
decoration-danger="state == 'discrepancy_flagged'">
|
||||
<field name="name"/>
|
||||
<field name="production_id"/>
|
||||
<field name="x_fc_job_id"/>
|
||||
<field name="sale_order_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="line_count" string="Parts"/>
|
||||
@@ -115,7 +115,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
<field name="production_id"/>
|
||||
<field name="x_fc_job_id"/>
|
||||
<field name="partner_id"/>
|
||||
<separator/>
|
||||
<filter name="filter_pending"
|
||||
|
||||
Reference in New Issue
Block a user