fix(configurator): money fields now show $ everywhere
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>
This commit is contained in:
@@ -19,8 +19,10 @@
|
||||
<field name="certification_level"/>
|
||||
<field name="pricing_method"/>
|
||||
<field name="currency_id" column_invisible="1"/>
|
||||
<field name="base_rate"/>
|
||||
<field name="minimum_charge"/>
|
||||
<field name="base_rate" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}" sum="Total"/>
|
||||
<field name="minimum_charge" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="active" widget="boolean_toggle"/>
|
||||
</list>
|
||||
</field>
|
||||
@@ -54,15 +56,23 @@
|
||||
<group string="Pricing">
|
||||
<group>
|
||||
<field name="pricing_method"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="base_rate"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="base_rate" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="thickness_factor"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="masking_rate_per_zone"/>
|
||||
<field name="setup_fee"/>
|
||||
<field name="minimum_charge"/>
|
||||
<field name="rush_surcharge_percent"/>
|
||||
<field name="masking_rate_per_zone" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="setup_fee" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="minimum_charge" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
<label for="rush_surcharge_percent"/>
|
||||
<div class="o_row">
|
||||
<field name="rush_surcharge_percent" nolabel="1" class="oe_inline"/>
|
||||
<span class="ms-1">%</span>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
@@ -70,7 +80,7 @@
|
||||
<field name="complexity_surcharge_ids">
|
||||
<list editable="bottom">
|
||||
<field name="complexity"/>
|
||||
<field name="surcharge_percent"/>
|
||||
<field name="surcharge_percent" string="Surcharge %"/>
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
@@ -198,19 +198,23 @@
|
||||
<group>
|
||||
<group string="Delivery & Fees">
|
||||
<field name="delivery_method"/>
|
||||
<field name="shipping_fee"/>
|
||||
<field name="delivery_fee"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="shipping_fee" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="delivery_fee" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Pricing"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="calculated_price" widget="monetary" readonly="1"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
class="fw-bold fs-4"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="estimator_override_price" widget="monetary"/>
|
||||
<field name="estimator_override_price" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
@@ -298,8 +302,11 @@
|
||||
<field name="surface_area"/>
|
||||
<field name="quantity"/>
|
||||
<field name="currency_id" column_invisible="1"/>
|
||||
<field name="calculated_price"/>
|
||||
<field name="estimator_override_price" string="Final Price"/>
|
||||
<field name="calculated_price" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}" sum="Total"/>
|
||||
<field name="estimator_override_price" string="Final Price"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}" sum="Total"/>
|
||||
<field name="state" widget="badge"
|
||||
decoration-success="state == 'confirmed'"
|
||||
decoration-info="state == 'draft'"
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="treatment_type"/>
|
||||
<field name="default_duration_minutes"/>
|
||||
<field name="default_duration_minutes" string="Duration (min)"/>
|
||||
<field name="currency_id" column_invisible="1"/>
|
||||
<field name="default_cost"/>
|
||||
<field name="default_cost" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}" sum="Total"/>
|
||||
<field name="active" widget="boolean_toggle"/>
|
||||
</list>
|
||||
</field>
|
||||
@@ -41,9 +42,14 @@
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="default_duration_minutes"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="default_cost"/>
|
||||
<label for="default_duration_minutes"/>
|
||||
<div class="o_row">
|
||||
<field name="default_duration_minutes" nolabel="1" class="oe_inline"/>
|
||||
<span class="ms-1">min</span>
|
||||
</div>
|
||||
<field name="currency_id"/>
|
||||
<field name="default_cost" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user