feat(configurator): A1 - add Express Orders per-part defaults to fp.part.catalog

This commit is contained in:
gsinghpal
2026-05-26 20:58:23 -04:00
parent 807ed86ef6
commit 5f898d4209
2 changed files with 45 additions and 0 deletions

View File

@@ -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,

View File

@@ -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)