feat(configurator): A1 - add Express Orders per-part defaults to fp.part.catalog
This commit is contained in:
@@ -288,6 +288,27 @@ class FpPartCatalog(models.Model):
|
|||||||
'wizard\'s "Save as Default" toggle is ticked.',
|
'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 mapping (g/cm³) for material weight calculation
|
||||||
_SUBSTRATE_DENSITY = {
|
_SUBSTRATE_DENSITY = {
|
||||||
'aluminium': 2.70,
|
'aluminium': 2.70,
|
||||||
|
|||||||
@@ -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)
|
||||||
Reference in New Issue
Block a user