feat(fusion_plating_jobs): fp.job.display_wo_name compute (WO # 00001)
Plan task P1.1. Formats fp.job.name as "WO # <last-segment>" for tablet/dashboard surfaces. Underlying name field is unchanged so back-office forms, reports, and emails keep WH/JOB/00001. Tests not run locally — fusion_plating not mounted in odoo-modsdev container. Verify on entech: -u fusion_plating_jobs --test-tags fp_jobs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc. — License OPL-1
|
||||
from odoo.tests.common import TransactionCase, tagged
|
||||
|
||||
|
||||
@tagged('-at_install', 'post_install', 'fp_jobs')
|
||||
class TestDisplayWoName(TransactionCase):
|
||||
"""fp.job.display_wo_name — Tablet/dashboard formatter."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.partner = self.env['res.partner'].create({'name': 'Test Cust'})
|
||||
self.product = self.env['product.product'].create({'name': 'Test Prod'})
|
||||
|
||||
def _make_job(self, name):
|
||||
return self.env['fp.job'].create({
|
||||
'name': name,
|
||||
'partner_id': self.partner.id,
|
||||
'product_id': self.product.id,
|
||||
'qty': 1,
|
||||
})
|
||||
|
||||
def test_wh_job_prefix_formatted(self):
|
||||
job = self._make_job('WH/JOB/00001')
|
||||
self.assertEqual(job.display_wo_name, 'WO # 00001')
|
||||
|
||||
def test_wh_job_with_year(self):
|
||||
job = self._make_job('WH/JOB/2026/00042')
|
||||
self.assertEqual(job.display_wo_name, 'WO # 00042')
|
||||
|
||||
def test_plain_numeric(self):
|
||||
job = self._make_job('00123')
|
||||
self.assertEqual(job.display_wo_name, 'WO # 00123')
|
||||
|
||||
def test_falsy_name(self):
|
||||
# New record before save → name is False; computed returns empty
|
||||
job = self.env['fp.job'].new({'name': False})
|
||||
self.assertEqual(job.display_wo_name, '')
|
||||
Reference in New Issue
Block a user