feat(configurator): A5 - wizard schema (rename notes, add Express fields, retire manual currency_id)

This commit is contained in:
gsinghpal
2026-05-26 20:58:23 -04:00
parent 08bc2b6a89
commit 92b690aef1
6 changed files with 204 additions and 8 deletions

View File

@@ -139,10 +139,31 @@ class FpDirectOrderWizard(models.Model):
)
# ---- Currency + invoicing ----
currency_id = fields.Many2one(
'res.currency', string='Currency',
default=lambda self: self.env.company.currency_id,
# Express Orders (2026-05-26): currency is now driven by pricelist_id.
# The legacy free-standing currency_id Many2one(res.currency) is retired;
# currency_id stays as a stored-related so existing Monetary widgets keep
# working without manifest churn.
pricelist_id = fields.Many2one(
'product.pricelist',
string='Pricelist',
default=lambda self: self._fp_default_pricelist(),
help='Drives both the order currency and the price computation. '
'Replaces the legacy currency_id Many2one(res.currency). '
'Customer-default flows in via res.partner.property_product_pricelist '
'on partner pick.',
)
currency_id = fields.Many2one(
'res.currency',
related='pricelist_id.currency_id',
store=True,
string='Currency',
readonly=True,
)
@api.model
def _fp_default_pricelist(self):
"""Default pricelist = company's default. Re-resolved on partner pick."""
return self.env.company.partner_id.property_product_pricelist.id or False
invoice_strategy = fields.Selection(
[('deposit', 'Deposit'), ('progress', 'Progress Billing'),
('net_terms', 'Net Terms'), ('cod_prepay', 'COD / Prepay')],
@@ -164,7 +185,44 @@ class FpDirectOrderWizard(models.Model):
)
# ---- Notes ----
notes = fields.Text(string='Internal Notes')
# Express Orders (2026-05-26): the legacy `notes` field was misleadingly
# labelled "Internal Notes" but its action_create_order path actually
# writes it to sale.order.note (which IS customer-facing and prints on
# quote / SO / invoice PDFs). Split into two distinct fields:
# - terms_and_conditions → sale.order.note (customer-facing, prints)
# - internal_notes → sale.order.x_fc_internal_notes (internal-only)
# Pre-migration renames the existing `notes` column → `terms_and_conditions`
# so the existing data preserves its customer-facing semantic.
terms_and_conditions = fields.Text(
string='Terms & Conditions',
help='Customer-facing terms — prints on quote / SO / invoice. '
'Seeded from res.company.invoice_terms_html with partner-level '
'override via res.partner.invoice_terms.',
)
internal_notes = fields.Text(
string='Order-Level Internal Notes',
help='Visible only to the estimator / planner / shop. Never prints.',
)
# ---- Express Orders header (2026-05-26) ----
material_process = fields.Char(
string='Material / Process Tag',
help='Free-text shop tag (e.g. ENP-STEEL-HP-ADVANCED). Informational.',
)
validity_date = fields.Date(
string='Quote Validity',
help='Mirrors sale.order.validity_date — when the quote/SO expires.',
)
view_source = fields.Selection(
[('express', 'Express Orders View'),
('legacy', 'Legacy Direct Order View')],
string='View Source',
default='express',
required=True,
readonly=True,
help='Which view created this draft. Drafts list routes click-action '
'to the matching form. Dropped at phase-out Phase 4.',
)
# ---- Lines ----
line_ids = fields.One2many(
@@ -561,7 +619,12 @@ class FpDirectOrderWizard(models.Model):
'x_fc_is_blanket_order': self.is_blanket_order,
'x_fc_block_partial_shipments': self.block_partial_shipments,
'origin': 'Direct Order',
'note': self.notes or False,
'note': self.terms_and_conditions or False,
# Express Orders header (2026-05-26)
'x_fc_internal_notes': self.internal_notes or False,
'x_fc_material_process': self.material_process or False,
'pricelist_id': self.pricelist_id.id if self.pricelist_id else False,
'validity_date': self.validity_date or False,
'order_line': [],
}

View File

@@ -339,9 +339,17 @@
</group>
</group>
</page>
<page string="Notes" name="notes">
<field name="notes" nolabel="1"
placeholder="Internal notes for the estimator / planner - not shown to the customer."/>
<page string="Notes &amp; Terms" name="notes">
<group>
<group string="Order-Level Internal Notes (never prints)">
<field name="internal_notes" nolabel="1"
placeholder="Visible only to estimator / planner / shop."/>
</group>
<group string="Terms &amp; Conditions (prints on customer docs)">
<field name="terms_and_conditions" nolabel="1"
placeholder="Customer-facing terms — seeded from company default."/>
</group>
</group>
</page>
</notebook>