diff --git a/fusion_plating/fusion_plating_configurator/models/fp_part_catalog.py b/fusion_plating/fusion_plating_configurator/models/fp_part_catalog.py index d18d22a0..85733956 100644 --- a/fusion_plating/fusion_plating_configurator/models/fp_part_catalog.py +++ b/fusion_plating/fusion_plating_configurator/models/fp_part_catalog.py @@ -288,6 +288,27 @@ class FpPartCatalog(models.Model): 'wizard\'s "Save as Default" toggle is ticked.', ) + # ---- Express Orders defaults (2026-05-26) ---- + default_specification_text = fields.Text( + string='Default Specification (Customer-Facing)', + help='Pre-fills the Specification cell when this part is added to an ' + 'Express Order. Written here automatically on order confirm — ' + 'type once, reuse forever.', + ) + default_bake_instructions = fields.Text( + string='Default Bake Instructions', + help='Pre-fills the Bake cell. Empty = bake step is skipped on every ' + 'order; non-empty = bake step runs and these instructions show ' + 'on the operator tablet.', + ) + default_masking_enabled = fields.Boolean( + string='Default Masking Enabled', + default=True, + help='Default state of the Masking checkbox on Express Order lines. ' + 'When False, masking + de-masking recipe nodes are skipped at ' + 'job creation.', + ) + # Substrate density mapping (g/cm³) for material weight calculation _SUBSTRATE_DENSITY = { 'aluminium': 2.70, diff --git a/fusion_plating/fusion_plating_configurator/tests/test_express_part_defaults.py b/fusion_plating/fusion_plating_configurator/tests/test_express_part_defaults.py new file mode 100644 index 00000000..d9d9b73f --- /dev/null +++ b/fusion_plating/fusion_plating_configurator/tests/test_express_part_defaults.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Express Orders — Task A1 schema tests +from odoo.tests.common import TransactionCase, tagged + + +@tagged('post_install', '-at_install', 'fp_express') +class TestExpressPartDefaults(TransactionCase): + def test_new_fields_exist(self): + Part = self.env['fp.part.catalog'] + self.assertIn('default_specification_text', Part._fields) + self.assertIn('default_bake_instructions', Part._fields) + self.assertIn('default_masking_enabled', Part._fields) + + def test_default_masking_enabled_default_value(self): + partner = self.env['res.partner'].create({'name': 'Test Customer'}) + part = self.env['fp.part.catalog'].create({ + 'partner_id': partner.id, + 'part_number': 'TEST-001', + 'revision': 'A', + 'name': 'Test Part', + }) + self.assertTrue(part.default_masking_enabled) + self.assertFalse(part.default_specification_text) + self.assertFalse(part.default_bake_instructions)