From ad3d6261af33d3923b42b29568d64b1a7f939a01 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 26 May 2026 20:58:23 -0400 Subject: [PATCH] feat(configurator): A3 - add Express x_fc_* flags to sale.order.line --- .../models/sale_order_line.py | 21 ++++++++++++++ .../tests/test_express_so_line_fields.py | 28 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 fusion_plating/fusion_plating_configurator/tests/test_express_so_line_fields.py diff --git a/fusion_plating/fusion_plating_configurator/models/sale_order_line.py b/fusion_plating/fusion_plating_configurator/models/sale_order_line.py index 11585489..b4011096 100644 --- a/fusion_plating/fusion_plating_configurator/models/sale_order_line.py +++ b/fusion_plating/fusion_plating_configurator/models/sale_order_line.py @@ -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, diff --git a/fusion_plating/fusion_plating_configurator/tests/test_express_so_line_fields.py b/fusion_plating/fusion_plating_configurator/tests/test_express_so_line_fields.py new file mode 100644 index 00000000..97bab2a2 --- /dev/null +++ b/fusion_plating/fusion_plating_configurator/tests/test_express_so_line_fields.py @@ -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)