feat(promote-customer-spec): Phase B — two-picker SO line UX
Spec-side picker (x_fc_customer_spec_id / customer_spec_id) added on: - sale.order.line (via quality inherit — onchange autofill, create() fallback to part default, _prepare_invoice_line carry) - account.move.line (via quality inherit — invoice rendering) - fp.part.catalog (via quality inherit — x_fc_default_customer_spec_id) - fp.direct.order.line (via quality inherit — wizard picker + autofill) - fp.direct.order.wizard (action_create_order post-creates spec on SO line) Thickness picker switched to fp.recipe.thickness (replaces coating-scoped): - sale.order.line.x_fc_thickness_id comodel + domain rewired to recipe - account.move.line + fp.delivery same - fp.direct.order.line.thickness_id same View inherits in quality add Specification picker next to legacy Primary Treatment column on: - SO form line tree - part catalog Default Treatments block - direct-order wizard line tree + drawer Wizard files (fp.contract.review.client.email.wizard) pulled from entech into the repo — they were ahead of the repo. Quality __init__ now imports wizards/. Legacy x_fc_coating_config_id + treatment_ids remain visible during transition; Phase E removes them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,8 @@ class FpDirectOrderLine(models.Model):
|
||||
'workflow downstream — leaving this blank lets that path '
|
||||
'through.',
|
||||
)
|
||||
# customer_spec_id is added by fusion_plating_quality (where
|
||||
# fusion.plating.customer.spec lives).
|
||||
treatment_ids = fields.Many2many(
|
||||
'fp.treatment',
|
||||
string='Additional Treatments',
|
||||
@@ -176,6 +178,8 @@ class FpDirectOrderLine(models.Model):
|
||||
# Pre-fill default treatments if any are configured.
|
||||
if not rec.treatment_ids and has_default_treatments:
|
||||
rec.treatment_ids = [(6, 0, part.x_fc_default_treatment_ids.ids)]
|
||||
# Default-spec auto-fill is implemented by an inherit in
|
||||
# fusion_plating_quality (where customer_spec_id field lives).
|
||||
# New-part auto-suggest: if neither default exists, this is
|
||||
# likely a first-time use of the part. Auto-tick the
|
||||
# push_to_defaults toggle so whatever Sarah picks becomes
|
||||
@@ -420,9 +424,9 @@ class FpDirectOrderLine(models.Model):
|
||||
rec.serial_ids = [(4, rec.serial_id.id)]
|
||||
job_number = fields.Char(string='Job #')
|
||||
thickness_id = fields.Many2one(
|
||||
'fp.coating.thickness',
|
||||
'fp.recipe.thickness',
|
||||
string='Thickness',
|
||||
domain="[('coating_config_id', '=', coating_config_id)]",
|
||||
domain="[('recipe_id', '=', process_variant_id)]",
|
||||
ondelete='set null',
|
||||
)
|
||||
|
||||
@@ -442,11 +446,11 @@ class FpDirectOrderLine(models.Model):
|
||||
and rec.quantity
|
||||
)
|
||||
|
||||
@api.onchange('coating_config_id')
|
||||
def _onchange_coating_clears_thickness(self):
|
||||
@api.onchange('process_variant_id')
|
||||
def _onchange_recipe_clears_thickness(self):
|
||||
for rec in self:
|
||||
if (rec.thickness_id
|
||||
and rec.thickness_id.coating_config_id != rec.coating_config_id):
|
||||
and rec.thickness_id.recipe_id != rec.process_variant_id):
|
||||
rec.thickness_id = False
|
||||
|
||||
def action_generate_serial(self):
|
||||
|
||||
@@ -575,6 +575,8 @@ class FpDirectOrderWizard(models.Model):
|
||||
'x_fc_internal_description': line.internal_description or False,
|
||||
'x_fc_coating_config_id': line.coating_config_id.id,
|
||||
'x_fc_treatment_ids': [(6, 0, line.treatment_ids.ids)],
|
||||
# x_fc_customer_spec_id is added to vals by an extension
|
||||
# of this method in fusion_plating_quality.
|
||||
'x_fc_part_deadline': line.part_deadline,
|
||||
'x_fc_part_deadline_offset_days': line.part_deadline_offset_days,
|
||||
'x_fc_rush_order': line.rush_order,
|
||||
|
||||
@@ -176,9 +176,9 @@
|
||||
optional="hide"/>
|
||||
<field name="thickness_id"
|
||||
options="{'no_quick_create': True}"
|
||||
context="{'default_coating_config_id': coating_config_id}"
|
||||
domain="[('coating_config_id', '=', coating_config_id)]"
|
||||
invisible="not coating_config_id"
|
||||
context="{'default_recipe_id': process_variant_id}"
|
||||
domain="[('recipe_id', '=', process_variant_id)]"
|
||||
invisible="not process_variant_id"
|
||||
optional="show"/>
|
||||
<field name="serial_ids"
|
||||
widget="many2many_tags"
|
||||
@@ -196,7 +196,7 @@
|
||||
<field name="job_number" optional="hide"/>
|
||||
<field name="treatment_ids"
|
||||
widget="many2many_tags"
|
||||
optional="hide"/>
|
||||
invisible="1"/>
|
||||
<field name="quantity"
|
||||
optional="show"/>
|
||||
<field name="unit_price"
|
||||
|
||||
Reference in New Issue
Block a user