changes
This commit is contained in:
@@ -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 FpThicknessReading(models.Model):
|
||||
@@ -20,9 +20,8 @@ class FpThicknessReading(models.Model):
|
||||
certificate_id = fields.Many2one(
|
||||
'fp.certificate', string='Certificate', ondelete='cascade',
|
||||
)
|
||||
production_id = fields.Many2one(
|
||||
'mrp.production', string='Manufacturing Order',
|
||||
)
|
||||
# Phase 6 (Sub 11) — production_id retired (MRP module gone).
|
||||
# Thickness readings link via certificate_id and quality_check_id.
|
||||
reading_number = fields.Integer(
|
||||
string='Reading #', default=1, help='Sequence number (n=1, n=2, n=3).',
|
||||
)
|
||||
@@ -65,3 +64,14 @@ class FpThicknessReading(models.Model):
|
||||
measuring_time_seconds = fields.Integer(
|
||||
string='Measuring Time (sec)', default=120,
|
||||
)
|
||||
|
||||
@api.depends('reading_number', 'nip_mils', 'certificate_id')
|
||||
def _compute_display_name(self):
|
||||
for rec in self:
|
||||
ctx = rec.certificate_id.display_name or ''
|
||||
label = 'Reading #%d' % (rec.reading_number or 0)
|
||||
if rec.nip_mils:
|
||||
label = '%s (%.4f mils)' % (label, rec.nip_mils)
|
||||
if ctx:
|
||||
label = '%s — %s' % (label, ctx)
|
||||
rec.display_name = label
|
||||
|
||||
Reference in New Issue
Block a user