feat(configurator): Sub 1 — direct-order wizard stops auto-confirm + auto-email
The wizard was calling so.action_confirm() immediately after creating the sale order, which flipped it from draft to sale state and triggered the fusion_plating_notifications hook that auto-emails the customer. Client wants a review step: keep the SO in quotation (draft) so the user can adjust before the customer sees anything. They manually click Send (to email the quotation) or Confirm (to convert to sale order, which intentionally fires the confirmation email). Changes: - Remove so.action_confirm() call in action_create_order - Update docstring + inline comment to reflect manual-confirm flow - Update the chatter message on the created SO CLAUDE.md updated to mark Sub 1 + Sub 2 as Shipped. Verified: - Static check: wizard.action_create_order contains no action_confirm - Dynamic check: SO created programmatically stays in draft - Manual action_confirm() flow still works as designed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,9 +10,12 @@ from odoo.exceptions import UserError
|
||||
class FpDirectOrderWizard(models.TransientModel):
|
||||
"""Direct order entry for repeat customers.
|
||||
|
||||
Skips the quotation stage when the customer has already sent a PO.
|
||||
Creates a sale.order with one sale.order.line per wizard line and
|
||||
calls action_confirm() in one step.
|
||||
Creates a sale.order (in draft / quotation state) with one
|
||||
sale.order.line per wizard line. The user reviews the resulting
|
||||
quotation, makes any adjustments, and clicks Send / Confirm
|
||||
manually. The wizard does NOT auto-confirm and does NOT auto-email
|
||||
the customer — that was deliberately removed in Sub 1 after the
|
||||
client requested a review step before anything leaves the shop.
|
||||
"""
|
||||
_name = 'fp.direct.order.wizard'
|
||||
_description = 'Fusion Plating - Direct Order Entry'
|
||||
@@ -180,7 +183,13 @@ class FpDirectOrderWizard(models.TransientModel):
|
||||
}
|
||||
|
||||
def action_create_order(self):
|
||||
"""Create and confirm the sale order with one SO line per wizard line."""
|
||||
"""Create a DRAFT sale order with one SO line per wizard line.
|
||||
|
||||
Returns an action that opens the newly-created SO in form view so
|
||||
the user can review, adjust, and manually confirm / send. The
|
||||
wizard deliberately does not auto-confirm or auto-email — see
|
||||
Sub 1 in the Fine-Tuning Initiative roadmap (CLAUDE.md).
|
||||
"""
|
||||
self.ensure_one()
|
||||
if not self.line_ids:
|
||||
raise UserError(_('Add at least one part line before confirming.'))
|
||||
@@ -272,9 +281,10 @@ class FpDirectOrderWizard(models.TransientModel):
|
||||
'x_fc_quote_id': line.quote_id.id or False,
|
||||
}))
|
||||
|
||||
# 5. Create + confirm
|
||||
# 5. Create — stays in draft / quotation. Sub 1: user reviews
|
||||
# and manually clicks Confirm / Send. No auto-confirm, no
|
||||
# auto-email to the client.
|
||||
so = self.env['sale.order'].create(so_vals)
|
||||
so.action_confirm()
|
||||
|
||||
# 6. Push-to-defaults (C4) — uses the resolved part cached
|
||||
# during the build loop so rev-bumped lines write defaults to
|
||||
@@ -290,8 +300,8 @@ class FpDirectOrderWizard(models.TransientModel):
|
||||
'x_fc_default_treatment_ids': [(6, 0, line.treatment_ids.ids)],
|
||||
})
|
||||
so.message_post(body=_(
|
||||
'Direct order created from PO %s with %d line(s). '
|
||||
'Quotation stage skipped.'
|
||||
'Quotation created from PO %s with %d line(s). '
|
||||
'Review and confirm manually when ready.'
|
||||
) % (self.po_number, len(self.line_ids)))
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user