Root cause: pricing.rule records had currency_id=NULL because the
default=lambda only applies on new records. Monetary fields without a
currency silently render as plain numbers — no $ symbol.
Fixes:
1. currency_id now required=True on fp.pricing.rule, fp.treatment,
fp.customer.price.list, fp.quote.configurator, fusion.plating.quote.request
— so it can never be missing going forward.
2. post_init_hook + matching backfill helper in
fusion_plating_configurator/__init__.py pins the company currency
on any existing records that were created before the required flag.
Ran on upgrade → all 4 pricing.rule rows now have CAD/$.
3. Flipped two remaining Float money fields to Monetary:
- fp.job.consumption.unit_cost and total_cost (were Float digits=4/2)
- (mrp.workorder.x_fc_workcenter_cost_hour stays Float — it is a
related field from core mrp.workcenter.costs_hour which is Float)
4. Every Monetary field reference in views now has explicit:
widget="monetary" options="{'currency_field': 'currency_id'}"
Previously Odoo's default rendering dropped the $ in some contexts.
Touched: fp_pricing_rule_views (list + form), fp_treatment_views,
fp_customer_price_list_views (already done), fp_quote_configurator_views
(list + form shipping/delivery/calculated/override), fp_quote_request_views
(list + form), fp_job_consumption_views, mrp_production_views job-costing
group, direct-order wizard (already done earlier).
5. Unit / % suffix polish as we went: rush_surcharge_percent shows "%",
default_duration_minutes shows "min" on treatment form, treatment list
labels duration column.
Verified: all 4 pricing rules now render "$0.45", "$0.85" etc; 62 records
across 6 models all have currency_id populated; zero remaining Float $
fields in the codebase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
# Part of the Fusion Plating product family.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class FpTreatment(models.Model):
|
|
"""Pre- or post-treatment step (bead blast, zincate, bake, passivate, etc.).
|
|
|
|
Used by coating configurations to specify which preparation and
|
|
finishing steps are required for a given process.
|
|
"""
|
|
_name = 'fp.treatment'
|
|
_description = 'Fusion Plating — Treatment'
|
|
_order = 'treatment_type, sequence, name'
|
|
|
|
name = fields.Char(
|
|
string='Treatment',
|
|
required=True,
|
|
help='e.g. "Bead Blast", "Zincate", "Hydrogen Embrittlement Bake"',
|
|
)
|
|
treatment_type = fields.Selection(
|
|
[('pre', 'Pre-Treatment'), ('post', 'Post-Treatment')],
|
|
string='Type',
|
|
required=True,
|
|
default='pre',
|
|
)
|
|
sequence = fields.Integer(string='Sequence', default=10)
|
|
default_duration_minutes = fields.Float(
|
|
string='Default Duration (min)',
|
|
help='Estimated duration per application in minutes.',
|
|
)
|
|
currency_id = fields.Many2one(
|
|
'res.currency',
|
|
string='Currency',
|
|
required=True,
|
|
default=lambda self: self.env.company.currency_id,
|
|
)
|
|
default_cost = fields.Monetary(
|
|
string='Default Cost',
|
|
currency_field='currency_id',
|
|
help='Default cost per application. Can be overridden on pricing rules.',
|
|
)
|
|
description = fields.Text(string='Description')
|
|
active = fields.Boolean(string='Active', default=True)
|
|
|
|
_sql_constraints = [
|
|
('fp_treatment_name_type_uniq', 'unique(name, treatment_type)',
|
|
'Treatment name must be unique per type.'),
|
|
]
|