feat(configurator): A2 - add Express flags to fp.direct.order.line
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Express Orders — Task A2 schema tests
|
||||||
|
from odoo.tests.common import TransactionCase, tagged
|
||||||
|
|
||||||
|
|
||||||
|
@tagged('post_install', '-at_install', 'fp_express')
|
||||||
|
class TestExpressLineFields(TransactionCase):
|
||||||
|
def test_new_fields_exist(self):
|
||||||
|
Line = self.env['fp.direct.order.line']
|
||||||
|
self.assertIn('customer_line_ref', Line._fields)
|
||||||
|
self.assertIn('masking_enabled', Line._fields)
|
||||||
|
self.assertIn('bake_instructions', Line._fields)
|
||||||
|
|
||||||
|
def test_masking_default_true(self):
|
||||||
|
partner = self.env['res.partner'].create({'name': 'Cust'})
|
||||||
|
wiz = self.env['fp.direct.order.wizard'].create({'partner_id': partner.id})
|
||||||
|
line = self.env['fp.direct.order.line'].create({
|
||||||
|
'wizard_id': wiz.id,
|
||||||
|
'quantity': 1,
|
||||||
|
})
|
||||||
|
self.assertTrue(line.masking_enabled)
|
||||||
|
self.assertFalse(line.customer_line_ref)
|
||||||
|
self.assertFalse(line.bake_instructions)
|
||||||
@@ -459,6 +459,24 @@ class FpDirectOrderLine(models.Model):
|
|||||||
'or from the part\'s default range.',
|
'or from the part\'s default range.',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ---- Express Orders per-line flags (2026-05-26) ----
|
||||||
|
customer_line_ref = fields.Char(
|
||||||
|
string='Customer Line Job #',
|
||||||
|
help='Per-line customer sub-reference (e.g. ABC, DEF). Distinct from '
|
||||||
|
'the order-level Customer Job #. Prints on customer docs.',
|
||||||
|
)
|
||||||
|
masking_enabled = fields.Boolean(
|
||||||
|
string='Masking Enabled',
|
||||||
|
default=True,
|
||||||
|
help='When False, masking + de-masking recipe nodes are opted out '
|
||||||
|
'when the job is created.',
|
||||||
|
)
|
||||||
|
bake_instructions = fields.Text(
|
||||||
|
string='Bake Instructions',
|
||||||
|
help='Free-text bake instructions. Empty = bake steps are opted out. '
|
||||||
|
'Non-empty = bake step instructions on the operator tablet.',
|
||||||
|
)
|
||||||
|
|
||||||
# ---- Computes ----
|
# ---- Computes ----
|
||||||
@api.depends('quantity', 'unit_price')
|
@api.depends('quantity', 'unit_price')
|
||||||
def _compute_line_subtotal(self):
|
def _compute_line_subtotal(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user