feat(configurator): A3 - add Express x_fc_* flags to sale.order.line

This commit is contained in:
gsinghpal
2026-05-26 20:58:23 -04:00
parent f04b31cec7
commit ad3d6261af
2 changed files with 49 additions and 0 deletions

View File

@@ -312,6 +312,27 @@ class SaleOrderLine(models.Model):
'pair, falling back to the part\'s default range. Prints '
'verbatim on the cert, packing slip, and invoice.',
)
# ---- Express Orders per-line flags (2026-05-26) ----
# Mirror fp.direct.order.line.{customer_line_ref, masking_enabled, bake_instructions}
# and persist past wizard confirm so _fp_apply_express_overrides_to_job can read them.
x_fc_customer_line_ref = fields.Char(
string='Customer Line Job #',
help='Per-line customer sub-reference (e.g. ABC, DEF). '
'Prints on customer docs (quote, SO, invoice, packing slip).',
)
x_fc_masking_enabled = fields.Boolean(
string='Masking Enabled',
default=True,
help='When False, the job-creation hook spawns fp.job.node.override '
'(included=False) for every masking + de_masking node on the recipe.',
)
x_fc_bake_instructions = fields.Text(
string='Bake Instructions',
help='Empty = bake steps are opted out of the job. Non-empty = bake '
'steps run, with this text shown on the operator tablet under '
'fp.job.step.instructions.',
)
x_fc_revision_snapshot = fields.Char(
string='Revision (snapshot)',
copy=False,

View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Express Orders — Task A3 schema tests
from odoo.tests.common import TransactionCase, tagged
@tagged('post_install', '-at_install', 'fp_express')
class TestExpressSoLineFields(TransactionCase):
def test_new_fields_exist(self):
Line = self.env['sale.order.line']
self.assertIn('x_fc_customer_line_ref', Line._fields)
self.assertIn('x_fc_masking_enabled', Line._fields)
self.assertIn('x_fc_bake_instructions', Line._fields)
def test_masking_default_true(self):
partner = self.env['res.partner'].create({'name': 'C'})
product = self.env['product.product'].search(
[('default_code', '=', 'FP-SERVICE')], limit=1
) or self.env['product.product'].create({
'name': 'svc', 'type': 'service', 'default_code': 'FP-SERVICE',
})
so = self.env['sale.order'].create({
'partner_id': partner.id,
'order_line': [(0, 0, {'product_id': product.id, 'product_uom_qty': 1})],
})
line = so.order_line[:1]
self.assertTrue(line.x_fc_masking_enabled)
self.assertFalse(line.x_fc_customer_line_ref)
self.assertFalse(line.x_fc_bake_instructions)